From 4894313738d620a312256d90d6d68503399b6c21 Mon Sep 17 00:00:00 2001 From: Julian Meyer Date: Fri, 7 Nov 2025 08:01:27 -0800 Subject: [PATCH 1/3] feat: support proofs ExEx --- reth/reth-entrypoint | 75 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 74 insertions(+), 1 deletion(-) diff --git a/reth/reth-entrypoint b/reth/reth-entrypoint index 6948731f6..02fb44e01 100755 --- a/reth/reth-entrypoint +++ b/reth/reth-entrypoint @@ -11,6 +11,10 @@ DISCOVERY_PORT="${DISCOVERY_PORT:-30303}" P2P_PORT="${P2P_PORT:-30303}" ADDITIONAL_ARGS="" BINARY="./base-reth-node" +NODE_TYPE="${NODE_TYPE:-base}" +RETH_HISTORICAL_PROOFS="${RETH_HISTORICAL_PROOFS:-false}" +RETH_HISTORICAL_PROOFS_STORAGE_PATH="${RETH_HISTORICAL_PROOFS_STORAGE_PATH:-}" +LOG_LEVEL="${LOG_LEVEL:-info}" if [[ -z "${RETH_CHAIN:-}" ]]; then echo "expected RETH_CHAIN to be set" 1>&2 @@ -25,18 +29,87 @@ else echo "Running in vanilla node mode (no Flashblocks URL provided)" fi +case "$LOG_LEVEL" in + "debug") + LOG_LEVEL="vvvv" + ;; + "warn") + LOG_LEVEL="vv" + ;; + "info"|*) + LOG_LEVEL="vvv" + ;; +esac + # Add pruning for base if [[ "${RETH_PRUNING_ARGS+x}" = x ]]; then echo "Adding pruning arguments: $RETH_PRUNING_ARGS" ADDITIONAL_ARGS="$ADDITIONAL_ARGS $RETH_PRUNING_ARGS" fi +if [[ "$RETH_HISTORICAL_PROOFS" == "true" && -n "$RETH_HISTORICAL_PROOFS_STORAGE_PATH" ]]; then + # reth doesn't like starting an old database in RO mode, so we have to start the reth node, wait for it to start up, then shut it down first + "$BINARY" node \ + -$LOG_LEVEL \ + --datadir="$RETH_DATA_DIR" \ + --log.stdout.format json \ + --http \ + --http.addr=127.0.0.1 \ + --http.port="$RPC_PORT" \ + --http.api=eth \ + --chain "$RETH_CHAIN" & + + PID=$! + + MAX_WAIT=$((60 * 60 * 6)) # 6 hours (static file manager init is slow) + + # wait for json-rpc to return a block number greater than 0 (synced beyond genesis) + while true; do + RESPONSE=$(curl -s -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["latest", false],"id":1}' http://127.0.0.1:"$RPC_PORT" 2>/dev/null || true) + + if echo "$RESPONSE" | grep -q '"number":"0x0"'; then + echo "waiting for reth node to sync beyond genesis block" + elif echo "$RESPONSE" | grep -q '"result"'; then + # curl succeeded and returned a valid result with block number != 0x0 + break + else + echo "waiting for reth node to start up" + fi + + sleep 1 + MAX_WAIT=$((MAX_WAIT - 1)) + if [ "$MAX_WAIT" -eq 0 ]; then + echo "timed out waiting for reth node to start up" + kill "$PID" + exit 1 + fi + done + + # shut down gracefully + kill "$PID" + + wait "$PID" + echo "reth node initialized" + + ADDITIONAL_ARGS="$ADDITIONAL_ARGS --proofs-history --proofs-history.storage-path=$RETH_HISTORICAL_PROOFS_STORAGE_PATH" + + # in this case, we need to run the init script first (idempotent) + "$BINARY" proofs init \ + -$LOG_LEVEL \ + --log.stdout.format json \ + --chain "$RETH_CHAIN" \ + --datadir="$RETH_DATA_DIR" \ + --proofs-history.storage-path=$RETH_HISTORICAL_PROOFS_STORAGE_PATH + + sleep 60 +fi + mkdir -p "$RETH_DATA_DIR" echo "Starting reth with additional args: $ADDITIONAL_ARGS" echo "$OP_NODE_L2_ENGINE_AUTH_RAW" > "$OP_NODE_L2_ENGINE_AUTH" exec "$BINARY" node \ - -vvv \ + -$LOG_LEVEL \ --datadir="$RETH_DATA_DIR" \ --log.stdout.format json \ --ws \ From 9d8f5c1074f153ade1e46f57be2acde3155f9e51 Mon Sep 17 00:00:00 2001 From: Julian Meyer Date: Wed, 25 Feb 2026 17:28:23 -0800 Subject: [PATCH 2/3] Remove unnecessary sleep + env; exhaustive log levels --- reth/reth-entrypoint | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/reth/reth-entrypoint b/reth/reth-entrypoint index 02fb44e01..db915ede5 100755 --- a/reth/reth-entrypoint +++ b/reth/reth-entrypoint @@ -11,7 +11,6 @@ DISCOVERY_PORT="${DISCOVERY_PORT:-30303}" P2P_PORT="${P2P_PORT:-30303}" ADDITIONAL_ARGS="" BINARY="./base-reth-node" -NODE_TYPE="${NODE_TYPE:-base}" RETH_HISTORICAL_PROOFS="${RETH_HISTORICAL_PROOFS:-false}" RETH_HISTORICAL_PROOFS_STORAGE_PATH="${RETH_HISTORICAL_PROOFS_STORAGE_PATH:-}" LOG_LEVEL="${LOG_LEVEL:-info}" @@ -30,8 +29,8 @@ else fi case "$LOG_LEVEL" in - "debug") - LOG_LEVEL="vvvv" + "error") + LOG_LEVEL="v" ;; "warn") LOG_LEVEL="vv" @@ -39,6 +38,12 @@ case "$LOG_LEVEL" in "info"|*) LOG_LEVEL="vvv" ;; + "debug") + LOG_LEVEL="vvvv" + ;; + "trace") + LOG_LEVEL="vvvvv" + ;; esac # Add pruning for base @@ -100,8 +105,6 @@ if [[ "$RETH_HISTORICAL_PROOFS" == "true" && -n "$RETH_HISTORICAL_PROOFS_STORAGE --chain "$RETH_CHAIN" \ --datadir="$RETH_DATA_DIR" \ --proofs-history.storage-path=$RETH_HISTORICAL_PROOFS_STORAGE_PATH - - sleep 60 fi mkdir -p "$RETH_DATA_DIR" From dc52b6ccd47e06c82c1da1930bc1ab5c5d7fb668 Mon Sep 17 00:00:00 2001 From: Julian Meyer Date: Wed, 25 Feb 2026 17:41:03 -0800 Subject: [PATCH 3/3] ignore wait exit code --- reth/reth-entrypoint | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/reth/reth-entrypoint b/reth/reth-entrypoint index db915ede5..12d9b9cf8 100755 --- a/reth/reth-entrypoint +++ b/reth/reth-entrypoint @@ -93,8 +93,7 @@ if [[ "$RETH_HISTORICAL_PROOFS" == "true" && -n "$RETH_HISTORICAL_PROOFS_STORAGE # shut down gracefully kill "$PID" - wait "$PID" - echo "reth node initialized" + (wait "$PID" && echo "reth node initialized") || echo "warning: reth node exited with code $?" ADDITIONAL_ARGS="$ADDITIONAL_ARGS --proofs-history --proofs-history.storage-path=$RETH_HISTORICAL_PROOFS_STORAGE_PATH"