Skip to content

Commit

Permalink
Merge latest changes from upstream repo (#7)
Browse files Browse the repository at this point in the history
* Merge changes from upstream repo

* Update readme

* Update readme
Update entrypoint file and .env file to make env variable generic
Update dockerfile

* 👌 Applied suggestions
  • Loading branch information
nagdahimanshu authored Jul 1, 2024
1 parent 5ccd940 commit 71491ee
Show file tree
Hide file tree
Showing 14 changed files with 292 additions and 60 deletions.
3 changes: 2 additions & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
GETH_HOST_DATA_DIR=./geth-data
CLIENT=${CLIENT:-geth}
HOST_DATA_DIR=./${CLIENT}-data
8 changes: 4 additions & 4 deletions .env.mainnet
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
OP_GETH_GENESIS_FILE_PATH=mainnet/genesis.json
OP_GETH_SEQUENCER_HTTP=https://rpc.api.lisk.com
GENESIS_FILE_PATH=mainnet/genesis.json
SEQUENCER_HTTP=https://rpc.api.lisk.com
RETH_CHAIN=lisk

# [optional] used to enable geth stats:
# OP_GETH_ETH_STATS=nodename:secret@host:port
Expand All @@ -13,9 +14,8 @@ OP_NODE_L1_BEACON=https://your.mainnet.beacon.node/endpoint-here
# auth secret used by op-geth engine API:
OP_NODE_L2_ENGINE_AUTH_RAW=688f5d737bad920bdfb2fc2f488d6b6209eebda1dae949a8de91398d932c517a

OP_NODE_BETA_EXTRA_NETWORKS=true
OP_NODE_L2_ENGINE_AUTH=/tmp/engine-auth-jwt
OP_NODE_L2_ENGINE_RPC=ws://geth:8551
OP_NODE_L2_ENGINE_RPC=ws://execution:8551
OP_NODE_LOG_LEVEL=info
OP_NODE_METRICS_ADDR=0.0.0.0
OP_NODE_METRICS_ENABLED=true
Expand Down
9 changes: 4 additions & 5 deletions .env.sepolia
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
OP_GETH_GENESIS_FILE_PATH=sepolia/genesis.json
OP_GETH_SEQUENCER_HTTP=https://rpc.sepolia-api.lisk.com
GENESIS_FILE_PATH=sepolia/genesis.json
SEQUENCER_HTTP=https://rpc.sepolia-api.lisk.com
OP_NODE_OVERRIDE_CANYON=0
RETH_CHAIN=lisk-sepolia

# [optional] used to enable geth stats:
# OP_GETH_ETH_STATS=nodename:secret@host:port
Expand All @@ -14,9 +15,8 @@ OP_NODE_L1_BEACON=https://your.sepolia.beacon.node/endpoint-here
# auth secret used by op-geth engine API:
OP_NODE_L2_ENGINE_AUTH_RAW=688f5d737bad920bdfb2fc2f488d6b6209eebda1dae949a8de91398d932c517a

OP_NODE_BETA_EXTRA_NETWORKS=true
OP_NODE_L2_ENGINE_AUTH=/tmp/engine-auth-jwt
OP_NODE_L2_ENGINE_RPC=ws://geth:8551
OP_NODE_L2_ENGINE_RPC=ws://execution:8551
OP_NODE_LOG_LEVEL=info
OP_NODE_METRICS_ADDR=0.0.0.0
OP_NODE_METRICS_ENABLED=true
Expand All @@ -27,7 +27,6 @@ OP_NODE_P2P_BOOTNODES=enr:-Iu4QI5BdaTmfMhNKXd-vSniNRSCXk-a3m3nQbe9TCV3puGtCr6FvX
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_ROLLUP_CONFIG=sepolia/rollup.json
OP_NODE_RPC_ADDR=0.0.0.0
OP_NODE_RPC_PORT=8545
OP_NODE_SNAPSHOT_LOG=/tmp/op-node-snapshot-log
Expand Down
51 changes: 48 additions & 3 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@ on:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
NAMESPACE: ghcr.io/base-org
GETH_DEPRECATED_IMAGE_NAME: node
GETH_IMAGE_NAME: node-geth
RETH_IMAGE_NAME: node-reth

jobs:
build:
geth:
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -29,7 +32,9 @@ jobs:
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
images: |
${{ env.NAMESPACE }}/${{ env.GETH_DEPRECATED_IMAGE_NAME }}
${{ env.NAMESPACE }}/${{ env.GETH_IMAGE_NAME }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
Expand All @@ -38,7 +43,47 @@ jobs:
uses: docker/build-push-action@v4
with:
context: .
file: geth/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
reth:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- arch: linux/amd64
features: jemalloc,asm-keccak,optimism
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Log into the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata for the Docker image
id: meta
uses: docker/metadata-action@v4
with:
images: |
${{ env.NAMESPACE }}/${{ env.RETH_IMAGE_NAME }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push the Docker image
uses: docker/build-push-action@v4
with:
context: .
file: reth/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
FEATURES=${{ matrix.features }}
platforms: ${{ matrix.arch }}
28 changes: 27 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:

jobs:
build:
geth:
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -20,5 +20,31 @@ jobs:
uses: docker/build-push-action@v4
with:
context: .
file: geth/Dockerfile
push: false
platforms: ${{ matrix.arch }}
reth:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- arch: linux/amd64
features: jemalloc,asm-keccak,optimism
- arch: linux/arm64
features: jemalloc,optimism
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build the Docker image
uses: docker/build-push-action@v4
with:
context: .
file: reth/Dockerfile
push: false
build-args: |
FEATURES=${{ matrix.features }}
platforms: ${{ matrix.arch }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/.idea/
/geth-data/
/geth-data/
/reth-data/
81 changes: 74 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ cd lisk-node

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. Run:
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
Expand All @@ -64,6 +65,7 @@ curl -s -d '{"id":0,"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["l
#### Build

To build `op-node` and `op-geth` from source, follow the OP [documentation](https://docs.optimism.io/builders/node-operators/tutorials/node-from-source).
<br>To build `op-reth` from source, follow the reth official [documentation](https://reth.rs/run/optimism.html#installing-op-reth).
<br>Before proceeding, please make sure to install the following dependency (**this information is missing in the above OP documentation**):

- jq
Expand Down Expand Up @@ -125,12 +127,12 @@ For, Lisk Sepolia Testnet:
--ws.api=debug,eth,net,engine \
--metrics \
--metrics.addr=0.0.0.0 \
--metrics.port=606 \
--metrics.port=6060 \
--syncmode=full \
--gcmode=full \
--maxpeers=100 \
--nat=extip:0.0.0.0 \
--rollup.sequencerhttp=https://rpc.sepolia-api.lisk.com \
--rollup.sequencerhttp=SEQUENCER_HTTP \
--rollup.halt=major \
--port=30303 \
--rollup.disabletxpoolgossip=true \
Expand Down Expand Up @@ -160,19 +162,84 @@ For, Lisk Mainnet:
--ws.api=debug,eth,net,engine \
--metrics \
--metrics.addr=0.0.0.0 \
--metrics.port=606 \
--metrics.port=6060 \
--syncmode=full \
--gcmode=full \
--maxpeers=100 \
--nat=extip:0.0.0.0 \
--rollup.sequencerhttp=https://rpc.api.lisk.com \
--rollup.sequencerhttp=SEQUENCER_HTTP \
--rollup.halt=major \
--port=30303 \
--rollup.disabletxpoolgossip=true
```

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:

```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
```

For, Lisk Mainnet:

```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
```

Refer to the `reth` configuration [documentation](https://reth.rs/cli/reth/node.html#reth-node) for detailed information about available options.

> **Note**: Official Lisk sequencer HTTP:
> <br>For Mainnet: https://rpc.sepolia-api.lisk.com
> <br>For Sepolia Testnet: https://rpc.api.lisk.com
#### Run op-node

Navigate to your `op-node` directory and start service by running the command:
Expand All @@ -182,7 +249,7 @@ For, Lisk Sepolia Testnet:
```sh
./bin/op-node \
--l1=$OP_NODE_L1_ETH_RPC \
--l1.rpckind=$$OP_NODE_L1_RPC_KIND \
--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 \
Expand All @@ -194,7 +261,7 @@ For, Lisk Mainnet:
```sh
./bin/op-node \
--l1=$OP_NODE_L1_ETH_RPC \
--l1.rpckind=$$OP_NODE_L1_RPC_KIND \
--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 \
Expand Down
38 changes: 20 additions & 18 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,33 @@
version: '3.8'

services:
geth: # this is Optimism's geth client
build: .
execution:
platform: linux/amd64
build:
context: .
dockerfile: ${CLIENT}/Dockerfile
ports:
- 8545:8545 # RPC
- 8546:8546 # websocket
- 30303:30303 # P2P TCP (currently unused)
- 30303:30303/udp # P2P UDP (currently unused)
- 7301:6060 # metrics
command: [ "bash", "./geth-entrypoint" ]
- "8545:8545" # RPC
- "8546:8546" # websocket
- "7301:6060" # metrics
command: [ "bash", "./execution-entrypoint" ]
volumes:
- ${GETH_HOST_DATA_DIR}:/data
- ${HOST_DATA_DIR}:/data
env_file:
# select your network here:
# - .env.sepolia
- .env.mainnet
node:
build: .
platform: linux/amd64
build:
context: .
dockerfile: ${CLIENT}/Dockerfile
depends_on:
- geth
- execution
ports:
- 7545:8545 # RPC
- 9222:9222 # P2P TCP
- 9222:9222/udp # P2P UDP
- 7300:7300 # metrics
- 6060:6060 # pprof
- "7545:8545" # RPC
- "9222:9222" # P2P TCP
- "9222:9222/udp" # P2P UDP
- "7300:7300" # metrics
- "6060:6060" # pprof
command: [ "bash", "./op-node-entrypoint" ]
env_file:
# select your network here:
Expand Down
Loading

0 comments on commit 71491ee

Please sign in to comment.