Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add CI for integration test suite for contract upgrades #381

Open
wants to merge 81 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
d4c266d
chore: add workspace in package.json
viraj124 Dec 27, 2024
61e3417
feat: add docker setup in contracts package
viraj124 Dec 27, 2024
a51dc48
chore: add test placeholder contract
viraj124 Dec 27, 2024
a32de3f
feat: add upgrade scripts
viraj124 Dec 27, 2024
fab154b
chore: enable forking in hardhat config
viraj124 Dec 27, 2024
8647dbc
chore: add shell scripts
viraj124 Dec 27, 2024
e684961
chore: add additional committer signer in test setup
viraj124 Dec 27, 2024
c21c645
feat: add fork integration tests
viraj124 Dec 27, 2024
f36aef9
feat: add github action for fork integration tests
viraj124 Dec 27, 2024
7b932fb
chore: add build command in workflow
viraj124 Dec 27, 2024
2ebc8b7
chore: add docker and rust setup in ci
viraj124 Dec 30, 2024
22dafb8
chore: debug ci failure
viraj124 Dec 30, 2024
092e1db
chore: fast forward finalization time before relay
viraj124 Dec 30, 2024
8768fbb
chore: debug ci failure
viraj124 Dec 31, 2024
4a8ac6e
chore: debug ci failure
viraj124 Dec 31, 2024
3f56a0d
chore: update portal upgrade script
viraj124 Dec 31, 2024
b0e7f05
chore: uncomment code
viraj124 Dec 31, 2024
98afdf2
chore: add changeset
viraj124 Dec 31, 2024
666ccc6
chore: formatting
viraj124 Jan 1, 2025
51f7a9f
chore: update forc version
viraj124 Jan 2, 2025
1d53792
chore: debug format check in ci
viraj124 Jan 2, 2025
a134435
chore: ts lint fixes
viraj124 Jan 2, 2025
417733c
chore: update check shell script
viraj124 Jan 2, 2025
2ada6f5
chore: update order of commands in check script
viraj124 Jan 2, 2025
430bce2
chore: debug forc formatting
viraj124 Jan 2, 2025
da63952
chore: remove --check
viraj124 Jan 2, 2025
e933a2e
chore: update forc command
viraj124 Jan 2, 2025
08917b8
chore: add build command
viraj124 Jan 2, 2025
6348e38
chore: remove forc lock files in ci
viraj124 Jan 2, 2025
c4d176b
chore: update installation for forc-fmt
viraj124 Jan 3, 2025
8ff85d2
chore: test ci
viraj124 Jan 3, 2025
e31d697
chore: test ci
viraj124 Jan 3, 2025
396622d
chore: minor update
viraj124 Jan 3, 2025
537f38a
chore: small touchup in action.yml
viraj124 Jan 3, 2025
861d437
chore: revert workflow changes
viraj124 Jan 3, 2025
38ba169
chore: update fmt command
viraj124 Jan 3, 2025
37ad5bd
chore: add package.json replacement logic
viraj124 Jan 3, 2025
76aa970
chore: revert changes in build script
viraj124 Jan 3, 2025
cf1e1e4
chore: revert peer dependencies
viraj124 Jan 3, 2025
e3c3e33
chore: add setup for fork integration tests
viraj124 Jan 3, 2025
70da686
chore: revert workflow changes
viraj124 Jan 6, 2025
f2a469f
chore: remove unused workspace package
viraj124 Jan 6, 2025
9c9382d
chore: add integration test in tsconfig import
viraj124 Jan 6, 2025
2510749
refactor: use custom integration test helpers
viraj124 Jan 6, 2025
3925774
chore: remove unused test helper
viraj124 Jan 6, 2025
2d66759
chore: add block committer container env vars
viraj124 Jan 6, 2025
6572fac
chore: add comments
viraj124 Jan 6, 2025
5208aa6
refactor: add a utils section for integration tests
viraj124 Jan 6, 2025
d7ce105
fix
viraj124 Jan 6, 2025
2916314
fix: update import
viraj124 Jan 6, 2025
0c97237
chore: small touchup
viraj124 Jan 6, 2025
a666ed9
chore: simplify commiter role grant script
viraj124 Jan 7, 2025
4d954d5
chore: revert erc721 deployment script updates
viraj124 Jan 7, 2025
79575c9
chore: remove erc721 gateway from artifacts in docker container
viraj124 Jan 7, 2025
5d038a7
refactor: handle original docker setup to handle both fork and local env
viraj124 Jan 7, 2025
ab87875
chore: L1 container setup updates
viraj124 Jan 7, 2025
88a98b9
chore: remove docker startup script inside solidity-contracts
viraj124 Jan 7, 2025
81b7cf0
chore: set consensus secret in docker file
viraj124 Jan 7, 2025
f3c2438
refactor: remove docker setup in solidity-contracts package
viraj124 Jan 7, 2025
9075b59
chore: add comment
viraj124 Jan 7, 2025
f030adf
chore: add docker setup initiation in upgrade test suite workflow
viraj124 Jan 7, 2025
9296322
chore: remove workspace dependencies in solidity-contracts
viraj124 Jan 8, 2025
52bdd4c
chore: remove package.json in the L1 docker setup
viraj124 Jan 8, 2025
01f21a8
refactor: reloacte fork tests under integration-tests package
viraj124 Jan 8, 2025
55204c0
chore: remove placeholder contract
viraj124 Jan 8, 2025
a32508b
chore: remove integration tests in solidity-contracts package
viraj124 Jan 8, 2025
0625167
chore: add fork test run script in root
viraj124 Jan 8, 2025
537ca5a
chore: handle erc721 gateway setup for fork tests
viraj124 Jan 8, 2025
517b818
chore: remove package manager in package.json
viraj124 Jan 8, 2025
95194b8
chore: update test command in upgrade ci workflow
viraj124 Jan 8, 2025
b384ca5
chore: relocated upgrade scripts to a different deploy folder
viraj124 Jan 8, 2025
7990f2e
chore: revert updates in the original hardhat scripts
viraj124 Jan 8, 2025
58e22cf
chore: add forking related logic in hardhat config
viraj124 Jan 8, 2025
f4cea4d
chore: formatting
viraj124 Jan 8, 2025
92d1023
chore: ts linting
viraj124 Jan 8, 2025
bfd2896
chore: remove mocha in solidity-contracts
viraj124 Jan 8, 2025
3f0e2bd
chore: remove unused signer
viraj124 Jan 9, 2025
37df68c
test: remove zero hash commit logic
viraj124 Jan 9, 2025
0ceff15
fix: ts linting
viraj124 Jan 9, 2025
aff2ddc
test: remove duplicate code
viraj124 Jan 9, 2025
f9b9acb
chore: use fuel provider to fetch block using height
viraj124 Jan 9, 2025
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
6 changes: 6 additions & 0 deletions .changeset/thin-ways-dress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@fuel-bridge/solidity-contracts': minor
'@fuel-bridge/test-utils': minor
---

ci for contract upgrade test suite
46 changes: 46 additions & 0 deletions .github/workflows/upgrade-test-suite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Upgrade Test Suite

on:
push:
branches:
- main
pull_request:
branches:
- main # Target branch for the PR
release:
types: [published]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
upgrade-test-suite:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v3
- uses: FuelLabs/github-actions/setups/node@master
with:
node-version: 20.16.0
pnpm-version: 9.0.6
- uses: FuelLabs/github-actions/setups/docker@master
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: ./.github/actions/setup-rust
- name: Build project
run: pnpm build
- name: Sets the tenderly rpc endpoint in the L1 docker container env and sets forking variable for fuel core setup
run: |
cat << EOF > l1_chain.env
TENDERLY_RPC_URL=${{ secrets.TENDERLY_RPC_URL }}
EOF

cat << EOF > fuel_core.env
FORKING=true
EOF
working-directory: docker/envs
- name: Run integration tests on a L1 fork after upgrading contracts
run: |
pnpm run test:fork
3 changes: 2 additions & 1 deletion docker/envs/fuel_core.env
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
RUST_BACKTRACE=1
CONSENSUS_KEY_SECRET="0xa449b1ffee0e2205fa924c6740cc48b3b473aa28587df6dab12abc245d1f5298"
# Uncommend to use the variables by removing #
# FUEL_IP=
# FUEL_PORT=
# set true when running integration tests over forked environment
FORKING=false
2 changes: 2 additions & 0 deletions docker/envs/l1_chain.env
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
# L1_PORT=
# SERVE_PORT=
DEPLOYER_KEY=0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d
# set tenderly rpc for spinning up forked network
TENDERLY_RPC_URL=
3 changes: 2 additions & 1 deletion docker/fuel-core/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ FROM ghcr.io/fuellabs/fuel-core:v0.40.0

ARG FUEL_IP=0.0.0.0
ARG FUEL_PORT=4001
ARG CONSENSUS_KEY_SECRET=""
# since we need to set the FORKING var in the upgrade-test-suite ci so setting it here
ARG CONSENSUS_KEY_SECRET="0xa449b1ffee0e2205fa924c6740cc48b3b473aa28587df6dab12abc245d1f5298"

# dependencies
ENV DEBIAN_FRONTEND=noninteractive
Expand Down
51 changes: 36 additions & 15 deletions docker/fuel-core/fuel_core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,40 @@ export FUEL_MESSAGE_PORTAL_CONTRACT_ADDRESS=$(cat "./addresses.json" | jq -r .Fu
echo "FUEL_MESSAGE_PORTAL_CONTRACT_ADDRESS: $FUEL_MESSAGE_PORTAL_CONTRACT_ADDRESS"
echo "L1_CHAIN_HTTP: $L1_CHAIN_HTTP"

export FORKING=${FORKING}

# start the Fuel client
echo "Starting fuel node."
exec /root/fuel-core run \
--ip $FUEL_IP \
--port $FUEL_PORT \
--utxo-validation \
--vm-backtrace \
--enable-relayer \
--relayer $L1_CHAIN_HTTP \
--relayer-v2-listening-contracts $FUEL_MESSAGE_PORTAL_CONTRACT_ADDRESS \
--poa-interval-period 1sec \
--debug \
--da-compression $DA_COMPRESSION \
--graphql-max-complexity $GRAPHQL_COMPLEXITY \
--min-gas-price 0 \
--snapshot ./
if [ "$FORKING" = "true" ]; then
echo "FORKING is enabled. Running with da deploy height"
exec /root/fuel-core run \
--ip $FUEL_IP \
--port $FUEL_PORT \
--utxo-validation \
--vm-backtrace \
--enable-relayer \
--relayer $L1_CHAIN_HTTP \
--relayer-v2-listening-contracts $FUEL_MESSAGE_PORTAL_CONTRACT_ADDRESS \
--poa-interval-period 1sec \
--relayer-da-deploy-height=21371952 \
--debug \
--da-compression $DA_COMPRESSION \
--graphql-max-complexity $GRAPHQL_COMPLEXITY \
--min-gas-price 0 \
--snapshot ./
else
echo "FORKING is disabled. Running without da deploy height"
exec /root/fuel-core run \
--ip $FUEL_IP \
--port $FUEL_PORT \
--utxo-validation \
--vm-backtrace \
--enable-relayer \
--relayer $L1_CHAIN_HTTP \
--relayer-v2-listening-contracts $FUEL_MESSAGE_PORTAL_CONTRACT_ADDRESS \
--poa-interval-period 1sec \
--debug \
--da-compression $DA_COMPRESSION \
--graphql-max-complexity $GRAPHQL_COMPLEXITY \
--min-gas-price 0 \
--snapshot ./
fi
8 changes: 2 additions & 6 deletions docker/l1-chain/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ RUN npm i -g pnpm

# clone the contracts repo
ADD ./packages/solidity-contracts/package.json /l1chain/fuel-v2-contracts/

# copy over the fuel chain and replace consts values
WORKDIR /l1chain/fuel-v2-contracts

Expand All @@ -27,16 +28,11 @@ RUN pnpm compile
ADD ./docker/l1-chain/.fuelChainConsts.env /l1chain/fuel-v2-contracts/.fuelChainConsts.env
ADD ./packages/solidity-contracts/contracts /l1chain/fuel-v2-contracts/contracts
ADD ./packages/solidity-contracts/deploy /l1chain/fuel-v2-contracts/deploy
ADD ./packages/solidity-contracts/deployments/ /l1chain/fuel-v2-contracts/deployments/
ADD ./packages/solidity-contracts/protocol /l1chain/fuel-v2-contracts/protocol


# remove build dependencies
# RUN pnpm prune --prod
RUN pnpm compile

# Create deployments dir
RUN mkdir deployments

# expose node and server port
ENV L1_IP="${L1_IP}"
ENV L1_PORT="${L1_PORT}"
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
"node:clean": "make -C ./docker clean",
"node:logs": "make -C ./docker logs",
"test": "sh ./scripts/test.sh",
"test:fork": "sh ./scripts/test-fork.sh",
"test:integration": "DEBUG=true pnpm --filter @fuel-bridge/integration-tests test",
"test:integration:fork": "DEBUG=true pnpm --filter @fuel-bridge/integration-tests test-fork",
"lint:check": "eslint . --ext .ts,.js",
"lint:fix": "pnpm lint:check --fix",
"prettier:check": "prettier --check .",
Expand Down
3 changes: 1 addition & 2 deletions packages/fungible-token/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
},
"devDependencies": {
"fuels": "0.96.1",
"@fuel-bridge/esbuild-bin-loader": "workspace:../esbuild-bin-loader",
"@fuel-bridge/solidity-contracts": "workspace:*"
"@fuel-bridge/esbuild-bin-loader": "workspace:../esbuild-bin-loader"
}
}
Loading
Loading