Skip to content

Commit

Permalink
chore: cherry picked commits from v1.0.1 (#374)
Browse files Browse the repository at this point in the history
cherry picked the following pr commits from `v1.0.1`
- #362
- #372
-  #373

---------

Co-authored-by: Mad <[email protected]>
  • Loading branch information
viraj124 and DefiCake authored Dec 11, 2024
1 parent 7baf040 commit c5ad558
Show file tree
Hide file tree
Showing 17 changed files with 526 additions and 56 deletions.
5 changes: 5 additions & 0 deletions .changeset/mighty-bears-taste.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@fuel-bridge/solidity-contracts': patch
---

Removed mainnet deposit caps
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
with:
# need this to get full git-history/clone in order to build changelogs and check changesets
fetch-depth: 0
- uses: FuelLabs/github-actions/setups/node@master
- uses: FuelLabs/github-actions/setups/node@ps/chore/enable-docs-with-snippets-inline # temporary fix to point to this branch instead of master, to avoid the changeset ci breaking due to the latest commit(https://github.com/FuelLabs/github-actions/commit/0c63b2f8b88ce896748ac4ec42a3b8e40daf8647)
with:
node-version: 20.16.0
pnpm-version: 9.0.6
Expand Down
17 changes: 4 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:v0.10.4

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,11 @@ 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"]
COPY ./block-committer.sh .
ENTRYPOINT ["sh", "./block-committer.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,11 +48,15 @@ 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)
export COMMITTER__APP__DB__USERNAME=${DB__USERNAME}
export COMMITTER__APP__DB__PASSWORD=${DB__PASSWORD}
export COMMITTER__ETH__L1_KEYS__MAIN=${COMMITTER__ETH__L1_KEYS__MAIN}
export COMMITTER__ETH__L1_KEYS__BLOB=${COMMITTER__ETH__L1_KEYS__BLOB}
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"
exec /root/fuel-block-committer
exec /root/fuel-block-committer
55 changes: 48 additions & 7 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,54 @@ 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:v0.10.4
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
# new block committer version env params
COMMITTER__ETH__RPC: 'ws://l1_chain:9545/'
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__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
6 changes: 5 additions & 1 deletion docker/envs/block_committer.env
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
ETHEREUM_WALLET_KEY=0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d
COMMIT_INTERVAL=30
DB__USERNAME=username
DB__PASSWORD=password
COMMITTER__ETH__L1_KEYS__MAIN=Private(8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba)
COMMITTER__ETH__L1_KEYS__BLOB=Private(59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d)
# HOST=
# PORT=
# ETHEREUM_CHAIN=
# ETHEREUM_CHAIN=
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
10 changes: 6 additions & 4 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}
# new fuel core version config params
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/

if [ -z "$L1_CHAIN_HTTP" ]; then
echo "Must specify \$L1_CHAIN_HTTP."
Expand Down Expand Up @@ -48,18 +50,18 @@ echo "FUEL_MESSAGE_PORTAL_CONTRACT_ADDRESS: $FUEL_MESSAGE_PORTAL_CONTRACT_ADDRES
echo "L1_CHAIN_HTTP: $L1_CHAIN_HTTP"

# start the Fuel client
#--db-path ${FUEL_DB_PATH}
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 ./
--snapshot ./
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
Loading

0 comments on commit c5ad558

Please sign in to comment.