Skip to content

Commit

Permalink
Update lisk node repository to use data from superchain registry (#48)
Browse files Browse the repository at this point in the history
* Use Superchain Registry data for Lisk network

* 🔨 Configure node to pull configs from the superchain registry

* 🐛 Fix setup to run op-reth client

* 🔨 Rename op-node patch file to be appropriate

* 🔥 Remove unnecessary rollup configs

* 👌 Apply review feedback

---------

Co-authored-by: Matjaz Verbole <[email protected]>
  • Loading branch information
sameersubudhi and matjazv authored Nov 23, 2024
1 parent f915182 commit 3990684
Show file tree
Hide file tree
Showing 15 changed files with 54 additions and 144 deletions.
3 changes: 1 addition & 2 deletions .env.mainnet
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions .env.sepolia
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 13 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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/
.DS_Store
scripts/
43 changes: 15 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 <path-to-lisk-hotfix.patch>
git apply <path-to-op-node-lisk-sepolia.patch>
```

- To build `op-reth` from source, follow the reth official [documentation](https://reth.rs/run/optimism.html#installing-op-reth).
Expand All @@ -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="*" \
Expand All @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
8 changes: 4 additions & 4 deletions dockerfile-lisk-sepolia.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down
10 changes: 4 additions & 6 deletions geth/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]'
Expand All @@ -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" ]'
Expand All @@ -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"]
17 changes: 5 additions & 12 deletions geth/geth-entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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 \
Expand Down Expand Up @@ -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"
2 changes: 1 addition & 1 deletion mainnet/genesis.json
Original file line number Diff line number Diff line change
Expand Up @@ -15341,4 +15341,4 @@
"blobGasUsed": null,
"baseFeePerGas": "0x3b9aca00",
"excessBlobGas": null
}
}
35 changes: 0 additions & 35 deletions mainnet/rollup.json

This file was deleted.

14 changes: 4 additions & 10 deletions op-node-entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
--network="$OP_NODE_NETWORK"
File renamed without changes.
8 changes: 4 additions & 4 deletions reth/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]'
Expand All @@ -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" ]'
Expand Down
3 changes: 1 addition & 2 deletions reth/reth-entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion sepolia/genesis.json
Original file line number Diff line number Diff line change
Expand Up @@ -15304,4 +15304,4 @@
"blobGasUsed": null,
"baseFeePerGas": "0x3b9aca00",
"excessBlobGas": null
}
}
35 changes: 0 additions & 35 deletions sepolia/rollup.json

This file was deleted.

0 comments on commit 3990684

Please sign in to comment.