From 834667cb524281167813fde8ea87f7698f3c0e12 Mon Sep 17 00:00:00 2001 From: avalonche Date: Wed, 21 Aug 2024 05:51:26 +1000 Subject: [PATCH] Update docker build for op-geth --- ops-bedrock/Dockerfile.builder | 9 +++++ ops-bedrock/Dockerfile.l2 | 2 +- ops-bedrock/docker-compose.yml | 12 +++---- ops-bedrock/entrypoint-builder.sh | 55 +++++++++++++++++++++++++++++++ ops-bedrock/entrypoint-l1.sh | 2 ++ ops-bedrock/entrypoint-l2.sh | 6 ++-- 6 files changed, 76 insertions(+), 10 deletions(-) create mode 100644 ops-bedrock/Dockerfile.builder create mode 100644 ops-bedrock/entrypoint-builder.sh diff --git a/ops-bedrock/Dockerfile.builder b/ops-bedrock/Dockerfile.builder new file mode 100644 index 000000000000..cc0bed4c497d --- /dev/null +++ b/ops-bedrock/Dockerfile.builder @@ -0,0 +1,9 @@ +FROM jinmel/builder:latest + +RUN apk add --no-cache jq + +COPY entrypoint-builder.sh /entrypoint.sh + +VOLUME ["/db"] + +ENTRYPOINT ["/bin/sh", "/entrypoint.sh"] diff --git a/ops-bedrock/Dockerfile.l2 b/ops-bedrock/Dockerfile.l2 index 1eb0655321d8..976ab2749859 100644 --- a/ops-bedrock/Dockerfile.l2 +++ b/ops-bedrock/Dockerfile.l2 @@ -1,4 +1,4 @@ -FROM jinmel/op-geth:latest +FROM us-docker.pkg.dev/oplabs-tools-artifacts/images/op-geth:optimism RUN apk add --no-cache jq diff --git a/ops-bedrock/docker-compose.yml b/ops-bedrock/docker-compose.yml index 5c1e3185e6fc..a1fb66859d71 100644 --- a/ops-bedrock/docker-compose.yml +++ b/ops-bedrock/docker-compose.yml @@ -305,18 +305,20 @@ services: ipv4_address: 10.5.0.123 builder-op-geth: + build: + context: . + dockerfile: Dockerfile.builder depends_on: - l1 - l2 - op-node - image: jinmel/builder:latest # NOTE: Replace with the builder image ports: - "5545:8545" volumes: - "builder_data:/db" - "${PWD}/../.devnet/genesis-l2.json:/genesis.json" - "${PWD}/test-jwt-secret.txt:/config/test-jwt-secret.txt" - - "${PWD}/entrypoint-l2.sh:/entrypoint.sh" + - "${PWD}/entrypoint-builder.sh:/entrypoint.sh" entrypoint: # pass the L2 specific flags by overriding the entry-point and adding extra arguments - "/bin/sh" - "/entrypoint.sh" @@ -329,11 +331,7 @@ services: - "--rollup.disabletxpoolgossip" - "--builder" - "--builder.beacon_endpoints=http://builder-op-node:9546" - - "--builder.local_relay" - - "--builder.seconds_in_slot=2" - - "--builder.block_resubmit_interval=200ms" - - "--builder.submission_offset=1s" - - "--builder.algotype=greedy" + - "--builder.block_retry_interval=200ms" - "--builder.block_time=2s" environment: GETH_MINER_RECOMMIT: 100ms diff --git a/ops-bedrock/entrypoint-builder.sh b/ops-bedrock/entrypoint-builder.sh new file mode 100644 index 000000000000..21622eb5e1ec --- /dev/null +++ b/ops-bedrock/entrypoint-builder.sh @@ -0,0 +1,55 @@ +#!/bin/sh + set -exu + + VERBOSITY=${GETH_VERBOSITY:-3} + GETH_DATA_DIR=/db + GETH_CHAINDATA_DIR="$GETH_DATA_DIR/geth/chaindata" + GENESIS_FILE_PATH="${GENESIS_FILE_PATH:-/genesis.json}" + CHAIN_ID=$(cat "$GENESIS_FILE_PATH" | jq -r .config.chainId) + RPC_PORT="${RPC_PORT:-8545}" + WS_PORT="${WS_PORT:-8546}" + AUTH_RPC_PORT="${AUTH_RPC_PORT:-8551}" + METRICS_PORT="${METRICS_PORT:-6060}" + P2P_PORT="${P2P_PORT:-30303}" + + if [ ! -d "$GETH_CHAINDATA_DIR" ]; then + echo "$GETH_CHAINDATA_DIR missing, running init" + echo "Initializing genesis." + geth --verbosity="$VERBOSITY" init \ + --datadir="$GETH_DATA_DIR" \ + --state.scheme=hash \ + "$GENESIS_FILE_PATH" + else + echo "$GETH_CHAINDATA_DIR exists." + fi + + # Warning: Archive mode is required, otherwise old trie nodes will be + # pruned within minutes of starting the devnet. + + exec geth \ + --datadir="$GETH_DATA_DIR" \ + --verbosity="$VERBOSITY" \ + --port="$P2P_PORT" \ + --http \ + --http.corsdomain="*" \ + --http.vhosts="*" \ + --http.addr=0.0.0.0 \ + --http.port="$RPC_PORT" \ + --http.api=web3,debug,eth,txpool,net,engine,admin \ + --ws \ + --ws.addr=0.0.0.0 \ + --ws.port="$WS_PORT" \ + --ws.origins="*" \ + --ws.api=debug,eth,txpool,net,engine \ + --syncmode=full \ + --networkid=$CHAIN_ID \ + --rpc.allow-unprotected-txs \ + --authrpc.addr=0.0.0.0 \ + --authrpc.port="$AUTH_RPC_PORT" \ + --authrpc.vhosts="*" \ + --authrpc.jwtsecret=/config/jwt-secret.txt \ + --gcmode=archive \ + --metrics \ + --metrics.addr=0.0.0.0 \ + --metrics.port="$METRICS_PORT" \ + "$@" \ No newline at end of file diff --git a/ops-bedrock/entrypoint-l1.sh b/ops-bedrock/entrypoint-l1.sh index 4d86e3fa5d14..50942f64c0c5 100644 --- a/ops-bedrock/entrypoint-l1.sh +++ b/ops-bedrock/entrypoint-l1.sh @@ -29,6 +29,7 @@ if [ ! -d "$GETH_CHAINDATA_DIR" ]; then echo "Initializing genesis." geth --verbosity="$VERBOSITY" init \ --datadir="$GETH_DATA_DIR" \ + --state.scheme=hash \ "$GENESIS_FILE_PATH" else echo "$GETH_CHAINDATA_DIR exists." @@ -66,6 +67,7 @@ exec geth \ --authrpc.vhosts="*" \ --authrpc.jwtsecret=/config/jwt-secret.txt \ --gcmode=archive \ + --state.scheme=hash \ --metrics \ --metrics.addr=0.0.0.0 \ --metrics.port=6060 \ diff --git a/ops-bedrock/entrypoint-l2.sh b/ops-bedrock/entrypoint-l2.sh index 3136e054da78..7a5217d90ffd 100644 --- a/ops-bedrock/entrypoint-l2.sh +++ b/ops-bedrock/entrypoint-l2.sh @@ -14,6 +14,7 @@ if [ ! -d "$GETH_CHAINDATA_DIR" ]; then echo "Initializing genesis." geth --verbosity="$VERBOSITY" init \ --datadir="$GETH_DATA_DIR" \ + --state.scheme=hash \ "$GENESIS_FILE_PATH" else echo "$GETH_CHAINDATA_DIR exists." @@ -37,8 +38,8 @@ exec geth \ --ws.origins="*" \ --ws.api=debug,eth,txpool,net,engine \ --syncmode=full \ - --nodiscover \ - --maxpeers=0 \ + --nodiscover \ + --maxpeers=0 \ --networkid="$CHAIN_ID" \ --rpc.allow-unprotected-txs \ --authrpc.addr="0.0.0.0" \ @@ -46,6 +47,7 @@ exec geth \ --authrpc.vhosts="*" \ --authrpc.jwtsecret=/config/jwt-secret.txt \ --gcmode=archive \ + --state.scheme=hash \ --metrics \ --metrics.addr=0.0.0.0 \ --metrics.port=6060 \