Skip to content

Commit

Permalink
Add Reth Node Configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
danyalprout committed Jun 12, 2024
1 parent f722031 commit 33088bc
Show file tree
Hide file tree
Showing 18 changed files with 217 additions and 29,829 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
GETH_HOST_DATA_DIR=./geth-data
RETH_HOST_DATA_DIR=./reth-data
8 changes: 4 additions & 4 deletions .env.mainnet
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
RETH_CHAIN=base
RETH_SEQUENCER_HTTP=https://mainnet-sequencer.base.org

OP_GETH_GENESIS_FILE_PATH=mainnet/genesis-l2.json
OP_GETH_SEQUENCER_HTTP=https://mainnet-sequencer.base.org

# [optional] used to enable geth stats:
# OP_GETH_ETH_STATS=nodename:secret@host:port

Expand All @@ -13,9 +15,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 All @@ -26,7 +27,6 @@ OP_NODE_P2P_BOOTNODES=enr:-J24QNz9lbrKbN4iSmmjtnr7SjUMk4zB7f1krHZcTZx-JRKZd0kA2g
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=mainnet/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
7 changes: 4 additions & 3 deletions .env.sepolia
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
RETH_CHAIN=base-sepolia
RETH_SEQUENCER_HTTP=https://sepolia-sequencer.base.org

OP_GETH_GENESIS_FILE_PATH=sepolia/genesis-l2.json
OP_GETH_SEQUENCER_HTTP=https://sepolia-sequencer.base.org

Expand All @@ -13,9 +16,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 @@ -26,7 +28,6 @@ OP_NODE_P2P_BOOTNODES=enr:-J64QBwRIWAco7lv6jImSOjPU_W266lHXzpAS5YOh7WmgTyBZkgLgO
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
43 changes: 40 additions & 3 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ on:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
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 +31,9 @@ jobs:
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
images: |
${{ env.REGISTRY }}/${{ env.GETH_DEPRECATED_IMAGE_NAME }}
${{ env.REGISTRY }}/${{ env.GETH_IMAGE_NAME }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
Expand All @@ -38,7 +42,40 @@ jobs:
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile.geth
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
reth:
runs-on: ubuntu-latest
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.REGISTRY }}/${{ 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: Dockerfile.reth
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
22 changes: 21 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,25 @@ jobs:
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile.geth
push: false
platforms: ${{ matrix.arch }}
reth:
runs-on: ubuntu-latest
strategy:
matrix:
arch: [ linux/amd64, linux/arm64 ]
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: Dockerfile.reth
push: false
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/
4 changes: 1 addition & 3 deletions Dockerfile → Dockerfile.geth
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ WORKDIR /app
COPY --from=op /app/op-node/bin/op-node ./
COPY --from=geth /app/build/bin/geth ./
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY geth-entrypoint .
COPY geth-entrypoint ./execution-entrypoint
COPY op-node-entrypoint .
COPY sepolia ./sepolia
COPY mainnet ./mainnet

CMD ["/usr/bin/supervisord"]
44 changes: 44 additions & 0 deletions Dockerfile.reth
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
FROM golang:1.21 AS op

WORKDIR /app

ENV REPO=https://github.com/ethereum-optimism/optimism.git
ENV VERSION=v1.7.6
# for verification:
ENV COMMIT=4a487b8920daa9dc4b496d691d5f283f9bb659b1

RUN git clone $REPO --branch op-node/$VERSION --single-branch . && \
git switch -c branch-$VERSION && \
bash -c '[ "$(git rev-parse HEAD)" = "$COMMIT" ]'

RUN cd op-node && \
make VERSION=$VERSION op-node

FROM rust AS reth

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 COMMIT=1c148e7f030f0b6b3610564e0142c799756666f4

RUN git clone $REPO . && git checkout $COMMIT
RUN cargo build --bin op-reth --locked --features jemalloc,optimism --profile maxperf

FROM golang:1.21

RUN apt-get update && \
apt-get install -y jq curl supervisor && \
rm -rf /var/lib/apt/lists
RUN mkdir -p /var/log/supervisor

WORKDIR /app

COPY --from=op /app/op-node/bin/op-node ./
COPY --from=reth /app/target/maxperf/op-reth ./
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY reth-entrypoint ./execution-entrypoint
COPY op-node-entrypoint .

CMD ["/usr/bin/supervisord"]
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ If you encounter problems with your node, please open a [GitHub issue](https://g

### Supported networks

| Ethereum Network | Status |
| ---------------- | ------ |
| Sepolia testnet ||
| Mainnet ||
| Base Network | Status |
|-------------------| ------ |
| Testnet (Sepolia) ||
| Mainnet ||

### Usage

Expand Down
33 changes: 33 additions & 0 deletions docker-compose-reth.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
services:
execution:
build:
context: .
dockerfile: Dockerfile.reth
ports:
- "8545:8545" # RPC
- "8546:8546" # websocket
- "7301:6060" # metrics
command: [ "bash", "./execution-entrypoint" ]
volumes:
- ${RETH_HOST_DATA_DIR}:/data
env_file:
# select your network here:
# - .env.mainnet
# - .env.sepolia
node:
build:
context: .
dockerfile: Dockerfile.reth
depends_on:
- execution
ports:
- "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:
# - .env.mainnet
# - .env.sepolia
34 changes: 17 additions & 17 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
version: '3.8'

services:
geth: # this is Optimism's geth client
build: .
execution:
build:
context: .
dockerfile: Dockerfile.geth
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
env_file:
# select your network here:
# - .env.sepolia
# - .env.mainnet
node:
build: .
build:
context: .
dockerfile: Dockerfile.geth
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 33088bc

Please sign in to comment.