Skip to content

Commit

Permalink
Merge pull request #108 from Chomtana/main
Browse files Browse the repository at this point in the history
Fix simple-optimism-node to work with latest OP mainnet
  • Loading branch information
Chomtana authored Dec 27, 2023
2 parents 20fea15 + c95cc96 commit c07bf09
Show file tree
Hide file tree
Showing 20 changed files with 44 additions and 174 deletions.
5 changes: 0 additions & 5 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ OP_NODE__RPC_TYPE=basic
# Reference L2 node to run healthcheck against
HEALTHCHECK__REFERENCE_RPC_PROVIDER=

# L1 node to run fault detection against
FAULT_DETECTOR__L1_RPC_PROVIDER=

###############################################################################
# ↓ OPTIONAL (BEDROCK) ↓ #
###############################################################################
Expand All @@ -50,7 +47,6 @@ OP_GETH__HISTORICAL_RPC=
IMAGE_TAG__L2GETH=
IMAGE_TAG__DTL=
IMAGE_TAG__HEALTCHECK=
IMAGE_TAG__FAULT_DETECTOR=
IMAGE_TAG__PROMETHEUS=
IMAGE_TAG__GRAFANA=
IMAGE_TAG__INFLUXDB=
Expand All @@ -63,7 +59,6 @@ PORT__L2GETH_HTTP=
PORT__L2GETH_WS=
PORT__DTL=
PORT__HEALTHCHECK_METRICS=
PORT__FAULT_DETECTOR_METRICS=
PORT__PROMETHEUS=
PORT__GRAFANA=
PORT__INFLUXDB=
Expand Down
37 changes: 7 additions & 30 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
version: "3.4"
services:
dtl:
image: ethereumoptimism/data-transport-layer:${IMAGE_TAG__DTL:-latest}
restart: unless-stopped
entrypoint: /scripts/start-dtl.sh
env_file:
- ./envs/${NETWORK_NAME}/dtl.env
- .env
volumes:
- dtl:/db
- ./scripts/:/scripts/
ports:
- ${PORT__DTL:-7878}:7878
profiles:
- legacy

l2geth:
image: ethereumoptimism/l2geth:${IMAGE_TAG__L2GETH:-latest}
restart: unless-stopped
Expand All @@ -24,7 +9,7 @@ services:
- -c
- "/scripts/init-l2geth.sh && /scripts/start-l2geth.sh"
env_file:
- ./envs/${NETWORK_NAME}/l2geth.env
- ./envs/common/l2geth.env
- .env
volumes:
- geth:/geth
Expand All @@ -39,24 +24,13 @@ services:
image: ethereumoptimism/replica-healthcheck:${IMAGE_TAG__HEALTHCHECK:-latest}
restart: unless-stopped
env_file:
- ./envs/${NETWORK_NAME}/healthcheck.env
- ./envs/common/healthcheck.env
- .env
ports:
- ${PORT__HEALTHCHECK_METRICS:-7300}:7300
profiles:
- current

fault-detector:
image: ethereumoptimism/fault-detector:${IMAGE_TAG__FAULT_DETECTOR:-latest}
restart: unless-stopped
env_file:
- ./envs/${NETWORK_NAME}/fault-detector.env
- .env
ports:
- ${PORT__FAULT_DETECTOR_METRICS:-7301}:7300
profiles:
- current

op-geth:
image: us-docker.pkg.dev/oplabs-tools-artifacts/images/op-geth:v1.101304.0
restart: unless-stopped
Expand All @@ -66,6 +40,7 @@ services:
- ./envs/${NETWORK_NAME}/op-geth.env
- .env
volumes:
- ./envs/${NETWORK_NAME}/config:/chainconfig
- ./scripts/:/scripts
- shared:/shared
- op_geth:/geth
Expand All @@ -81,8 +56,10 @@ services:
stop_grace_period: 5m
entrypoint: /scripts/start-op-node.sh
env_file:
- ./envs/${NETWORK_NAME}/op-node.env
- .env
volumes:
- ./envs/${NETWORK_NAME}/config:/chainconfig
- ./scripts/:/scripts
- shared:/shared
ports:
Expand Down Expand Up @@ -125,7 +102,7 @@ services:
image: grafana/grafana:${IMAGE_TAG__GRAFANA:-9.3.0}
restart: unless-stopped
env_file:
- ./envs/${NETWORK_NAME}/grafana.env
- ./envs/common/grafana.env
volumes:
- ./docker/grafana/provisioning/:/etc/grafana/provisioning/:ro
- ./docker/grafana/dashboards/simple_node_dashboard.json:/var/lib/grafana/dashboards/simple_node_dashboard.json
Expand All @@ -140,7 +117,7 @@ services:
image: influxdb:${IMAGE_TAG__INFLUXDB:-1.8}
restart: unless-stopped
env_file:
- ./envs/${NETWORK_NAME}/influxdb.env
- ./envs/common/influxdb.env
volumes:
- ./docker/influxdb/influx_init.iql:/docker-entrypoint-initdb.d/influx_init.iql
- influxdb_data:/var/lib/influxdb
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions envs/common/l2geth.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
USING_OVM=true
ETH1_SYNC_SERVICE_ENABLE=false
RPC_API=eth,rollup,net,web3,debug
RPC_ADDR=0.0.0.0
RPC_CORS_DOMAIN=*
RPC_ENABLE=true
RPC_PORT=8545
RPC_VHOSTS=*
19 changes: 0 additions & 19 deletions envs/op-goerli/dtl.env

This file was deleted.

2 changes: 0 additions & 2 deletions envs/op-goerli/fault-detector.env

This file was deleted.

41 changes: 0 additions & 41 deletions envs/op-goerli/l2geth.env

This file was deleted.

Empty file added envs/op-goerli/op-node.env
Empty file.
19 changes: 0 additions & 19 deletions envs/op-mainnet/dtl.env

This file was deleted.

2 changes: 0 additions & 2 deletions envs/op-mainnet/fault-detector.env

This file was deleted.

1 change: 0 additions & 1 deletion envs/op-mainnet/grafana.env

This file was deleted.

1 change: 0 additions & 1 deletion envs/op-mainnet/healthcheck.env

This file was deleted.

1 change: 0 additions & 1 deletion envs/op-mainnet/influxdb.env

This file was deleted.

41 changes: 0 additions & 41 deletions envs/op-mainnet/l2geth.env

This file was deleted.

1 change: 1 addition & 0 deletions envs/op-mainnet/op-node.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Official chain doesn't need custom
4 changes: 2 additions & 2 deletions scripts/init-bedrock.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ echo "Initializing via download..."

# Fix OP link with hardcoded official OP snapshot
echo "Fetching download link..."
if [ "$NETWORK_NAME" = "mainnet" ]; then
if [ "$NETWORK_NAME" = "op-mainnet" ]; then
BEDROCK_TAR_DOWNLOAD="https://datadirs.optimism.io/mainnet-bedrock.tar.zst"
elif [ "$NETWORK_NAME" = "goerli" ]; then
elif [ "$NETWORK_NAME" = "op-goerli" ]; then
BEDROCK_TAR_DOWNLOAD="https://datadirs.optimism.io/goerli-bedrock.tar.zst"
else
BEDROCK_TAR_DOWNLOAD=$(config "bedrock/$NETWORK_NAME/bedrock-download")
Expand Down
26 changes: 19 additions & 7 deletions scripts/start-op-geth.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,19 @@ while [ ! -f /shared/initialized.txt ]; do
sleep 60
done

if [ -z "${IS_CUSTOM_CHAIN+x}" ]; then
if [ "$NETWORK_NAME" == "op-mainnet" ] || [ "$NETWORK_NAME" == "op-goerli" ]; then
export EXTENDED_ARG="--rollup.historicalrpc=${OP_GETH__HISTORICAL_RPC:-http://l2geth:8545} --op-network=$NETWORK_NAME"
else
export EXTENDED_ARG="--op-network=$NETWORK_NAME"
fi
fi

# Init genesis if custom chain
if [ -n "${IS_CUSTOM_CHAIN+x}" ]; then
geth init --datadir="$BEDROCK_DATADIR" /chainconfig/genesis.json
fi

# Start op-geth.
exec geth \
--datadir="$BEDROCK_DATADIR" \
Expand All @@ -17,10 +30,10 @@ exec geth \
--http.port=8545 \
--http.api=web3,debug,eth,txpool,net,engine \
--ws \
--ws.addr=0.0.0.0 \
--ws.port=8546 \
--ws.origins="*" \
--ws.api=debug,eth,txpool,net,engine,web3 \
--ws.addr=0.0.0.0 \
--ws.port=8546 \
--ws.origins="*" \
--ws.api=debug,eth,txpool,net,engine,web3 \
--metrics \
--metrics.influxdb \
--metrics.influxdb.endpoint=http://influxdb:8086 \
Expand All @@ -36,6 +49,5 @@ exec geth \
--authrpc.jwtsecret=/shared/jwt.txt \
--rollup.sequencerhttp="$BEDROCK_SEQUENCER_HTTP" \
--rollup.disabletxpoolgossip=true \
--rollup.historicalrpc="${OP_GETH__HISTORICAL_RPC:-http://l2geth:8545}" \
--op-network=$NETWORK_NAME \
$@
$EXTENDED_ARG $@

10 changes: 7 additions & 3 deletions scripts/start-op-node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@ while [ ! -f /shared/initialized.txt ]; do
sleep 60
done

if [ -n "${IS_CUSTOM_CHAIN+x}" ]; then
export EXTENDED_ARG="--rollup.config=/chainconfig/rollup.json"
else
export EXTENDED_ARG="--network=$NETWORK_NAME --rollup.load-protocol-versions=true"
fi

# Start op-node.
exec op-node \
--l1=$OP_NODE__RPC_ENDPOINT \
--l2=http://op-geth:8551 \
--network=$NETWORK_NAME \
--rpc.addr=127.0.0.1 \
--rpc.port=9545 \
--l2.jwt-secret=/shared/jwt.txt \
Expand All @@ -20,5 +25,4 @@ exec op-node \
--metrics.enabled \
--metrics.addr=0.0.0.0 \
--metrics.port=7300 \
--rollup.load-protocol-versions=true \
$@
$EXTENDED_ARG $@

0 comments on commit c07bf09

Please sign in to comment.