Skip to content

Commit d5af0db

Browse files
paulbalajiclaude
andauthored
feat(ci): solidity fork test cronjob (#7459)
Co-authored-by: Claude <noreply@anthropic.com>
1 parent af2cd17 commit d5af0db

7 files changed

Lines changed: 70 additions & 12 deletions

File tree

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Solidity Fork Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
paths:
9+
- 'solidity/**'
10+
- '.github/workflows/solidity-fork-tests.yml'
11+
schedule:
12+
# Run daily at 6:00 UTC
13+
- cron: '0 6 * * *'
14+
workflow_dispatch:
15+
16+
concurrency:
17+
group: solidity-fork-tests-${{ github.ref }}
18+
cancel-in-progress: true
19+
20+
env:
21+
TURBO_TELEMETRY_DISABLED: 1
22+
TURBO_API: https://cache.depot.dev
23+
TURBO_TOKEN: ${{ secrets.DEPOT_TURBO_TOKEN }}
24+
TURBO_TEAM: ${{ secrets.DEPOT_ORG_ID }}
25+
26+
jobs:
27+
fork-tests:
28+
runs-on: depot-ubuntu-latest
29+
timeout-minutes: 30
30+
steps:
31+
- uses: actions/checkout@v5
32+
with:
33+
submodules: recursive
34+
35+
- name: Set Foundry RPC URLs for fork tests
36+
env:
37+
MAINNET3_ETHEREUM_RPC_URLS: ${{ secrets.MAINNET3_ETHEREUM_RPC_URLS }}
38+
MAINNET3_OPTIMISM_RPC_URLS: ${{ secrets.MAINNET3_OPTIMISM_RPC_URLS }}
39+
MAINNET3_POLYGON_RPC_URLS: ${{ secrets.MAINNET3_POLYGON_RPC_URLS }}
40+
MAINNET3_ARBITRUM_RPC_URLS: ${{ secrets.MAINNET3_ARBITRUM_RPC_URLS }}
41+
MAINNET3_BASE_RPC_URLS: ${{ secrets.MAINNET3_BASE_RPC_URLS }}
42+
run: |
43+
# Extract first URL from comma-separated list and set as env vars
44+
echo "RPC_URL_MAINNET=${MAINNET3_ETHEREUM_RPC_URLS%%,*}" >> $GITHUB_ENV
45+
echo "RPC_URL_OPTIMISM=${MAINNET3_OPTIMISM_RPC_URLS%%,*}" >> $GITHUB_ENV
46+
echo "RPC_URL_POLYGON=${MAINNET3_POLYGON_RPC_URLS%%,*}" >> $GITHUB_ENV
47+
echo "RPC_URL_ARBITRUM=${MAINNET3_ARBITRUM_RPC_URLS%%,*}" >> $GITHUB_ENV
48+
echo "RPC_URL_BASE=${MAINNET3_BASE_RPC_URLS%%,*}" >> $GITHUB_ENV
49+
50+
- name: yarn-build
51+
uses: ./.github/actions/yarn-build-with-cache
52+
53+
- name: Run Fork Tests
54+
working-directory: ./solidity
55+
run: yarn test:fork

.github/workflows/test.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,6 @@ jobs:
161161
ref: ${{ github.event.pull_request.head.sha || github.sha }}
162162
submodules: recursive
163163

164-
- name: Set Foundry RPC URLs for fork tests
165-
env:
166-
MAINNET3_ARBITRUM_RPC_URLS: ${{ secrets.MAINNET3_ARBITRUM_RPC_URLS }}
167-
run: |
168-
echo "FOUNDRY_RPC_URL_ARBITRUM=${MAINNET3_ARBITRUM_RPC_URLS%%,*}" >> $GITHUB_ENV
169-
170164
- name: yarn-build
171165
uses: ./.github/actions/yarn-build-with-cache
172166
with:

solidity/.env.default

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Default RPC URLs for fork tests (public endpoints)
2+
# These can be overridden by setting env vars before sourcing this file
3+
export RPC_URL_MAINNET="${RPC_URL_MAINNET:-https://eth.merkle.io}"
4+
export RPC_URL_OPTIMISM="${RPC_URL_OPTIMISM:-https://mainnet.optimism.io}"
5+
export RPC_URL_POLYGON="${RPC_URL_POLYGON:-https://rpc-mainnet.matic.quiknode.pro}"
6+
export RPC_URL_ARBITRUM="${RPC_URL_ARBITRUM:-https://arb1.arbitrum.io/rpc}"
7+
export RPC_URL_BASE="${RPC_URL_BASE:-https://mainnet.base.org}"

solidity/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ coverage/
77
coverage.json
88
storage/
99
*.env
10+
!.env.default
1011
*lcov.info
1112
# Foundry
1213
out

solidity/foundry.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ ignored_warnings_from = ['lib', 'test', 'contracts/test']
1919
verbosity = 4
2020

2121
[rpc_endpoints]
22-
mainnet = "https://eth.merkle.io"
23-
optimism = "https://mainnet.optimism.io "
24-
polygon = "https://rpc-mainnet.matic.quiknode.pro"
25-
arbitrum = "https://arbitrum.drpc.org"
26-
base = "https://mainnet.base.org"
22+
mainnet = "${RPC_URL_MAINNET}"
23+
optimism = "${RPC_URL_OPTIMISM}"
24+
polygon = "${RPC_URL_POLYGON}"
25+
arbitrum = "${RPC_URL_ARBITRUM}"
26+
base = "${RPC_URL_BASE}"
2727

2828
[fuzz]
2929
runs = 50

solidity/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@
8484
"test:hardhat": "yarn hardhat-esm test",
8585
"test:forge": "yarn fixtures && forge test -vvv --decode-internal --no-match-contract Everclear",
8686
"test:ci": "yarn version:changed && yarn test:hardhat && yarn test:forge --no-match-test testFork",
87+
"test:fork": "sh -c '. ./.env.default && forge test --match-test testFork && forge test --match-contract ForkTest'",
8788
"gas": "forge snapshot",
8889
"gas-ci": "yarn gas --check --tolerance 2 || (echo 'Manually update gas snapshot' && exit 1)",
8990
"slither": "slither .",

solidity/test/token/TokenBridgeCctp.t.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1229,7 +1229,7 @@ contract TokenBridgeCctpV2Test is TokenBridgeCctpV1Test {
12291229

12301230
// deploy proxy code to deployer address, which is configured as recipient on cctp messages
12311231
deployCodeTo(
1232-
"../node_modules/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol:TransparentUpgradeableProxy",
1232+
"dependencies/@openzeppelin-contracts-4.9.3/contracts/proxy/transparent/TransparentUpgradeableProxy.sol:TransparentUpgradeableProxy",
12331233
abi.encode(
12341234
address(implementation),
12351235
proxyAdmin,

0 commit comments

Comments
 (0)