From 3990684b9838f4f5fc438e4fd23fb2cbdf451f2d Mon Sep 17 00:00:00 2001 From: Sameer Date: Sat, 23 Nov 2024 08:25:07 +0100 Subject: [PATCH] Update lisk node repository to use data from superchain registry (#48) * Use Superchain Registry data for Lisk network * :hammer: Configure node to pull configs from the superchain registry * :bug: Fix setup to run op-reth client * :hammer: Rename op-node patch file to be appropriate * :fire: Remove unnecessary rollup configs * :ok_hand: Apply review feedback --------- Co-authored-by: Matjaz Verbole --- .env.mainnet | 3 +- .env.sepolia | 3 +- .gitignore | 15 ++++++- README.md | 43 +++++++------------ dockerfile-lisk-sepolia.patch | 8 ++-- geth/Dockerfile | 10 ++--- geth/geth-entrypoint | 17 +++----- mainnet/genesis.json | 2 +- mainnet/rollup.json | 35 --------------- op-node-entrypoint | 14 ++---- ...hotfix.patch => op-node-lisk-sepolia.patch | 0 reth/Dockerfile | 8 ++-- reth/reth-entrypoint | 3 +- sepolia/genesis.json | 2 +- sepolia/rollup.json | 35 --------------- 15 files changed, 54 insertions(+), 144 deletions(-) delete mode 100644 mainnet/rollup.json rename op-node-lisk-hotfix.patch => op-node-lisk-sepolia.patch (100%) delete mode 100644 sepolia/rollup.json diff --git a/.env.mainnet b/.env.mainnet index 45dc816a..9fbd40d5 100644 --- a/.env.mainnet +++ b/.env.mainnet @@ -25,14 +25,13 @@ OP_NODE_LOG_LEVEL=info OP_NODE_METRICS_ADDR=0.0.0.0 OP_NODE_METRICS_ENABLED=true OP_NODE_METRICS_PORT=7300 -# OP_NODE_NETWORK=lisk-mainnet +OP_NODE_NETWORK=lisk-mainnet # OP_NODE_P2P_AGENT=lisk OP_NODE_P2P_BOOTNODES=enr:-Iu4QBCIUw0OhAq5ErARIYBLIr6xPb83OqeFRqlUJGlJ9kWpNECaumPArYWsEFdM_cEKm26JJT_EA52f4dlavBldldgBgmlkgnY0gmlwhCPqq5CJc2VjcDI1NmsxoQLBE74gZyIHkwBEnkI4K7nR4SM2Lytj2VTLqJaj5nQevoN0Y3CCIyuDdWRwgiMs OP_NODE_P2P_LISTEN_IP=0.0.0.0 OP_NODE_P2P_LISTEN_TCP_PORT=9222 OP_NODE_P2P_LISTEN_UDP_PORT=9222 OP_NODE_P2P_STATIC=/ip4/34.90.229.28/tcp/9003/p2p/16Uiu2HAmBuVpfZwoRodETmKQPiiE7awhs53vGaBzJCuZnSuU2zyb -OP_NODE_ROLLUP_CONFIG=mainnet/rollup.json OP_NODE_RPC_ADDR=0.0.0.0 OP_NODE_RPC_PORT=9545 OP_NODE_SNAPSHOT_LOG=/tmp/op-node-snapshot-log diff --git a/.env.sepolia b/.env.sepolia index d251b061..b3768380 100644 --- a/.env.sepolia +++ b/.env.sepolia @@ -25,14 +25,13 @@ OP_NODE_LOG_LEVEL=info OP_NODE_METRICS_ADDR=0.0.0.0 OP_NODE_METRICS_ENABLED=true OP_NODE_METRICS_PORT=7300 -# OP_NODE_NETWORK=lisk-sepolia +OP_NODE_NETWORK=lisk-sepolia # OP_NODE_P2P_AGENT=lisk OP_NODE_P2P_BOOTNODES=enr:-Iu4QI5BdaTmfMhNKXd-vSniNRSCXk-a3m3nQbe9TCV3puGtCr6FvX6-Vr0Uvx4tYVilGCIYdQNf6fK8O2MKxVqjYJ8BgmlkgnY0gmlwhCKN6PiJc2VjcDI1NmsxoQLBQIaRwlvNxrRKcGtxKmh4JS_orkawS44D4KIORICoi4N0Y3CCIyuDdWRwgiMr OP_NODE_P2P_LISTEN_IP=0.0.0.0 OP_NODE_P2P_LISTEN_TCP_PORT=9222 OP_NODE_P2P_LISTEN_UDP_PORT=9222 OP_NODE_P2P_STATIC=/ip4/34.34.122.138/tcp/9003/p2p/16Uiu2HAmS3JEmKYY3Wwift6FJKZxYDDnZtCjfryyeJBYT1DWH82T,/ip4/34.147.94.25/tcp/9003/p2p/16Uiu2HAmJBA5XJiHRnreCBDdt3KZusQXG7ECRYoLCBxTdokp236w,/ip4/34.34.117.160/tcp/9003/p2p/16Uiu2HAkythtCa4TQvDbKFCXY2ZxKDsPNBNbiXbapzb1EZYw717Q -OP_NODE_ROLLUP_CONFIG=sepolia/rollup.json OP_NODE_RPC_ADDR=0.0.0.0 OP_NODE_RPC_PORT=9545 OP_NODE_SNAPSHOT_LOG=/tmp/op-node-snapshot-log diff --git a/.gitignore b/.gitignore index b8be14d4..1f369b0c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,14 @@ +# Environment files +.env* +!.env +!.env.mainnet +!.env.sepolia + +# Data directories +/geth-data*/ +/reth-data*/ + +# Local files /.idea/ -/geth-data/ -/reth-data/ \ No newline at end of file +.DS_Store +scripts/ diff --git a/README.md b/README.md index f164a3da..fda00fe4 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,8 @@ We recommend you the following hardware configuration to run a Lisk L2 node: ## Usage > **Note**: -> - It is currently not possible to run the nodes with the `--op-network` flag. +> - It is now possible to run the Lisk nodes with the `--op-network` flag on the op-geth execution client. +> - It is still not possible to run the Lisk nodes with the `--chain` flag on the op-reth execution client. ### Clone the Repository @@ -81,9 +82,9 @@ cd lisk-node - [jq](https://jqlang.github.io/jq/) - To build `op-node` and `op-geth` from source, follow OP documentation on [Building a Node from Source](https://docs.optimism.io/builders/node-operators/tutorials/node-from-source). - - Before building the `op-node`, please patch the code with [`lisk-hotfix.patch`](./op-node-lisk-hotfix.patch) for an unhandled `SystemConfig` event emitted on Lisk Sepolia, resulting in errors on the Lisk nodes. + - Before building the `op-node`, please patch the code with [`op-node-lisk-sepolia.patch`](./op-node-lisk-sepolia.patch) for an unhandled `SystemConfig` event emitted on Lisk Sepolia, resulting in errors on the Lisk nodes. ```sh - git apply + git apply ``` - To build `op-reth` from source, follow the reth official [documentation](https://reth.rs/run/optimism.html#installing-op-reth). @@ -106,34 +107,15 @@ openssl rand -hex 32 > jwt.txt For more information refer to the OP [documentation](https://docs.optimism.io/builders/node-operators/tutorials/mainnet#create-a-jwt-secret). -#### Initialize op-geth - -> **Important**: If you already had your node running prior to the Fjord upgrade (Sepolia: May 29, 2024 & Mainnet: July 10, 2024), please make sure to re-initialize your data directory with the updated genesis block. This is automatically taken care of for the Docker users. - -Navigate to your `op-geth` directory and initialize the service by running the command: - -```sh -./build/bin/geth init --datadir=$DATADIR_PATH PATH_TO_NETWORK_GENESIS_FILE -``` - -> **Note**: -> - Alternatively, this initialization step can be skipped by specifying `--op-network=OP_NODE_NETWORK` flag in the start commands below. -> - This flag automatically fetches the necessary information from the [superchain-registry](https://github.com/ethereum-optimism/superchain-registry). - #### Run op-geth Navigate to your `op-geth` directory and start service by running the command: ```sh ./build/bin/geth \ + --op-network=$OP_NODE_NETWORK \ --datadir=$DATADIR_PATH \ --verbosity=3 \ - --http \ - --http.corsdomain="*" \ - --http.vhosts="*" \ - --http.addr=0.0.0.0 \ - --http.port=8545 \ - --http.api=web3,debug,eth,net,engine \ --authrpc.addr=0.0.0.0 \ --authrpc.port=8551 \ --authrpc.vhosts="*" \ @@ -143,18 +125,23 @@ Navigate to your `op-geth` directory and start service by running the command: --ws.port=8546 \ --ws.origins="*" \ --ws.api=debug,eth,net,engine \ + --http \ + --http.corsdomain="*" \ + --http.vhosts="*" \ + --http.addr=0.0.0.0 \ + --http.port=8545 \ + --http.api=web3,debug,eth,net,engine \ --metrics \ --metrics.addr=0.0.0.0 \ --metrics.port=6060 \ --syncmode=full \ --gcmode=full \ + --port=30303 \ --maxpeers=100 \ - --nat=extip:0.0.0.0 \ --rollup.sequencerhttp=SEQUENCER_HTTP \ --rollup.halt=major \ - --port=30303 \ --rollup.disabletxpoolgossip=true \ - --engine.experimental + --nat=extip:0.0.0.0 ``` Refer to the `op-geth` configuration [documentation](https://docs.optimism.io/builders/node-operators/management/configuration#op-geth) for detailed information about available options. @@ -202,12 +189,12 @@ Navigate to your `op-node` directory and start service by running the command: ```sh ./bin/op-node \ + --network="$OP_NODE_NETWORK" \ --l1=$OP_NODE_L1_ETH_RPC \ --l1.rpckind=$OP_NODE_L1_RPC_KIND \ --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 + --l2.jwt-secret=PATH_TO_JWT_TEXT_FILE ``` 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/dockerfile-lisk-sepolia.patch b/dockerfile-lisk-sepolia.patch index 581a80c8..b640d2f0 100644 --- a/dockerfile-lisk-sepolia.patch +++ b/dockerfile-lisk-sepolia.patch @@ -9,8 +9,8 @@ index 7316271..86e9a33 100644 -RUN cd op-node && \ +# Patch to handle the legacy ConfigUpdate event GAS_CONFIG_ECOTONE that shouldn't be used anymore +# Emitted only on Lisk Sepolia from the SystemConfig contract -+COPY op-node-lisk-hotfix.patch . -+RUN git apply op-node-lisk-hotfix.patch && \ ++COPY op-node-lisk-sepolia.patch . ++RUN git apply op-node-lisk-sepolia.patch && \ + cd op-node && \ make VERSION=$VERSION op-node @@ -26,8 +26,8 @@ index 0144140..bbb833f 100644 -RUN cd op-node && \ +# Patch to handle the legacy ConfigUpdate event GAS_CONFIG_ECOTONE that shouldn't be used anymore +# Emitted only on Lisk Sepolia from the SystemConfig contract -+COPY op-node-lisk-hotfix.patch . -+RUN git apply op-node-lisk-hotfix.patch && \ ++COPY op-node-lisk-sepolia.patch . ++RUN git apply op-node-lisk-sepolia.patch && \ + cd op-node && \ make VERSION=$VERSION op-node diff --git a/geth/Dockerfile b/geth/Dockerfile index 73162719..48af776d 100644 --- a/geth/Dockerfile +++ b/geth/Dockerfile @@ -3,8 +3,8 @@ FROM golang:1.22 AS op WORKDIR /app ENV REPO=https://github.com/ethereum-optimism/optimism.git -ENV VERSION=v1.9.5 -ENV COMMIT=5662448279e4fb16e073e00baeb6e458b12a59b2 +ENV VERSION=v1.10.0 +ENV COMMIT=910c9ade39c0bcdff5f2badd94efbe016a428e73 RUN git clone $REPO --branch op-node/$VERSION --single-branch . && \ git switch -c branch-$VERSION && \ bash -c '[ "$(git rev-parse HEAD)" = "$COMMIT" ]' @@ -17,8 +17,8 @@ FROM golang:1.22 AS geth WORKDIR /app ENV REPO=https://github.com/ethereum-optimism/op-geth.git -ENV VERSION=v1.101411.1 -ENV COMMIT=4539f2d3a77f14bdad362c24e3773dc6aad87d5b +ENV VERSION=v1.101411.2 +ENV COMMIT=3dd9b0274bae3d3d2c80ef517563a360108e8cf6 RUN git clone $REPO --branch $VERSION --single-branch . && \ git switch -c branch-$VERSION && \ bash -c '[ "$(git rev-parse HEAD)" = "$COMMIT" ]' @@ -40,7 +40,5 @@ COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf COPY geth/geth-entrypoint ./execution-entrypoint COPY geth/download-apply-snapshot.sh . COPY op-node-entrypoint . -COPY sepolia ./sepolia -COPY mainnet ./mainnet CMD ["/usr/bin/supervisord"] diff --git a/geth/geth-entrypoint b/geth/geth-entrypoint index d100816a..b0588d01 100755 --- a/geth/geth-entrypoint +++ b/geth/geth-entrypoint @@ -19,19 +19,14 @@ 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 "$OP_NODE_NETWORK" ]]; then + echo "expected OP_NODE_NETWORK to be set" 1>&2 + exit 1 +fi # Ensure data directory exists mkdir -p $GETH_DATA_DIR -# Init genesis -echoBanner "Initializing data directory under '${GETH_DATA_DIR}'" -./geth init --datadir=$GETH_DATA_DIR "$GENESIS_FILE_PATH" - # Download and apply snapshot, when configured (. download-apply-snapshot.sh) @@ -61,6 +56,7 @@ fi # Start service echoBanner "Starting op-geth execution node..." ./geth \ + --op-network="$OP_NODE_NETWORK" \ --datadir="$GETH_DATA_DIR" \ --verbosity="$VERBOSITY" \ --authrpc.addr=0.0.0.0 \ @@ -89,6 +85,3 @@ echoBanner "Starting op-geth execution node..." --rollup.halt=major \ --rollup.disabletxpoolgossip=true \ $ADDITIONAL_ARGS # intentionally unquoted - -# Add the following flag(s) after Lisk is added to the Superchain Registry - # --op-network="$OP_NODE_NETWORK" diff --git a/mainnet/genesis.json b/mainnet/genesis.json index a809b1ae..382d14b4 100644 --- a/mainnet/genesis.json +++ b/mainnet/genesis.json @@ -15341,4 +15341,4 @@ "blobGasUsed": null, "baseFeePerGas": "0x3b9aca00", "excessBlobGas": null -} \ No newline at end of file +} diff --git a/mainnet/rollup.json b/mainnet/rollup.json deleted file mode 100644 index 4ef073ee..00000000 --- a/mainnet/rollup.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "genesis": { - "l1": { - "hash": "0xd580bdbd001908860f225c16ddaa08ada64471a68435694760c111253d97ffce", - "number": 19788720 - }, - "l2": { - "hash": "0x5a693d1d8ee27b8e62868d0349af430a2d2e173c8c8988e7b0c9ef91893cbf00", - "number": 0 - }, - "l2_time": 1714728791, - "system_config": { - "scalar": "0x00000000000000000000000000000000000000000000000000000000000f4240", - "gasLimit": 30000000, - "overhead": "0x00000000000000000000000000000000000000000000000000000000000000bc", - "batcherAddr": "0xa6ea2f3299b63c53143c993d2d5e60a69cd6fe24" - } - }, - "block_time": 2, - "delta_time": 0, - "fjord_time": 1720627201, - "canyon_time": 0, - "l1_chain_id": 1, - "l2_chain_id": 1135, - "ecotone_time": 0, - "granite_time": 1726070401, - "regolith_time": 0, - "channel_timeout": 300, - "seq_window_size": 3600, - "batch_inbox_address": "0xff00000000000000000000000000000000001135", - "max_sequencer_drift": 600, - "deposit_contract_address": "0x26db93f8b8b4f7016240af62f7730979d353f9a7", - "l1_system_config_address": "0x05f23282ffdca8286e4738c1af79079f3d843750", - "protocol_versions_address": "0x0000000000000000000000000000000000000000" -} \ No newline at end of file diff --git a/op-node-entrypoint b/op-node-entrypoint index 8cc3d08b..a16386eb 100755 --- a/op-node-entrypoint +++ b/op-node-entrypoint @@ -28,15 +28,9 @@ get_public_ip() { return 1 } -# 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 "$OP_NODE_ROLLUP_CONFIG" ]]; then - echo "expected OP_NODE_ROLLUP_CONFIG to be set" 1>&2 - exit 2 +if [[ -z "$OP_NODE_NETWORK" ]]; then + echo "expected OP_NODE_NETWORK to be set" 1>&2 + exit 1 fi # wait until the local execution client comes up (authed so will return 401 without token) @@ -60,4 +54,4 @@ echo "$OP_NODE_L2_ENGINE_AUTH_RAW" > "$OP_NODE_L2_ENGINE_AUTH" # Start service echoBanner "Starting op-node..." exec ./op-node \ - --rollup.config=$OP_NODE_ROLLUP_CONFIG \ No newline at end of file + --network="$OP_NODE_NETWORK" \ No newline at end of file diff --git a/op-node-lisk-hotfix.patch b/op-node-lisk-sepolia.patch similarity index 100% rename from op-node-lisk-hotfix.patch rename to op-node-lisk-sepolia.patch diff --git a/reth/Dockerfile b/reth/Dockerfile index be3f871a..34124277 100644 --- a/reth/Dockerfile +++ b/reth/Dockerfile @@ -3,8 +3,8 @@ FROM golang:1.22 AS op WORKDIR /app ENV REPO=https://github.com/ethereum-optimism/optimism.git -ENV VERSION=v1.9.5 -ENV COMMIT=5662448279e4fb16e073e00baeb6e458b12a59b2 +ENV VERSION=v1.10.0 +ENV COMMIT=910c9ade39c0bcdff5f2badd94efbe016a428e73 RUN git clone $REPO --branch op-node/$VERSION --single-branch . && \ git switch -c branch-$VERSION && \ bash -c '[ "$(git rev-parse HEAD)" = "$COMMIT" ]' @@ -22,8 +22,8 @@ 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.1.0 -ENV COMMIT=1ba631ba9581973e7c6cadeea92cfe1802aceb4a +ENV VERSION=v1.1.2 +ENV COMMIT=496bf0bf715f0a1fafc198f8d72ccd71913d1a40 RUN git clone $REPO --branch $VERSION --single-branch . && \ git switch -c branch-$VERSION && \ bash -c '[ "$(git rev-parse HEAD)" = "$COMMIT" ]' diff --git a/reth/reth-entrypoint b/reth/reth-entrypoint index 4f43e146..af2305e7 100755 --- a/reth/reth-entrypoint +++ b/reth/reth-entrypoint @@ -44,5 +44,4 @@ exec ./op-reth node \ --disable-discovery \ --port="$P2P_PORT" \ --rollup.sequencer-http=$SEQUENCER_HTTP \ - --rollup.disable-tx-pool-gossip \ - --engine.experimental + --rollup.disable-tx-pool-gossip diff --git a/sepolia/genesis.json b/sepolia/genesis.json index fa26853a..5941c986 100644 --- a/sepolia/genesis.json +++ b/sepolia/genesis.json @@ -15304,4 +15304,4 @@ "blobGasUsed": null, "baseFeePerGas": "0x3b9aca00", "excessBlobGas": null -} \ No newline at end of file +} diff --git a/sepolia/rollup.json b/sepolia/rollup.json deleted file mode 100644 index fa9952dc..00000000 --- a/sepolia/rollup.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "genesis": { - "l1": { - "hash": "0x7d9d6dcec39efe182119f41b1bd2aa7b35b82e43927522afea86d210a4eace4b", - "number": 5089851 - }, - "l2": { - "hash": "0xead3e6ddd08ae7e27fd952b74ceb468ba889047ac96b351dd13bd55e5faf3372", - "number": 0 - }, - "l2_time": 1705312992, - "system_config": { - "scalar": "0x00000000000000000000000000000000000000000000000000000000000f4240", - "gasLimit": 30000000, - "overhead": "0x0000000000000000000000000000000000000000000000000000000000000834", - "batcherAddr": "0x246e119a5bcc2875161b23e4e602e25cece96e37" - } - }, - "block_time": 2, - "delta_time": 1705312994, - "fjord_time": 1716998400, - "canyon_time": 1705312994, - "l1_chain_id": 11155111, - "l2_chain_id": 4202, - "ecotone_time": 1708534800, - "granite_time": 1723478400, - "regolith_time": 0, - "channel_timeout": 300, - "seq_window_size": 3600, - "batch_inbox_address": "0xff00000000000000000000000000000000004202", - "max_sequencer_drift": 600, - "deposit_contract_address": "0xe3d90f21490686ec7ef37be788e02dfc12787264", - "l1_system_config_address": "0xf54791059df4a12ba461b881b4080ae81a1d0ac0", - "protocol_versions_address": "0x0000000000000000000000000000000000000000" -} \ No newline at end of file