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 manual CI to simulate upgrades with tenderly #345

Closed
wants to merge 41 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
db102c4
feat: add script for simulating upgrades
viraj124 Oct 18, 2024
484052d
chore: add try/catch
viraj124 Oct 18, 2024
075af21
chore: add task args
viraj124 Oct 18, 2024
7c65435
chore: upddate comment
viraj124 Oct 18, 2024
30c3f1b
chore: minor touchup
viraj124 Oct 18, 2024
631081a
chore: reduce the manaual arguments
viraj124 Oct 21, 2024
15d727a
feat: add manual ci
viraj124 Oct 21, 2024
74d79e5
chore: add changeset
viraj124 Oct 21, 2024
5abd078
Merge branch 'main' into viraj124/206-add-simulation-for-upgrades
viraj124 Oct 21, 2024
afdeb0c
chore: resolve merge conflicts
viraj124 Oct 24, 2024
d212d7b
chore: use env vars in the script
viraj124 Oct 25, 2024
5268d89
chore: use env vars in the ci
viraj124 Oct 25, 2024
0bb1072
Merge branch 'main' into viraj124/206-add-simulation-for-upgrades
viraj124 Oct 25, 2024
48d8d00
chore: setup tenderly fork config
viraj124 Oct 29, 2024
d1133a6
chore: remove unused file
viraj124 Nov 1, 2024
f8c10e1
chore: add script for docker setup for integration tests
viraj124 Nov 1, 2024
5c851b0
chore: add placeholder contract
viraj124 Nov 1, 2024
20332d2
chore: add fork config in hardhat config
viraj124 Nov 1, 2024
dcf704a
feat: add docker setup for tenderly fork test suite
viraj124 Nov 1, 2024
b7a7df2
fix: deployed artifact path
Nov 2, 2024
7be93d2
Merge branch 'main' into viraj124/206-add-simulation-for-upgrades
viraj124 Nov 2, 2024
6f233f1
chore: docker config changes
viraj124 Nov 11, 2024
c50030a
chore: debug block committer integration issue
viraj124 Nov 20, 2024
a1f3583
chore: inject state contract address dynamically
viraj124 Nov 20, 2024
0c4ae58
chore: update fuel core version in e2e docker file
viraj124 Nov 22, 2024
7e23059
chore: update graphql endpoint
viraj124 Nov 22, 2024
9a3fe72
debug: fuel core issue
viraj124 Nov 22, 2024
6d60c8f
chore: update committer account
viraj124 Nov 26, 2024
1ea8cfe
fix: fuel core docker setup
viraj124 Nov 26, 2024
5ade961
fix: fuel core docker setup
viraj124 Nov 26, 2024
cc59923
fix: fuel core docker setup
viraj124 Nov 26, 2024
9007746
chore: add changeset
viraj124 Nov 26, 2024
f7cdbbf
chore: minor touchups
viraj124 Nov 26, 2024
f5d5574
Merge branch 'viraj124/363-update-block-committer-docker-setup' into …
viraj124 Nov 26, 2024
b089b32
feat: update docker setup
viraj124 Nov 26, 2024
52dcec4
chore: formatting
viraj124 Nov 26, 2024
d988994
fix: audit ci
viraj124 Nov 29, 2024
c7400ca
chore: update package.json
viraj124 Nov 29, 2024
f3e6e0c
chore: upgrade changeset cli version
viraj124 Nov 29, 2024
e9ff880
chore: fetch all remote branches in ci
viraj124 Nov 29, 2024
99be075
chore: add mocha for test suite
viraj124 Nov 29, 2024
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/silent-apples-smile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@fuel-bridge/solidity-contracts': minor
---

add manual CI to simulate upgrades with tenderly
6 changes: 6 additions & 0 deletions .changeset/slow-bottles-bathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@fuel-bridge/solidity-contracts': patch
'@fuel-bridge/test-utils': patch
---

upgrade docker setup for fuel core and block committer
35 changes: 35 additions & 0 deletions .github/workflows/manual-simulate-upgrade.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Manual Simulate Upgrade

on:
workflow_dispatch:
inputs:
vnetId:
description: 'Enter the tenderly virtual testnet id'
required: true
type: string
accessKey:
description: 'Enter the tenderly account access key'
required: true
type: string
rpc:
description: 'Enter tenderly virtual network rpc'
required: true
type: string

jobs:
simulate-upgrades:
runs-on: ubuntu-latest
env:
RPC_URL: ${{ github.event.inputs.rpc }}
VNET_ID: ${{ github.event.inputs.vnetId }}
ACCESS_KEY: ${{ github.event.inputs.accessKey }}
steps:
- uses: actions/checkout@v3
- uses: FuelLabs/github-actions/setups/node@master
with:
node-version: 20.16.0
pnpm-version: 9.0.6
- name: Simulate Upgrades
run: |
npx hardhat compile && npx hardhat simulate-upgrades --network mainnet
working-directory: ./packages/solidity-contracts
6 changes: 6 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,16 @@ jobs:
with:
# need this to get full git-history/clone in order to build changelogs and check changesets
fetch-depth: 0
fetch-tags: true
- uses: FuelLabs/github-actions/setups/node@master
with:
node-version: 20.16.0
pnpm-version: 9.0.6
- name: Fetch and verify remote branches
run: |
git fetch origin main:main
git branch -vv
git remote -v
- run: pnpm changeset:check

validate:
Expand Down
16 changes: 3 additions & 13 deletions docker/block-committer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
FROM ghcr.io/fuellabs/fuel-block-committer:v0.4.0
FROM ghcr.io/fuellabs/fuel-block-committer:sha-77607e4

ARG ETHEREUM_WALLET_KEY=""
ARG COMMIT_INTERVAL=1
ARG COMMITER_IP=0.0.0.0
ARG COMMITER_PORT=8888
ARG ETHEREUM_CHAIN="hardhat"
ARG ETHEREUM_RPC=""
ARG FUEL_GRAPHQL_ENDPOINT=""

# dependencies
ENV DEBIAN_FRONTEND=noninteractive
Expand All @@ -16,15 +11,10 @@ RUN apt update && apt install -y curl jq && rm -rf /var/lib/apt/lists/*
WORKDIR /block-committer

# expose fuel node port
ENV ETHEREUM_WALLET_KEY="${ETHEREUM_WALLET_KEY}"
ENV COMMIT_INTERVAL="${COMMIT_INTERVAL}"
ENV HOST="${COMMITER_IP}"
ENV PORT="${COMMITER_PORT}"
ENV ETHEREUM_CHAIN="${ETHEREUM_CHAIN}"
ENV ETHEREUM_RPC="${ETHEREUM_RPC}"
ENV FUEL_GRAPHQL_ENDPOINT="${FUEL_GRAPHQL_ENDPOINT}"

EXPOSE ${PORT}

# copy over script and run
COPY ./block-commiter.sh .
CMD ["sh", "./block-commiter.sh"]
ENTRYPOINT ["sh", "./block-commiter.sh"]
17 changes: 9 additions & 8 deletions docker/block-committer/block-commiter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ set -euo
RETRIES=${RETRIES:-60}
DELAY=${DELAY:-10}
JSON='{"jsonrpc":"2.0","id":0,"method":"net_version","params":[]}'
HEALTH_URL=${HEALTH_URL:-"http://fuel_core:4001/v1/health"}

if [ -z "$ETHEREUM_RPC" ]; then
if [ -z "$COMMITTER__ETH__RPC" ]; then
echo "Must specify \$ETHEREUM_RPC."
exit 1
fi
if [ -z "$FUEL_GRAPHQL_ENDPOINT" ]; then
if [ -z "$COMMITTER__FUEL__GRAPHQL_ENDPOINT" ]; then
echo "Must specify \$FUEL_GRAPHQL_ENDPOINT."
exit 1
fi
Expand All @@ -18,7 +19,7 @@ if [ -z "$DEPLOYMENTS_HTTP" ]; then
exit 1
fi

echo $FUEL_GRAPHQL_ENDPOINT/health
echo $COMMITTER__FUEL__GRAPHQL_ENDPOINT/health

# wait for the base layer to be up
echo "Waiting for Fuel Core chain."
Expand All @@ -29,7 +30,7 @@ curl \
--retry-connrefused \
--retry $RETRIES \
--retry-delay $DELAY \
$FUEL_GRAPHQL_ENDPOINT/health > /dev/null
$HEALTH_URL > /dev/null
echo "Connected to Fuel Core chain."

# get the deployments file from the deployer
Expand All @@ -47,10 +48,10 @@ curl \
echo "Got l1 chain deployment data."

# pull data from deployer dump
export STATE_CONTRACT_ADDRESS=$(cat "./addresses.json" | jq -r .FuelChainState)
echo "STATE_CONTRACT_ADDRESS: $STATE_CONTRACT_ADDRESS"
echo "ETHEREUM_RPC: $ETHEREUM_RPC"
echo "FUEL_GRAPHQL_ENDPOINT: $FUEL_GRAPHQL_ENDPOINT"
export COMMITTER__ETH__STATE_CONTRACT_ADDRESS=$(cat "./addresses.json" | jq -r .FuelChainState)
echo "COMMITTER__ETH__STATE_CONTRACT_ADDRESS: $COMMITTER__ETH__STATE_CONTRACT_ADDRESS"
echo "ETHEREUM_RPC: $COMMITTER__ETH__RPC"
echo "FUEL_GRAPHQL_ENDPOINT: $COMMITTER__FUEL__GRAPHQL_ENDPOINT"

# start the Block Commiter
echo "Starting block commiter"
Expand Down
60 changes: 51 additions & 9 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
version: '3.4'

services:
db:
image: postgres:14
environment:
POSTGRES_USER: username
POSTGRES_PASSWORD: password
POSTGRES_DB: committer_db
healthcheck:
test: ['CMD-SHELL', 'pg_isready -U username -d committer_db']
interval: 5s
timeout: 5s
retries: 5

l1_chain:
image: fueldev/l1chain:${DOCKER_TAG_L1_CHAIN:-latest}
build:
dockerfile: ./docker/l1-chain/Dockerfile
# Use build context of the root directory
# to allow coping solidity-contracts on Dockerfile
# to allow copying solidity-contracts on Dockerfile
context: ../
env_file:
- ./envs/l1_chain.env
Expand All @@ -30,25 +42,55 @@ services:
DEPLOYMENTS_HTTP: http://l1_chain:8081/deployments.local.json
RUST_LOG: debug
DEBUG: true
DB_PATH: /db
ports:
# expose the service to the host for integration testing
- ${FUEL_CORE_HTTP_PORT:-4000}:4001
stop_grace_period: 1s

fuel_block_commiter:
depends_on:
- fuel_core
image: fueldev/block-committer:${DOCKER_TAG_FUEL_CORE:-latest}
image: ghcr.io/fuellabs/fuel-block-committer:sha-77607e4
platform: linux/amd64
build:
context: ./block-committer/
env_file:
- ./envs/block_committer.env
environment:
ETHEREUM_RPC: ws://l1_chain:9545/
FUEL_GRAPHQL_ENDPOINT: http://fuel_core:4001/v1
COMMITTER__ETH__RPC: 'ws://l1_chain:9545/'
COMMITTER__ETH__L1_KEYS__MAIN: 'Private(8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba)'
COMMITTER__ETH__L1_KEYS__BLOB: 'Private(59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d)'
COMMITTER__FUEL__GRAPHQL_ENDPOINT: 'http://fuel_core:4001/graphql'
COMMITTER__FUEL__NUM_BUFFERED_REQUESTS: '5'
COMMITTER__APP__DB__PORT: '5432'
COMMITTER__APP__DB__HOST: 'db'
COMMITTER__APP__DB__USERNAME: 'username'
COMMITTER__APP__DB__PASSWORD: 'password'
COMMITTER__APP__DB__MAX_CONNECTIONS: '10'
COMMITTER__APP__DB__USE_SSL: 'false'
COMMITTER__APP__DB__DATABASE: 'committer_db'
COMMITTER__APP__PORT: '8080'
COMMITTER__APP__HOST: '0.0.0.0'
COMMITTER__APP__BLOCK_CHECK_INTERVAL: '5s'
COMMITTER__APP__TX_FINALIZATION_CHECK_INTERVAL: '5s'
COMMITTER__APP__NUM_BLOCKS_TO_FINALIZE_TX: '3'
COMMITTER__APP__GAS_BUMP_TIMEOUT: '300s'
COMMITTER__APP__TX_MAX_FEE: '4000000000000000'
COMMITTER__APP__SEND_TX_REQUEST_TIMEOUT: '10s'
COMMITTER__APP__BUNDLE__ACCUMULATION_TIMEOUT: '3600s'
COMMITTER__APP__BUNDLE__BLOCKS_TO_ACCUMULATE: '400'
COMMITTER__APP__BUNDLE__OPTIMIZATION_TIMEOUT: '60s'
COMMITTER__APP__BUNDLE__BLOCK_HEIGHT_LOOKBACK: '8500'
COMMITTER__APP__BUNDLE__COMPRESSION_LEVEL: 'level6'
COMMITTER__APP__BUNDLE__OPTIMIZATION_STEP: '100'
COMMITTER__APP__BUNDLE__FRAGMENTS_TO_ACCUMULATE: '3'
COMMITTER__APP__BUNDLE__FRAGMENT_ACCUMULATION_TIMEOUT: '10m'
COMMITTER__APP__BUNDLE__NEW_BUNDLE_CHECK_INTERVAL: '3s'
DEPLOYMENTS_HTTP: http://l1_chain:8081/deployments.local.json
ports:
# expose the service to the host for integration testing
- ${COMMITTER_HTTP_PORT:-8888}:8888
stop_grace_period: 1s
depends_on:
db:
condition: service_healthy
l1_chain:
condition: service_started
fuel_core:
condition: service_started
8 changes: 4 additions & 4 deletions docker/fuel-core/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# https://github.com/FuelLabs/chain-configuration/tree/master/upgradelog/ignition-testnet
# and apply the latest state_transition_function and consensus_parameter
# when upgrading fuel-core
FROM ghcr.io/fuellabs/fuel-core:v0.36.0
FROM ghcr.io/fuellabs/fuel-core:v0.40.0

ARG FUEL_IP=0.0.0.0
ARG FUEL_PORT=4001
Expand All @@ -23,15 +23,15 @@ RUN git clone \
/chain-configuration

# Anchor the chain configuration to a specific commit to avoid CI breaking
RUN cd /chain-configuration && git checkout c1c4d3bca57f64118a8d157310e0a839ae5c180a
RUN cd /chain-configuration && git checkout 8e4f7b52d7112f929a7cd95b988dfebfd10e87ec

# Copy the base local configuration
RUN cp -R /chain-configuration/local/* ./

# Copy the devnet consensus parameters and state transition bytecode
RUN cp /chain-configuration/upgradelog/ignition-devnet/consensus_parameters/9.json \
RUN cp /chain-configuration/upgradelog/ignition-devnet/consensus_parameters/14.json \
./latest_consensus_parameters.json
RUN cp /chain-configuration/upgradelog/ignition-devnet/state_transition_function/9.wasm \
RUN cp /chain-configuration/upgradelog/ignition-devnet/state_transition_function/16.wasm \
./state_transition_bytecode.wasm

# update local state_config with custom genesis coins config
Expand Down
7 changes: 5 additions & 2 deletions docker/fuel-core/fuel_core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
set -euo

RETRIES=${RETRIES:-90}
DA_COMPRESSION=${DA_COMPRESSION:-"3600sec"}
GRAPHQL_COMPLEXITY=${GRAPHQL_COMPLEXITY:-500000}
JSON='{"jsonrpc":"2.0","id":0,"method":"net_version","params":[]}'
FUEL_DB_PATH=./mnt/db/
# FUEL_DB_PATH=./mnt/db/

if [ -z "$L1_CHAIN_HTTP" ]; then
echo "Must specify \$L1_CHAIN_HTTP."
Expand Down Expand Up @@ -53,13 +55,14 @@ echo "Starting fuel node."
exec /root/fuel-core run \
--ip $FUEL_IP \
--port $FUEL_PORT \
--db-type in-memory \
--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 ./
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@
"@fuels/eslint-plugin": "0.20.0",
"@fuels/prettier-config": "0.0.10",
"@fuels/ts-config": "0.0.10",
"fuels": "0.96.1",
"eslint": "^8.49.0",
"fuels": "0.96.1",
"prettier": "^2.7.1",
"tsup": "^8.3.0",
"tsx": "^3.12.7",
"turbo": "^1.10.7"
},
"devDependencies": {
"@changesets/cli": "^2.26.2",
"@changesets/cli": "^2.27.10",
"@fuel-ts/forc": "0.73.0"
},
"pnpm": {
Expand All @@ -52,7 +52,8 @@
"elliptic@>=4.0.0 <=6.5.6": ">=6.5.7",
"elliptic@>=2.0.0 <=6.5.6": ">=6.5.7",
"elliptic@>=5.2.1 <=6.5.6": ">=6.5.7",
"micromatch@<4.0.8": ">=4.0.8"
"micromatch@<4.0.8": ">=4.0.8",
"cross-spawn@>=7.0.0 <7.0.5": ">=7.0.5"
}
}
}
6 changes: 6 additions & 0 deletions packages/solidity-contracts/contracts/test/PlaceHolder.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

/// @dev The only purpose of this contract is to be copied during the Dockerfile build
/// so that hardhat downloads the compiler and it gets cached
contract PlaceHolder {}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { DeployFunction } from 'hardhat-deploy/dist/types';

import { FuelChainState__factory } from '../../typechain';

const COMMITTER_ADDRESS = '0x70997970C51812dc3A010C7d01b50e0d17dc79C8';
const COMMITTER_ADDRESS = '0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc';

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { ethers, deployments } = hre;
Expand Down
22 changes: 22 additions & 0 deletions packages/solidity-contracts/docker/block-committer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM ghcr.io/fuellabs/fuel-block-committer:sha-77607e4

ARG COMMITER_IP=0.0.0.0
ARG COMMITER_PORT=8888

# dependencies
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update && apt install -y curl jq && rm -rf /var/lib/apt/lists/*

# copy chain config
WORKDIR /block-committer

# expose fuel node port
ENV HOST="${COMMITER_IP}"
ENV PORT="${COMMITER_PORT}"

EXPOSE ${PORT}

# copy over script and run
COPY ./block-committer.sh .
CMD ["sh", "./block-committer.sh"]
# ENTRYPOINT ["sh", "./block-committer.sh"]
Loading
Loading