Skip to content

Commit

Permalink
Upgrade for fjord activation (#12)
Browse files Browse the repository at this point in the history
* Upgrade for fjord activation

* 👌 Applied suggestions

* 👌 Applied suggestions

* Add TODO

* 🐳 Update reth dockerfile

* 👌 Applied suggestions

* 🐛 Fix fork-sync workflow

* Update readme
  • Loading branch information
nagdahimanshu authored Jul 10, 2024
1 parent e10d4a2 commit b8ee614
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 51 deletions.
1 change: 1 addition & 0 deletions .env.mainnet
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions .env.sepolia
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/fork-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
64 changes: 22 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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**:
> <br>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:

Expand Down Expand Up @@ -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:
Expand All @@ -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.
Expand Down
7 changes: 7 additions & 0 deletions geth/geth-entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -79,4 +85,5 @@ fi
# --op-network="$OP_NODE_NETWORK" \
--port="$P2P_PORT" \
--rollup.disabletxpoolgossip=true \
--override.fjord=$OVERRIDE_FJORD \
$ADDITIONAL_ARGS # intentionally unquoted
19 changes: 17 additions & 2 deletions op-node-entrypoint
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/bin/bash
set -eu

ADDITIONAL_ARGS=""

get_public_ip() {
# Define a list of HTTP-based providers
local PROVIDERS=(
Expand All @@ -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"
Expand All @@ -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
10 changes: 4 additions & 6 deletions reth/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions reth/reth-entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b8ee614

Please sign in to comment.