diff --git a/.github/workflows/solidity-fork-tests.yml b/.github/workflows/solidity-fork-tests.yml new file mode 100644 index 00000000000..05d36bf6a46 --- /dev/null +++ b/.github/workflows/solidity-fork-tests.yml @@ -0,0 +1,55 @@ +name: Solidity Fork Tests + +on: + push: + branches: + - main + pull_request: + paths: + - 'solidity/**' + - '.github/workflows/solidity-fork-tests.yml' + schedule: + # Run daily at 6:00 UTC + - cron: '0 6 * * *' + workflow_dispatch: + +concurrency: + group: solidity-fork-tests-${{ github.ref }} + cancel-in-progress: true + +env: + TURBO_TELEMETRY_DISABLED: 1 + TURBO_API: https://cache.depot.dev + TURBO_TOKEN: ${{ secrets.DEPOT_TURBO_TOKEN }} + TURBO_TEAM: ${{ secrets.DEPOT_ORG_ID }} + +jobs: + fork-tests: + runs-on: depot-ubuntu-latest + timeout-minutes: 30 + steps: + - uses: actions/checkout@v5 + with: + submodules: recursive + + - name: Set Foundry RPC URLs for fork tests + env: + MAINNET3_ETHEREUM_RPC_URLS: ${{ secrets.MAINNET3_ETHEREUM_RPC_URLS }} + MAINNET3_OPTIMISM_RPC_URLS: ${{ secrets.MAINNET3_OPTIMISM_RPC_URLS }} + MAINNET3_POLYGON_RPC_URLS: ${{ secrets.MAINNET3_POLYGON_RPC_URLS }} + MAINNET3_ARBITRUM_RPC_URLS: ${{ secrets.MAINNET3_ARBITRUM_RPC_URLS }} + MAINNET3_BASE_RPC_URLS: ${{ secrets.MAINNET3_BASE_RPC_URLS }} + run: | + # Extract first URL from comma-separated list and set as env vars + echo "RPC_URL_MAINNET=${MAINNET3_ETHEREUM_RPC_URLS%%,*}" >> $GITHUB_ENV + echo "RPC_URL_OPTIMISM=${MAINNET3_OPTIMISM_RPC_URLS%%,*}" >> $GITHUB_ENV + echo "RPC_URL_POLYGON=${MAINNET3_POLYGON_RPC_URLS%%,*}" >> $GITHUB_ENV + echo "RPC_URL_ARBITRUM=${MAINNET3_ARBITRUM_RPC_URLS%%,*}" >> $GITHUB_ENV + echo "RPC_URL_BASE=${MAINNET3_BASE_RPC_URLS%%,*}" >> $GITHUB_ENV + + - name: yarn-build + uses: ./.github/actions/yarn-build-with-cache + + - name: Run Fork Tests + working-directory: ./solidity + run: yarn test:fork diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c00d281fde9..3369a874e91 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -161,12 +161,6 @@ jobs: ref: ${{ github.event.pull_request.head.sha || github.sha }} submodules: recursive - - name: Set Foundry RPC URLs for fork tests - env: - MAINNET3_ARBITRUM_RPC_URLS: ${{ secrets.MAINNET3_ARBITRUM_RPC_URLS }} - run: | - echo "FOUNDRY_RPC_URL_ARBITRUM=${MAINNET3_ARBITRUM_RPC_URLS%%,*}" >> $GITHUB_ENV - - name: yarn-build uses: ./.github/actions/yarn-build-with-cache with: diff --git a/solidity/.env.default b/solidity/.env.default new file mode 100644 index 00000000000..064d262078b --- /dev/null +++ b/solidity/.env.default @@ -0,0 +1,7 @@ +# Default RPC URLs for fork tests (public endpoints) +# These can be overridden by setting env vars before sourcing this file +export RPC_URL_MAINNET="${RPC_URL_MAINNET:-https://eth.merkle.io}" +export RPC_URL_OPTIMISM="${RPC_URL_OPTIMISM:-https://mainnet.optimism.io}" +export RPC_URL_POLYGON="${RPC_URL_POLYGON:-https://rpc-mainnet.matic.quiknode.pro}" +export RPC_URL_ARBITRUM="${RPC_URL_ARBITRUM:-https://arb1.arbitrum.io/rpc}" +export RPC_URL_BASE="${RPC_URL_BASE:-https://mainnet.base.org}" diff --git a/solidity/.gitignore b/solidity/.gitignore index e73e30122e6..04989c8a87a 100644 --- a/solidity/.gitignore +++ b/solidity/.gitignore @@ -7,6 +7,7 @@ coverage/ coverage.json storage/ *.env +!.env.default *lcov.info # Foundry out diff --git a/solidity/foundry.toml b/solidity/foundry.toml index 67f5ae5d28d..64990fc3981 100644 --- a/solidity/foundry.toml +++ b/solidity/foundry.toml @@ -19,11 +19,11 @@ ignored_warnings_from = ['lib', 'test', 'contracts/test'] verbosity = 4 [rpc_endpoints] -mainnet = "https://eth.merkle.io" -optimism = "https://mainnet.optimism.io " -polygon = "https://rpc-mainnet.matic.quiknode.pro" -arbitrum = "https://arbitrum.drpc.org" -base = "https://mainnet.base.org" +mainnet = "${RPC_URL_MAINNET}" +optimism = "${RPC_URL_OPTIMISM}" +polygon = "${RPC_URL_POLYGON}" +arbitrum = "${RPC_URL_ARBITRUM}" +base = "${RPC_URL_BASE}" [fuzz] runs = 50 diff --git a/solidity/package.json b/solidity/package.json index b226366b1fe..df7cbce339d 100644 --- a/solidity/package.json +++ b/solidity/package.json @@ -84,6 +84,7 @@ "test:hardhat": "yarn hardhat-esm test", "test:forge": "yarn fixtures && forge test -vvv --decode-internal --no-match-contract Everclear", "test:ci": "yarn version:changed && yarn test:hardhat && yarn test:forge --no-match-test testFork", + "test:fork": "sh -c '. ./.env.default && forge test --match-test testFork && forge test --match-contract ForkTest'", "gas": "forge snapshot", "gas-ci": "yarn gas --check --tolerance 2 || (echo 'Manually update gas snapshot' && exit 1)", "slither": "slither .", diff --git a/solidity/test/token/TokenBridgeCctp.t.sol b/solidity/test/token/TokenBridgeCctp.t.sol index 12863ac787e..8a3209922d8 100644 --- a/solidity/test/token/TokenBridgeCctp.t.sol +++ b/solidity/test/token/TokenBridgeCctp.t.sol @@ -1229,7 +1229,7 @@ contract TokenBridgeCctpV2Test is TokenBridgeCctpV1Test { // deploy proxy code to deployer address, which is configured as recipient on cctp messages deployCodeTo( - "../node_modules/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol:TransparentUpgradeableProxy", + "dependencies/@openzeppelin-contracts-4.9.3/contracts/proxy/transparent/TransparentUpgradeableProxy.sol:TransparentUpgradeableProxy", abi.encode( address(implementation), proxyAdmin,