Skip to content
Merged
Show file tree
Hide file tree
Changes from 22 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
13 changes: 13 additions & 0 deletions .github/actions/setup-foundry/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: 'Setup Foundry'
description: 'Install Foundry and Soldeer dependencies'

runs:
using: 'composite'
steps:
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1

- name: Install Soldeer dependencies
shell: bash
run: forge soldeer install
working-directory: ./solidity
3 changes: 3 additions & 0 deletions .github/actions/yarn-build-with-cache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ inputs:
runs:
using: 'composite'
steps:
- name: Setup Foundry
uses: ./.github/actions/setup-foundry

- name: yarn-cache
id: yarn-cache
uses: ./.github/actions/yarn-cache
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/bytecode-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ jobs:
- name: yarn-install
run: yarn install

- name: foundry-install
uses: foundry-rs/foundry-toolchain@v1
- name: Setup Foundry
uses: ./.github/actions/setup-foundry

# Run the command on PR branch
- name: Run command on PR branch
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/npm-beta-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,12 @@ jobs:
SNAPSHOT_VERSION=$(node -p "require('./typescript/sdk/package.json').version")
echo "snapshot=$SNAPSHOT_VERSION" >> $GITHUB_OUTPUT

# Need to install foundry for the build step. `hardhat-foundry` expects foundry to be installed.
- name: Setup Foundry
uses: ./.github/actions/setup-foundry

- name: Build packages
run: yarn build
run: yarn build && yarn build:zk

- name: Publish beta packages
run: yarn changeset publish --tag ${{ inputs.snapshot_tag }} --no-git-tag
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ jobs:
- name: yarn-install
run: yarn install

- name: foundry-install
uses: foundry-rs/foundry-toolchain@v1
- name: Setup Foundry
uses: ./.github/actions/setup-foundry

- name: forge-build
run: cd solidity && forge build --build-info
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/storage-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ jobs:
- name: yarn-install
run: yarn install

- name: foundry-install
uses: foundry-rs/foundry-toolchain@v1
- name: Setup Foundry
uses: ./.github/actions/setup-foundry

# Run the command on PR branch
- name: Run command on PR branch
Expand Down
20 changes: 2 additions & 18 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,6 @@ jobs:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
submodules: recursive

- name: foundry-install
uses: foundry-rs/foundry-toolchain@v1

- name: Set Foundry RPC URLs for fork tests
env:
MAINNET3_ARBITRUM_RPC_URLS: ${{ secrets.MAINNET3_ARBITRUM_RPC_URLS }}
Expand Down Expand Up @@ -323,9 +320,6 @@ jobs:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
submodules: recursive

- name: foundry-install
uses: foundry-rs/foundry-toolchain@v1

- name: install-hyperlane-cli
id: install-hyperlane-cli
uses: ./.github/actions/install-cli
Expand Down Expand Up @@ -363,9 +357,6 @@ jobs:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
submodules: recursive

- name: foundry-install
uses: foundry-rs/foundry-toolchain@v1

- name: install-hyperlane-cli
id: install-hyperlane-cli
uses: ./.github/actions/install-cli
Expand Down Expand Up @@ -638,10 +629,6 @@ jobs:
echo "skip-e2e=false" >> $GITHUB_OUTPUT
fi

- name: foundry-install
if: steps.check-conditions.outputs.skip-e2e != 'true'
uses: foundry-rs/foundry-toolchain@v1

- name: setup rust
if: steps.check-conditions.outputs.skip-e2e != 'true'
uses: dtolnay/rust-toolchain@stable
Expand Down Expand Up @@ -784,9 +771,6 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}

- name: foundry-install
uses: foundry-rs/foundry-toolchain@v1

- name: yarn-build
uses: ./.github/actions/yarn-build-with-cache
with:
Expand Down Expand Up @@ -849,8 +833,8 @@ jobs:
yarn install
yarn build

- name: foundry-install
uses: foundry-rs/foundry-toolchain@v1
- name: Setup Foundry
uses: ./.github/actions/setup-foundry

- name: Run tests with coverage
run: yarn coverage
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
2 changes: 1 addition & 1 deletion solidity/bytecode.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
OUTPUT_PATH=${1:-bytecode}
EXCLUDE="test|mock|interfaces|libs|upgrade"
EXCLUDE="test|mock|interfaces|libs|upgrade|dependencies"

IFS=$'\n'
CONTRACT_FILES=($(find ./contracts -type f))
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.5",
"dependencies": {
"@arbitrum/nitro-contracts": "^1.2.1",
"@chainlink/contracts-ccip": "^1.5.0",
"@eth-optimism/contracts": "^0.6.0",
"@hyperlane-xyz/utils": "19.11.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.11.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",
"@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/
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"
]
}
4 changes: 4 additions & 0 deletions solidity/zk-hardhat.config.cts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import '@matterlabs/hardhat-zksync-solc';
import '@nomicfoundation/hardhat-foundry';
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