From 63404f1083f8fa3e7a8a07a3b4bc89a00c2afa9c Mon Sep 17 00:00:00 2001 From: "xingqiang.yuan" Date: Fri, 19 Sep 2025 19:04:07 +0800 Subject: [PATCH 1/2] feat(reth): use reth as rpc node --- test/4-op-start-service.sh | 5 +++ test/docker-compose.yml | 75 ++++++++++++------------------------- test/entrypoint/geth-rpc.sh | 33 ++++++++++++++++ test/entrypoint/node-rpc.sh | 41 ++++++++++++++++++++ test/entrypoint/reth-rpc.sh | 22 +++++++++++ test/example.env | 12 ++++-- 6 files changed, 132 insertions(+), 56 deletions(-) create mode 100755 test/entrypoint/geth-rpc.sh create mode 100755 test/entrypoint/node-rpc.sh create mode 100755 test/entrypoint/reth-rpc.sh diff --git a/test/4-op-start-service.sh b/test/4-op-start-service.sh index 0def0d5470937..b2171be149dc8 100755 --- a/test/4-op-start-service.sh +++ b/test/4-op-start-service.sh @@ -27,6 +27,11 @@ if [ "$CONDUCTOR_ENABLED" = "true" ]; then fi if [ "$LAUNCH_RPC_NODE" = "true" ]; then + if [ "$USE_RETH" = "true" ]; then + docker compose up -d op-reth-rpc + else + docker compose up -d op-geth-rpc + fi docker compose up -d op-rpc fi diff --git a/test/docker-compose.yml b/test/docker-compose.yml index 2de111c1e9ab6..996b5e3e428ff 100644 --- a/test/docker-compose.yml +++ b/test/docker-compose.yml @@ -211,37 +211,29 @@ services: op-geth-rpc: image: "${OP_GETH_IMAGE_TAG}" container_name: op-geth-rpc - entrypoint: geth + entrypoint: /entrypoint/geth-rpc.sh + env_file: + - .env volumes: - ./data/op-geth-rpc:/datadir - ./config-op/jwt.txt:/jwt.txt + - ./entrypoint:/entrypoint ports: - "9123:8545" - command: - - --datadir=/datadir - - --db.engine=${DB_ENGINE} - - --http - - --http.corsdomain=* - - --http.vhosts=* - - --http.port=8545 - - --http.addr=0.0.0.0 - - --http.api=web3,debug,eth,txpool,net,engine,miner - - --ws - - --ws.addr=0.0.0.0 - - --ws.port=7546 - - --ws.origins=* - - --ws.api=debug,eth,txpool,net,engine - - --syncmode=full - - --gcmode=archive - - --nodiscover - - --maxpeers=0 - - --networkid=901 - - --authrpc.vhosts=* - - --authrpc.addr=0.0.0.0 - - --authrpc.port=8552 - - --authrpc.jwtsecret=/jwt.txt - - --rollup.sequencerhttp=http://op-geth-seq:8545 - - --rollup.enabletxpooladmission + + op-reth-rpc: + image: "${OP_RETH_IMAGE_TAG}" + container_name: op-reth-rpc + entrypoint: /entrypoint/reth-rpc.sh + env_file: + - .env + volumes: + - ./data/op-reth-rpc:/datadir + - ./config-op/jwt.txt:/jwt.txt + - ./config-op/genesis.json:/genesis.json + - ./entrypoint:/entrypoint + ports: + - "9124:8545" op-seq: image: "${OP_STACK_IMAGE_TAG}" @@ -277,7 +269,7 @@ services: - --l1.beacon=${L1_BEACON_URL_IN_DOCKER} - --l1.rpckind=standard - --safedb.path=/data/safedb - - --conductor.enabled=${CONDUCTOR_ENABLED:-false} # 默认关闭 + - --conductor.enabled=${CONDUCTOR_ENABLED:-false} - --conductor.rpc=http://op-conductor:8547 depends_on: - op-geth-seq @@ -285,37 +277,16 @@ services: op-rpc: image: "${OP_STACK_IMAGE_TAG}" container_name: op-rpc + entrypoint: /entrypoint/node-rpc.sh + env_file: + - .env volumes: - ./data/op-rpc:/data - ./config-op/rollup.json:/rollup.json - ./config-op/jwt.txt:/jwt.txt - - ./config-op/oprpc_p2p_priv.txt:/opnode_p2p_priv.txt + - ./entrypoint:/entrypoint ports: - "9555:9545" - command: - - /app/op-node/bin/op-node - - --log.level=debug - - --l2=http://op-geth-rpc:8552 - - --l2.jwt-secret=/jwt.txt - - --sequencer.enabled=false - - --verifier.l1-confs=1 - - --rollup.config=/rollup.json - - --rpc.addr=0.0.0.0 - - --rpc.port=9545 - - --p2p.listen.tcp=9223 - - --p2p.listen.udp=9223 - - --p2p.priv.raw=604557d042fbea9ed42f46c0c95c346a932b6a5ef0c0dd07a00dbf95801a2510 - - --p2p.peerstore.path=/data/p2p/opnode_peerstore_db - - --p2p.discovery.path=/data/p2p/opnode_discovery_db - - --p2p.static=/dns4/op-seq/tcp/9223/p2p/16Uiu2HAkzHdkbmS2VrCsccLibsu7MvGHpmFUMJnMTkKifrtS5m65 - - --p2p.no-discovery - - --rpc.enable-admin=true - - --l1=${L1_RPC_URL_IN_DOCKER} - - --l1.beacon=${L1_BEACON_URL_IN_DOCKER} - - --l1.rpckind=standard - - --safedb.path=/data/safedb - depends_on: - - op-geth-rpc op-conductor: image: "${OP_STACK_IMAGE_TAG}" diff --git a/test/entrypoint/geth-rpc.sh b/test/entrypoint/geth-rpc.sh new file mode 100755 index 0000000000000..643e287925891 --- /dev/null +++ b/test/entrypoint/geth-rpc.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +set -e + +DB_ENGINE="${DB_ENGINE:-pebble}" +L2_RPC_URL_IN_DOCKER="${L2_RPC_URL_IN_DOCKER:-http://op-geth-seq:8545}" + +# 启动geth +exec geth \ + --datadir=/datadir \ + --db.engine="$DB_ENGINE" \ + --http \ + --http.corsdomain=* \ + --http.vhosts=* \ + --http.port=8545 \ + --http.addr=0.0.0.0 \ + --http.api=web3,debug,eth,txpool,net,engine,miner \ + --ws \ + --ws.addr=0.0.0.0 \ + --ws.port=7546 \ + --ws.origins=* \ + --ws.api=debug,eth,txpool,net,engine \ + --syncmode=full \ + --gcmode=archive \ + --nodiscover \ + --maxpeers=0 \ + --networkid=901 \ + --authrpc.vhosts=* \ + --authrpc.addr=0.0.0.0 \ + --authrpc.port=8552 \ + --authrpc.jwtsecret=/jwt.txt \ + --rollup.sequencerhttp="$L2_RPC_URL_IN_DOCKER" \ + --rollup.enabletxpooladmission diff --git a/test/entrypoint/node-rpc.sh b/test/entrypoint/node-rpc.sh new file mode 100755 index 0000000000000..f97f5f04dba88 --- /dev/null +++ b/test/entrypoint/node-rpc.sh @@ -0,0 +1,41 @@ +#!/bin/sh + + +set -e + +USE_RETH="${USE_RETH:-false}" +L1_RPC_URL_IN_DOCKER="${L1_RPC_URL_IN_DOCKER:-http://l1-geth:8545}" +L1_BEACON_URL_IN_DOCKER="${L1_BEACON_URL_IN_DOCKER:-http://l1-beacon-chain:3500}" + +echo "Starting op-node RPC..." +echo "USE_RETH: $USE_RETH" + +if [ "$USE_RETH" = "true" ]; then + L2_URL="http://op-reth-rpc:8552" + echo "Connecting to Reth: $L2_URL" +else + L2_URL="http://op-geth-rpc:8552" + echo "Connecting to Geth: $L2_URL" +fi + +exec /app/op-node/bin/op-node \ + --log.level=debug \ + --l2="$L2_URL" \ + --l2.jwt-secret=/jwt.txt \ + --sequencer.enabled=false \ + --verifier.l1-confs=1 \ + --rollup.config=/rollup.json \ + --rpc.addr=0.0.0.0 \ + --rpc.port=9545 \ + --p2p.listen.tcp=9223 \ + --p2p.listen.udp=9223 \ + --p2p.priv.raw=604557d042fbea9ed42f46c0c95c346a932b6a5ef0c0dd07a00dbf95801a2510 \ + --p2p.peerstore.path=/data/p2p/opnode_peerstore_db \ + --p2p.discovery.path=/data/p2p/opnode_discovery_db \ + --p2p.static=/dns4/op-seq/tcp/9223/p2p/16Uiu2HAkzHdkbmS2VrCsccLibsu7MvGHpmFUMJnMTkKifrtS5m65 \ + --p2p.no-discovery \ + --rpc.enable-admin=true \ + --l1="$L1_RPC_URL_IN_DOCKER" \ + --l1.beacon="$L1_BEACON_URL_IN_DOCKER" \ + --l1.rpckind=standard \ + --safedb.path=/data/safedb diff --git a/test/entrypoint/reth-rpc.sh b/test/entrypoint/reth-rpc.sh new file mode 100755 index 0000000000000..0f00bae0bbaa5 --- /dev/null +++ b/test/entrypoint/reth-rpc.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +set -e + +L2_RPC_URL_IN_DOCKER="${L2_RPC_URL_IN_DOCKER:-http://op-geth-seq:8545}" + +exec op-reth node \ + --datadir=/datadir \ + --chain=/genesis.json \ + --http \ + --http.port=8545 \ + --http.addr=0.0.0.0 \ + --http.api=admin,debug,eth,net,trace,txpool,web3,rpc,reth,ots,flashbots,miner,mev \ + --ws \ + --ws.addr=0.0.0.0 \ + --ws.port=7546 \ + --ws.api=admin,debug,eth,net,trace,txpool,web3,rpc,reth,ots,flashbots,miner,mev \ + --authrpc.addr=0.0.0.0 \ + --authrpc.port=8552 \ + --authrpc.jwtsecret=/jwt.txt \ + --rollup.sequencer-http="$L2_RPC_URL_IN_DOCKER" \ + --with-unused-ports diff --git a/test/example.env b/test/example.env index 498bb697c54dd..192d3b74e0371 100644 --- a/test/example.env +++ b/test/example.env @@ -1,4 +1,5 @@ OP_GETH_IMAGE_TAG=op-geth:v1.101511.0-patch +OP_RETH_IMAGE_TAG=op-reth:v1.7.0.1 OP_STACK_IMAGE_TAG=op-stack:v1.13.4 OP_CONTRACTS_IMAGE_TAG=op-contracts:v1.13.4 @@ -51,10 +52,13 @@ CHALLENGE_PERIOD_SECONDS=10 WITHDRAWAL_DELAY_SECONDS=$MAX_CLOCK_DURATION # TODO: use real fork block and parent hash in xlayer erigon -FORK_BLOCK=8593920 -PARENT_HASH="0x6912fea590fd46ca6a63ec02c6733f6ffb942b84cdf86f7894c21e1757a1f68a" +FORK_BLOCK=1000 +# 0x6912fea590fd46ca6a63ec02c6733f6ffb942b84cdf86f7894c21e1757a1f68a +PARENT_HASH="0x0000000000000000000000000000000000000000000000000000000000000000" DB_ENGINE="pebble" -CONDUCTOR_ENABLED=true -LAUNCH_RPC_NODE=false +CONDUCTOR_ENABLED=false +LAUNCH_RPC_NODE=true + +USE_RETH=true From ceedfd8a17b301f9d2c9023b5e4fa9b102716c93 Mon Sep 17 00:00:00 2001 From: "xingqiang.yuan" Date: Tue, 14 Oct 2025 18:41:49 +0800 Subject: [PATCH 2/2] update --- test/docker-compose.yml | 2 +- test/entrypoint/reth-rpc.sh | 5 ++--- test/example.env | 7 ++++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test/docker-compose.yml b/test/docker-compose.yml index 996b5e3e428ff..b7ac7dc298f5b 100644 --- a/test/docker-compose.yml +++ b/test/docker-compose.yml @@ -233,7 +233,7 @@ services: - ./config-op/genesis.json:/genesis.json - ./entrypoint:/entrypoint ports: - - "9124:8545" + - "9123:8545" op-seq: image: "${OP_STACK_IMAGE_TAG}" diff --git a/test/entrypoint/reth-rpc.sh b/test/entrypoint/reth-rpc.sh index 0f00bae0bbaa5..67ed560d3debc 100755 --- a/test/entrypoint/reth-rpc.sh +++ b/test/entrypoint/reth-rpc.sh @@ -4,7 +4,7 @@ set -e L2_RPC_URL_IN_DOCKER="${L2_RPC_URL_IN_DOCKER:-http://op-geth-seq:8545}" -exec op-reth node \ +exec op-reth node -vvvvv \ --datadir=/datadir \ --chain=/genesis.json \ --http \ @@ -18,5 +18,4 @@ exec op-reth node \ --authrpc.addr=0.0.0.0 \ --authrpc.port=8552 \ --authrpc.jwtsecret=/jwt.txt \ - --rollup.sequencer-http="$L2_RPC_URL_IN_DOCKER" \ - --with-unused-ports + --rollup.sequencer-http="$L2_RPC_URL_IN_DOCKER" diff --git a/test/example.env b/test/example.env index 192d3b74e0371..e95cbc42a826b 100644 --- a/test/example.env +++ b/test/example.env @@ -1,5 +1,5 @@ OP_GETH_IMAGE_TAG=op-geth:v1.101511.0-patch -OP_RETH_IMAGE_TAG=op-reth:v1.7.0.1 +OP_RETH_IMAGE_TAG=op-reth:v1.7.0.3 OP_STACK_IMAGE_TAG=op-stack:v1.13.4 OP_CONTRACTS_IMAGE_TAG=op-contracts:v1.13.4 @@ -52,9 +52,10 @@ CHALLENGE_PERIOD_SECONDS=10 WITHDRAWAL_DELAY_SECONDS=$MAX_CLOCK_DURATION # TODO: use real fork block and parent hash in xlayer erigon -FORK_BLOCK=1000 +FORK_BLOCK=8593920 # 0x6912fea590fd46ca6a63ec02c6733f6ffb942b84cdf86f7894c21e1757a1f68a -PARENT_HASH="0x0000000000000000000000000000000000000000000000000000000000000000" +# 0x0000000000000000000000000000000000000000000000000000000000000000 +PARENT_HASH="0x6912fea590fd46ca6a63ec02c6733f6ffb942b84cdf86f7894c21e1757a1f68a" DB_ENGINE="pebble"