From b8ee6145e9173d796aa0e609354bf5e982818097 Mon Sep 17 00:00:00 2001 From: Himanshu Nagda <69150921+nagdahimanshu@users.noreply.github.com> Date: Wed, 10 Jul 2024 15:38:17 +0200 Subject: [PATCH] Upgrade for fjord activation (#12) * Upgrade for fjord activation * :ok_hand: Applied suggestions * :ok_hand: Applied suggestions * Add TODO * :whale: Update reth dockerfile * :ok_hand: Applied suggestions * :bug: Fix fork-sync workflow * Update readme --- .env.mainnet | 1 + .env.sepolia | 1 + .github/workflows/fork-sync.yml | 2 +- README.md | 64 ++++++++++++--------------------- geth/geth-entrypoint | 7 ++++ op-node-entrypoint | 19 ++++++++-- reth/Dockerfile | 10 +++--- reth/reth-entrypoint | 1 + 8 files changed, 54 insertions(+), 51 deletions(-) diff --git a/.env.mainnet b/.env.mainnet index 66e82da..d987e74 100644 --- a/.env.mainnet +++ b/.env.mainnet @@ -1,6 +1,7 @@ GENESIS_FILE_PATH=mainnet/genesis.json SEQUENCER_HTTP=https://rpc.api.lisk.com RETH_CHAIN=lisk +OVERRIDE_FJORD=1720627201 # [optional] used to enable geth stats: # OP_GETH_ETH_STATS=nodename:secret@host:port diff --git a/.env.sepolia b/.env.sepolia index 226f159..be42beb 100644 --- a/.env.sepolia +++ b/.env.sepolia @@ -2,6 +2,7 @@ GENESIS_FILE_PATH=sepolia/genesis.json SEQUENCER_HTTP=https://rpc.sepolia-api.lisk.com OP_NODE_OVERRIDE_CANYON=0 RETH_CHAIN=lisk-sepolia +OVERRIDE_FJORD=1716998400 # [optional] used to enable geth stats: # OP_GETH_ETH_STATS=nodename:secret@host:port diff --git a/.github/workflows/fork-sync.yml b/.github/workflows/fork-sync.yml index bb0dddc..e0aef1d 100644 --- a/.github/workflows/fork-sync.yml +++ b/.github/workflows/fork-sync.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: tgymnich/fork-sync + - uses: tgymnich/fork-sync@v2.0.10 with: owner: base-org repo: node diff --git a/README.md b/README.md index 2d03045..df185c0 100644 --- a/README.md +++ b/README.md @@ -45,20 +45,21 @@ cd lisk-node ### Docker 1. Ensure you have an Ethereum L1 full node RPC available (not Lisk), and set the `OP_NODE_L1_ETH_RPC` and the `OP_NODE_L1_BEACON` variables (within the `.env.*` files, if using docker-compose). If running your own L1 node, it needs to be synced before the Lisk node will be able to fully sync. + 2. Please ensure that the environment file relevant to your network (`.env.sepolia`, or `.env.mainnet`) is set for the `env_file` properties within `docker-compose.yml`. By default, it is set to `.env.mainnet`. -3. We currently support running either the `op-geth` or the `op-reth` nodes alongside the `op-node`. By default, we run the `op-geth` node. If you would like to run the `op-reth` node instead, please set the `CLIENT` environment variable to `reth` before starting the node. -4. Run: -``` -docker compose up --build --detach -``` +3. We currently support running either the `op-geth` or the `op-reth` nodes alongside the `op-node`. By default, we run the `op-geth` node. If you would like to run the `op-reth` node instead, please set the `CLIENT` environment variable to `reth` before starting the node. -4. You should now be able to `curl` your Lisk node: +4. Run: + ```sh + docker compose up --build --detach + ``` -``` -curl -s -d '{"id":0,"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["latest",false]}' \ - -H "Content-Type: application/json" http://localhost:8545 -``` +5. You should now be able to `curl` your Lisk node: + ```sh + curl -s -d '{"id":0,"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["latest",false]}' \ + -H "Content-Type: application/json" http://localhost:8545 + ``` ### Source @@ -136,7 +137,8 @@ For, Lisk Sepolia Testnet: --rollup.halt=major \ --port=30303 \ --rollup.disabletxpoolgossip=true \ - --override.canyon=0 + --override.canyon=0 \ + --override.fjord=1716998400 ``` For, Lisk Mainnet: @@ -170,42 +172,18 @@ For, Lisk Mainnet: --rollup.sequencerhttp=SEQUENCER_HTTP \ --rollup.halt=major \ --port=30303 \ - --rollup.disabletxpoolgossip=true + --rollup.disabletxpoolgossip=true \ + --override.fjord=1720627201 ``` Refer to the `op-geth` configuration [documentation](https://docs.optimism.io/builders/node-operators/management/configuration#op-geth) for detailed information about available options. #### Run op-reth -Navigate to your `reth` directory and start service by running the command: - -For, Lisk Sepolia Testnet: +> **Note**: +>
Currently we do not support running the reth client on the Lisk Sepolia Testnet. -```sh -./target/release/op-reth node \ - -vvv \ - --datadir="$DATADIR_PATH" \ - --log.stdout.format log-fmt \ - --ws \ - --ws.origins="*" \ - --ws.addr=0.0.0.0 \ - --ws.port=8546 \ - --ws.api=debug,eth,net,txpool \ - --http \ - --http.corsdomain="*" \ - --http.addr=0.0.0.0 \ - --http.port=8545 \ - --http.api=debug,eth,net,txpool \ - --authrpc.addr=0.0.0.0 \ - --authrpc.port=8551 \ - --authrpc.jwtsecret=PATH_TO_JWT_TEXT_FILE \ - --metrics=0.0.0.0:6060 \ - --chain=PATH_TO_NETWORK_GENESIS_FILE \ - --disable-discovery \ - --rollup.sequencer-http=SEQUENCER_HTTP \ - --rollup.disable-tx-pool-gossip \ - --override.canyon=0 -``` +Navigate to your `reth` directory and start service by running the command: For, Lisk Mainnet: @@ -260,7 +238,8 @@ For, Lisk Sepolia Testnet: --l1.beacon=$OP_NODE_L1_BEACON \ --l2=ws://localhost:8551 \ --l2.jwt-secret=PATH_TO_JWT_TEXT_FILE \ - --rollup.config=PATH_TO_NETWORK_ROLLUP_FILE + --rollup.config=PATH_TO_NETWORK_ROLLUP_FILE \ + --override.fjord=1716998400 ``` For, Lisk Mainnet: @@ -272,7 +251,8 @@ For, Lisk Mainnet: --l1.beacon=$OP_NODE_L1_BEACON \ --l2=ws://localhost:8551 \ --l2.jwt-secret=PATH_TO_JWT_TEXT_FILE \ - --rollup.config=PATH_TO_NETWORK_ROLLUP_FILE + --rollup.config=PATH_TO_NETWORK_ROLLUP_FILE \ + --override.fjord=1720627201 ``` The above command starts `op-node` in **full sync** mode. Depending on the chain length, the initial sync process could take significant time; varying from days to weeks. diff --git a/geth/geth-entrypoint b/geth/geth-entrypoint index ffadb47..9f956b9 100755 --- a/geth/geth-entrypoint +++ b/geth/geth-entrypoint @@ -13,11 +13,17 @@ ADDITIONAL_ARGS="" OP_GETH_GCMODE="${OP_GETH_GCMODE:-full}" OP_GETH_SYNCMODE="${OP_GETH_SYNCMODE:-full}" +# TODO: Enable this check once Lisk configs are added to the superchain registry repo # if [[ -z "$OP_NODE_NETWORK" ]]; then # echo "expected OP_NODE_NETWORK to be set" 1>&2 # exit 1 # fi +if [[ -z "$OVERRIDE_FJORD" ]]; then + echo "expected OVERRIDE_FJORD to be set" 1>&2 + exit 2 +fi + mkdir -p $GETH_DATA_DIR echo "$OP_NODE_L2_ENGINE_AUTH_RAW" > "$OP_NODE_L2_ENGINE_AUTH" @@ -79,4 +85,5 @@ fi # --op-network="$OP_NODE_NETWORK" \ --port="$P2P_PORT" \ --rollup.disabletxpoolgossip=true \ + --override.fjord=$OVERRIDE_FJORD \ $ADDITIONAL_ARGS # intentionally unquoted diff --git a/op-node-entrypoint b/op-node-entrypoint index 13ac63a..ffd88f5 100755 --- a/op-node-entrypoint +++ b/op-node-entrypoint @@ -1,6 +1,8 @@ #!/bin/bash set -eu +ADDITIONAL_ARGS="" + get_public_ip() { # Define a list of HTTP-based providers local PROVIDERS=( @@ -22,11 +24,22 @@ get_public_ip() { return 1 } -# if [[ -z "$OP_NODE_NETWORK" && -z "$OP_NODE_ROLLUP_CONFIG" ]]; then +# TODO: Enable this check once Lisk configs are added to the superchain registry repo +# if [[ -z "$OP_NODE_NETWORK" ]]; then # echo "expected OP_NODE_NETWORK to be set" 1>&2 # exit 1 # fi +if [[ -z "$OVERRIDE_FJORD" ]]; then + echo "expected OVERRIDE_FJORD to be set" 1>&2 + exit 2 +fi + +if [[ -z "$OP_NODE_ROLLUP_CONFIG" ]]; then + echo "expected OP_NODE_ROLLUP_CONFIG to be set" 1>&2 + exit 3 +fi + # wait until the local execution client comes up (authed so will return 401 without token) until [ "$(curl -s -w '%{http_code}' -o /dev/null "${OP_NODE_L2_ENGINE_RPC/ws/http}")" -eq 401 ]; do echo "waiting for the execution client to be ready" @@ -48,4 +61,6 @@ exec ./op-node \ --l1=$OP_NODE_L1_ETH_RPC \ --l1.beacon=$OP_NODE_L1_BEACON \ --l2.jwt-secret=$OP_NODE_L2_ENGINE_AUTH \ - --rollup.config=$OP_NODE_ROLLUP_CONFIG + --rollup.config=$OP_NODE_ROLLUP_CONFIG \ + --override.fjord=$OVERRIDE_FJORD \ + $ADDITIONAL_ARGS diff --git a/reth/Dockerfile b/reth/Dockerfile index 5083f12..0d30e69 100644 --- a/reth/Dockerfile +++ b/reth/Dockerfile @@ -20,12 +20,10 @@ WORKDIR /app RUN apt-get update && apt-get -y upgrade && apt-get install -y git libclang-dev pkg-config curl build-essential -ENV REPO=https://github.com/paradigmxyz/reth.git -ENV VERSION=v1.0.0 -ENV COMMIT=83d412da70af678a46f368533b6df45a287a1ce6 -RUN git clone $REPO --branch $VERSION --single-branch . && \ - git switch -c branch-$VERSION && \ - bash -c '[ "$(git rev-parse HEAD)" = "$COMMIT" ]' +#TODO: Revert to upstream, once https://github.com/paradigmxyz/reth/pull/9105 is merged. +ENV REPO=https://github.com/danyalprout/reth.git +ENV COMMIT=c79cbf4a918480556bd37204942a2d69827fed9f +RUN git clone $REPO . && git checkout $COMMIT RUN cargo build --bin op-reth --locked --features $FEATURES --profile release diff --git a/reth/reth-entrypoint b/reth/reth-entrypoint index e20da89..7a60bb3 100755 --- a/reth/reth-entrypoint +++ b/reth/reth-entrypoint @@ -6,6 +6,7 @@ RPC_PORT="${RPC_PORT:-8545}" WS_PORT="${WS_PORT:-8546}" AUTHRPC_PORT="${AUTHRPC_PORT:-8551}" METRICS_PORT="${METRICS_PORT:-6060}" +ADDITIONAL_ARGS="" if [[ -z "$RETH_CHAIN" ]]; then echo "expected RETH_CHAIN to be set" 1>&2