Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fluffy-tools-decide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hyperlane-xyz/core": minor
---

Use soldeer for solidity dependencies instead of npm
126 changes: 126 additions & 0 deletions .github/workflows/npm-beta-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
name: NPM Beta Release

on:
workflow_dispatch:
inputs:
snapshot_tag:
description: 'NPM dist-tag for the beta release'
required: true
default: 'beta'
type: choice
options:
- beta
- alpha
- rc
- preview

concurrency:
group: npm-beta-release
cancel-in-progress: false

env:
LOG_FORMAT: PRETTY
TURBO_TELEMETRY_DISABLED: 1
TURBO_API: https://cache.depot.dev
TURBO_TOKEN: ${{ secrets.DEPOT_TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.DEPOT_ORG_ID }}

jobs:
beta-release:
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
submodules: recursive

- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version-file: .nvmrc

- name: Get short SHA
id: sha
run: echo "short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT

- name: Get base version
id: version
run: |
BASE_VERSION=$(node -p "require('./typescript/sdk/package.json').version")
BETA_VERSION="${BASE_VERSION}-${{ inputs.snapshot_tag }}.${{ steps.sha.outputs.short }}"
echo "base=$BASE_VERSION" >> $GITHUB_OUTPUT
echo "beta=$BETA_VERSION" >> $GITHUB_OUTPUT

- name: Check for changesets
id: changesets
run: |
CHANGESET_COUNT=$(find .changeset -name "*.md" ! -name "README.md" ! -name "config.json" 2>/dev/null | wc -l | tr -d ' ')
echo "count=$CHANGESET_COUNT" >> $GITHUB_OUTPUT
if [ "$CHANGESET_COUNT" -eq 0 ]; then
echo "::warning::No pending changesets found. Beta releases require pending changeset files."
echo "To create a beta release, first add a changeset with: yarn changeset"
else
echo "Found $CHANGESET_COUNT changeset(s)"
fi

- name: Install dependencies
if: steps.changesets.outputs.count != '0'
run: yarn install --immutable

- name: Create snapshot versions
if: steps.changesets.outputs.count != '0'
run: yarn changeset version --snapshot ${{ inputs.snapshot_tag || 'beta' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Need to install foundry for the build step. `hardhat-foundry` expects foundry to be installed.
- name: foundry-install
uses: foundry-rs/foundry-toolchain@v1

# Install Soldeer dependencies
- name: Install Soldeer dependencies
run: forge soldeer install
working-directory: ./solidity

- name: Build packages
if: steps.changesets.outputs.count != '0'
run: yarn build && yarn build:zk

- name: Publish beta packages
if: steps.changesets.outputs.count != '0'
run: |
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> $HOME/.npmrc
yarn changeset publish --tag ${{ inputs.snapshot_tag || 'beta' }}
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: true

- name: Summary
if: steps.changesets.outputs.count != '0'
run: |
echo "### Beta Release Published" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Version:** \`${{ steps.version.outputs.beta }}\`" >> $GITHUB_STEP_SUMMARY
echo "**NPM Tag:** \`${{ inputs.snapshot_tag }}\`" >> $GITHUB_STEP_SUMMARY
echo "**Branch:** \`${{ github.ref_name }}\`" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Install with:" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`bash" >> $GITHUB_STEP_SUMMARY
echo "npm install @hyperlane-xyz/sdk@${{ inputs.snapshot_tag }}" >> $GITHUB_STEP_SUMMARY
echo "npm install @hyperlane-xyz/cli@${{ inputs.snapshot_tag }}" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY

- name: No changesets summary
if: steps.changesets.outputs.count == '0'
run: |
echo "### No Beta Release" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "No pending changesets found. Beta releases require pending changeset files." >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "To create a beta release:" >> $GITHUB_STEP_SUMMARY
echo "1. Add a changeset: \`yarn changeset\`" >> $GITHUB_STEP_SUMMARY
echo "2. Commit the changeset file" >> $GITHUB_STEP_SUMMARY
echo "3. Run this workflow again" >> $GITHUB_STEP_SUMMARY
8 changes: 8 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ jobs:
- name: foundry-install
uses: foundry-rs/foundry-toolchain@v1

- name: Install Soldeer dependencies
run: forge soldeer install
working-directory: ./solidity

- name: Set Foundry RPC URLs for fork tests
env:
MAINNET3_ARBITRUM_RPC_URLS: ${{ secrets.MAINNET3_ARBITRUM_RPC_URLS }}
Expand Down Expand Up @@ -821,6 +825,10 @@ jobs:
- name: foundry-install
uses: foundry-rs/foundry-toolchain@v1

- name: Install Soldeer dependencies
run: forge soldeer install
working-directory: ./solidity

- name: Run tests with coverage
run: yarn coverage
env:
Expand Down
2 changes: 2 additions & 0 deletions solidity/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ flattened/
buildArtifact.json
fixtures/
broadcast/
# Soldeer
dependencies/
# ZKSync
artifacts-zk
cache-zk
Expand Down
16 changes: 13 additions & 3 deletions solidity/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
src = 'contracts'
script = 'script'
out = 'out'
libs = ['node_modules', 'lib']
libs = ["dependencies", "lib"]
test = 'test'
cache_path = 'forge-cache'
allow_paths = ["../node_modules"]
solc_version = '0.8.22'
evm_version= 'paris'
optimizer_runs = 999_999
Expand All @@ -31,4 +30,15 @@ runs = 50
dictionary_weight = 80

[lint]
lint_on_build = false
lint_on_build = false

[dependencies]
forge-std = "1.9.2"
"@openzeppelin-contracts" = { version = "4.9.3", git = "https://github.com/OpenZeppelin/openzeppelin-contracts.git", tag = "v4.9.3" }
"@openzeppelin-contracts-upgradeable" = { version = "4.9.3", git = "https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable.git", tag = "v4.9.3" }
"@arbitrum-nitro-contracts" = { version = "1.2.1", git = "https://github.com/OffchainLabs/nitro-contracts.git", tag = "v1.2.1" }
"@chainlink-contracts-ccip" = { version = "1.5.0", git = "https://github.com/smartcontractkit/ccip.git", tag = "contracts-ccip/v1.5.0" }
"@eth-optimism-contracts" = { version = "0.6.0", git = "https://github.com/ethereum-optimism/optimism.git", tag = "@eth-optimism/contracts@0.6.0" }

[soldeer]
remappings_generate = false # We'll manage remappings manually to preserve import paths
1 change: 1 addition & 0 deletions solidity/hardhat.config.cts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import '@nomicfoundation/hardhat-foundry';
import '@nomiclabs/hardhat-ethers';
import '@nomiclabs/hardhat-waffle';
import '@typechain/hardhat';
Expand Down
15 changes: 6 additions & 9 deletions solidity/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,15 @@
"description": "Core solidity contracts for Hyperlane",
"version": "10.0.4",
"dependencies": {
"@arbitrum/nitro-contracts": "^1.2.1",
"@chainlink/contracts-ccip": "^1.5.0",
"@eth-optimism/contracts": "^0.6.0",
"@hyperlane-xyz/utils": "19.10.0",
"@matterlabs/hardhat-zksync-solc": "1.2.5",
"@matterlabs/hardhat-zksync-verify": "1.7.1",
"@openzeppelin/contracts": "^4.9.3",
"@openzeppelin/contracts-upgradeable": "^4.9.3"
"@hyperlane-xyz/utils": "19.10.0"
},
"devDependencies": {
"@ethersproject/abi": "*",
"@ethersproject/providers": "*",
"@hyperlane-xyz/tsconfig": "workspace:^",
"@matterlabs/hardhat-zksync-solc": "1.2.5",
"@matterlabs/hardhat-zksync-verify": "1.7.1",
"@nomicfoundation/hardhat-foundry": "1.2.0",
Comment thread
larryob marked this conversation as resolved.
"@nomiclabs/hardhat-ethers": "^2.2.3",
"@nomiclabs/hardhat-waffle": "^2.0.6",
"@typechain/ethers-v5": "^11.1.2",
Expand Down Expand Up @@ -58,7 +54,8 @@
"types": "./dist/index.d.ts",
"files": [
"/dist",
"/contracts"
"/contracts",
"/dependencies"
],
"engines": {
"node": ">=16"
Expand Down
13 changes: 7 additions & 6 deletions solidity/remappings.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@arbitrum=../node_modules/@arbitrum
@eth-optimism=../node_modules/@eth-optimism
@openzeppelin=../node_modules/@openzeppelin
@chainlink=../node_modules/@chainlink
ds-test/=lib/forge-std/lib/ds-test/src/
forge-std/=lib/forge-std/src/
@openzeppelin/contracts/=dependencies/@openzeppelin-contracts-4.9.3/contracts/
@openzeppelin/contracts-upgradeable/=dependencies/@openzeppelin-contracts-upgradeable-4.9.3/contracts/
@arbitrum/nitro-contracts/src/=dependencies/@arbitrum-nitro-contracts-1.2.1/src/
@chainlink/contracts-ccip/src/v0.8/=dependencies/@chainlink-contracts-ccip-1.5.0/contracts/src/v0.8/
@eth-optimism/contracts/=dependencies/@eth-optimism-contracts-0.6.0/packages/contracts/contracts/
forge-std/=dependencies/forge-std-1.9.2/src/
ds-test/=dependencies/forge-std-1.9.2/lib/ds-test/src/
Comment thread
larryob marked this conversation as resolved.
36 changes: 36 additions & 0 deletions solidity/soldeer.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[[dependencies]]
name = "@arbitrum-nitro-contracts"
version = "1.2.1"
git = "https://github.com/OffchainLabs/nitro-contracts.git"
rev = "399790bb6660486fadf958017efc4eec99be3dd2"

[[dependencies]]
name = "@chainlink-contracts-ccip"
version = "1.5.0"
git = "https://github.com/smartcontractkit/ccip.git"
rev = "b5529a39311a2fd39cafceb62e4bb8f40eeb2e9e"

[[dependencies]]
name = "@eth-optimism-contracts"
version = "0.6.0"
git = "https://github.com/ethereum-optimism/optimism.git"
rev = "9d1be2dab809f5a80a3927ed84fd9cda49a82c47"

[[dependencies]]
name = "@openzeppelin-contracts"
version = "4.9.3"
git = "https://github.com/OpenZeppelin/openzeppelin-contracts.git"
rev = "fd81a96f01cc42ef1c9a5399364968d0e07e9e90"

[[dependencies]]
name = "@openzeppelin-contracts-upgradeable"
version = "4.9.3"
git = "https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable.git"
rev = "3d4c0d5741b131c231e558d7a6213392ab3672a5"

[[dependencies]]
name = "forge-std"
version = "1.9.2"
url = "https://soldeer-revisions.s3.amazonaws.com/forge-std/1_9_2_06-08-2024_17:31:25_forge-std-1.9.2.zip"
checksum = "20fd008c7c69b6c737cc0284469d1c76497107bc3e004d8381f6d8781cb27980"
integrity = "f49457fb6591f0dfd8b59e02e6eb4508a115ef08a86b0803feb0a3939d82d783"
3 changes: 2 additions & 1 deletion solidity/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"hardhat.config.cts",
"./dist",
"zk-hardhat.config.cts",
"rootHardhatConfig.cts"
"rootHardhatConfig.cts",
"./dependencies"
Comment thread
larryob marked this conversation as resolved.
]
}
4 changes: 4 additions & 0 deletions solidity/zk-hardhat.config.cts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import '@nomicfoundation/hardhat-foundry';
import '@matterlabs/hardhat-zksync-solc';
import '@nomiclabs/hardhat-ethers';
import 'hardhat-ignore-warnings';
Expand All @@ -13,6 +14,9 @@ module.exports = {
version: '1.5.12',
compilerSource: 'binary',
enableEraVMExtensions: true,
settings: {
libraries: {},
},
},
defaultNetwork: 'ZKsyncInMemoryNode',
networks: {
Expand Down
Loading
Loading