Skip to content

Commit

Permalink
[pull] main from base-org:main (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
OKEAMAH authored Jun 16, 2024
2 parents 32b1489 + acc4e30 commit 719f749
Show file tree
Hide file tree
Showing 18 changed files with 215 additions and 29,840 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,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
53 changes: 50 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,49 @@ 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
- arch: linux/arm64
features: jemalloc,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/
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ We recommend you have this hardware configuration to run a node:

- a modern multi-core CPU with good single-core performance
- at least 16 GB RAM (32 GB recommended)
- a high performance SSD drive with at least 4 TB free (NVME recommended)
- a high performance SSD drive with at least 750GB (full node) or 4.5TB (archive node) free

### Troubleshooting

Expand All @@ -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 All @@ -68,7 +68,6 @@ curl -d '{"id":0,"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["late

Note: Some L1 nodes (e.g. Erigon) do not support fetching storage proofs. You can work around this by specifying `--l1.trustrpc` when starting op-node (add it in `op-node-entrypoint` and rebuild the docker image with `docker compose build`.) Do not do this unless you fully trust the L1 node provider.


#### Persisting Data

By default, the data directory is stored in `${PROJECT_ROOT}/geth-data`. You can override this by modifying the value of
Expand All @@ -83,6 +82,7 @@ This is useful for running the node in a Kubernetes cluster, for example.

Note that you'll need to override some of the default configuration that assumes a multi-container environment (`OP_NODE_L2_ENGINE_RPC`) and any port conflicts (`OP_NODE_RPC_PORT`).
Example:

```
docker run --env-file .env.sepolia -e OP_NODE_L2_ENGINE_RPC=ws://localhost:8551 -e OP_NODE_RPC_PORT=7545 ghcr.io/base-org/node:latest
```
Expand Down
36 changes: 18 additions & 18 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: ${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: .
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
14 changes: 6 additions & 8 deletions Dockerfile → geth/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ FROM golang:1.21 as op
WORKDIR /app

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

RUN git clone $REPO --branch op-node/$VERSION --single-branch . && \
git switch -c branch-$VERSION && \
Expand All @@ -19,9 +19,9 @@ FROM golang:1.21 as geth
WORKDIR /app

ENV REPO=https://github.com/ethereum-optimism/op-geth.git
ENV VERSION=v1.101315.0
ENV VERSION=v1.101315.1
# for verification:
ENV COMMIT=ef178f2555afc821a0a522db1f24f06ddab80f3c
ENV COMMIT=3fbae78d638d1b903e702a14f98644c1103ae1b3

# avoid depth=1, so the geth build can read tags
RUN git clone $REPO --branch $VERSION --single-branch . && \
Expand All @@ -30,7 +30,7 @@ RUN git clone $REPO --branch $VERSION --single-branch . && \

RUN go run build/ci.go install -static ./cmd/geth

FROM golang:1.21
FROM ubuntu:22.04

RUN apt-get update && \
apt-get install -y jq curl supervisor && \
Expand All @@ -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/geth-entrypoint ./execution-entrypoint
COPY op-node-entrypoint .
COPY sepolia ./sepolia
COPY mainnet ./mainnet

CMD ["/usr/bin/supervisord"]
7 changes: 5 additions & 2 deletions geth-entrypoint → geth/geth-entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RPC_PORT="${RPC_PORT:-8545}"
WS_PORT="${WS_PORT:-8546}"
AUTHRPC_PORT="${AUTHRPC_PORT:-8551}"
METRICS_PORT="${METRICS_PORT:-6060}"
HOST_IP="0.0.0.0"
HOST_IP="" # put your external IP address here and open port 30303 to improve peer connectivity
P2P_PORT="${P2P_PORT:-30303}"
ADDITIONAL_ARGS=""
OP_GETH_GCMODE="${OP_GETH_GCMODE:-full}"
Expand Down Expand Up @@ -38,6 +38,10 @@ if [ "${OP_GETH_BOOTNODES+x}" = x ]; then
ADDITIONAL_ARGS="$ADDITIONAL_ARGS --bootnodes=$OP_GETH_BOOTNODES"
fi

if [ "${HOST_IP:+x}" = x]; then
ADDITIONAL_ARGS="$ADDITIONAL_ARGS --nat=extip:$HOST_IP"
fi

exec ./geth \
--datadir="$GETH_DATA_DIR" \
--verbosity="$VERBOSITY" \
Expand All @@ -62,7 +66,6 @@ exec ./geth \
--syncmode="$OP_GETH_SYNCMODE" \
--gcmode="$OP_GETH_GCMODE" \
--maxpeers=100 \
--nat=extip:$HOST_IP \
--rollup.sequencerhttp="$OP_GETH_SEQUENCER_HTTP" \
--rollup.halt=major \
--op-network="$OP_NODE_NETWORK" \
Expand Down
Loading

0 comments on commit 719f749

Please sign in to comment.