From 2049ab2cf76c6325b7830d4b7b6443e2a89fbada Mon Sep 17 00:00:00 2001 From: Lucas Simpson Date: Thu, 15 Oct 2026 10:10:16 -0400 Subject: [PATCH] Update to op-reth v2.6.0 and op-node v1.19.8 Co-Authored-By: Claude Sonnet 5.5 --- .env.example | 47 +-- README.md | 225 +++++----- docker-compose.yml | 44 +- .../dashboards/simple_node_dashboard.json | 396 +++--------------- .../grafana/provisioning/datasources/all.yml | 11 +- docker/influxdb/influx_init.iql | 1 - docker/prometheus/prometheus.yml | 5 + envs/common/healthcheck.env | 2 +- envs/common/influxdb.env | 1 - envs/ink-mainnet/op-node.env | 1 - envs/ink-mainnet/{op-geth.env => op-reth.env} | 2 +- envs/ink-sepolia/op-node.env | 1 - envs/ink-sepolia/{op-geth.env => op-reth.env} | 2 +- progress.sh | 2 +- scripts/init-bedrock.sh | 129 ++---- scripts/start-op-geth.sh | 52 --- scripts/start-op-node.sh | 4 +- scripts/start-op-reth.sh | 54 +++ 18 files changed, 320 insertions(+), 659 deletions(-) delete mode 100644 docker/influxdb/influx_init.iql delete mode 100644 envs/common/influxdb.env rename envs/ink-mainnet/{op-geth.env => op-reth.env} (71%) rename envs/ink-sepolia/{op-geth.env => op-reth.env} (73%) delete mode 100755 scripts/start-op-geth.sh create mode 100755 scripts/start-op-reth.sh diff --git a/.env.example b/.env.example index 831345b..791b78e 100644 --- a/.env.example +++ b/.env.example @@ -2,27 +2,22 @@ # ↓ REQUIRED ↓ # ############################################################################### -# Current status: this template matches the repository's current op-geth-based -# stack. Optimism says op-geth support ends on May 31, 2026 and Glamsterdam -# will require op-reth. op-node is not being deprecated, but this template does -# not yet include an op-reth execution path. -# For long-lived nodes, treat this as the current stack only and plan an -# op-reth migration window now. - -# Recommended first run for the current op-geth-based stack: ink-sepolia + full +# Network to run: ink-mainnet or ink-sepolia. NETWORK_NAME=ink-sepolia -# "full" starts from an empty datadir. This is the recommended first run. -# "archive" restores from a per-network geth snapshot pointer during -# bedrock-init and needs much more disk. If the snapshot lookup fails, switch -# back to full. +# "full" prunes old state and starts from the latest full op-reth snapshot. +# "archive" keeps all history and starts from the latest archive snapshot. +# Snapshots are downloaded from https://snapshots.optimism.io/ on first run. NODE_TYPE=full -# For a quick Sepolia smoke test, these public endpoints worked during docs -# validation: -# - https://ethereum-sepolia-rpc.publicnode.com -# - https://ethereum-sepolia-beacon-api.publicnode.com -# For a long-running node, use a provider with higher rate limits. +# After the snapshot is restored, op-node derives the chain from L1 starting at +# the snapshot date (up to about a week back). Use an L1 provider that serves +# receipts for old blocks (eth_getBlockReceipts) and has high rate limits. +# Free public endpoints were tested against Ink Sepolia and are not enough: +# - ethereum-sepolia-rpc.publicnode.com returns no receipts for older blocks +# - sepolia.gateway.tenderly.co returns 429 Too Many Requests +# - sepolia.drpc.org only allows batches of 3 (set OP_NODE_L1_RPC_MAX_BATCH_SIZE=3) +# and still catches up slower than the chain advances # L1 execution RPC endpoint for the matching Ethereum network OP_NODE__RPC_ENDPOINT= @@ -30,6 +25,10 @@ OP_NODE__RPC_ENDPOINT= # L1 beacon API endpoint for the matching Ethereum network OP_NODE__L1_BEACON= +# Optional: cap op-node's L1 batch request size for providers that limit +# batches (default 20). Read directly by op-node; op-reth ignores it. +# OP_NODE_L1_RPC_MAX_BATCH_SIZE=3 + # Use "basic" for generic providers. Other supported values are alchemy, # quicknode, and erigon. OP_NODE__RPC_TYPE=basic @@ -47,16 +46,14 @@ HEALTHCHECK__REFERENCE_RPC_PROVIDER=https://rpc-gel-sepolia.inkonchain.com IMAGE_TAG__HEALTHCHECK= IMAGE_TAG__PROMETHEUS= IMAGE_TAG__GRAFANA= -IMAGE_TAG__INFLUXDB= # Exposed host ports (must be unique). Set these only if the defaults clash. PORT__HEALTHCHECK_METRICS= PORT__PROMETHEUS= PORT__GRAFANA= -PORT__INFLUXDB= -PORT__OP_GETH_HTTP= -PORT__OP_GETH_WS= -PORT__OP_GETH_P2P= +PORT__OP_RETH_HTTP= +PORT__OP_RETH_WS= +PORT__OP_RETH_P2P= # PORT__OP_NODE_P2P changes the published host port. The in-container # op-node listener still uses 9003. PORT__OP_NODE_P2P= @@ -64,9 +61,9 @@ PORT__OP_NODE_HTTP= # Advanced wrapper inputs shared by the shell entrypoints. Leave blank unless # you know you need them. -# OVERRIDE_HOLOCENE appends --override.holocene= in both wrappers. +# OVERRIDE_HOLOCENE appends --override.holocene= to op-node only. OVERRIDE_HOLOCENE= -# EXTENDED_ARG is appended verbatim to both start commands. Only use flags that -# are valid for the process you want to affect. +# EXTENDED_ARG is appended verbatim to both start commands (op-node and +# op-reth). Only use flags that are valid for the process you want to affect. EXTENDED_ARG= diff --git a/README.md b/README.md index 9352333..d36b421 100644 --- a/README.md +++ b/README.md @@ -2,41 +2,40 @@ > Forked and customized from https://github.com/smartcontracts/simple-optimism-node -A Docker Compose setup for running an Ink node on the repository's current -`op-geth`-based stack, plus the supporting healthcheck and monitoring services. +A Docker Compose setup for running an Ink node, plus the supporting +healthcheck and monitoring services. -## Current Status +## Versions -This repository currently ships an `op-geth` execution client. The instructions -below are the current `op-geth` runbook for this Compose stack, not the -long-term recommendation. +| Component | Version | +|---|---| +| Execution client | `op-reth` `v2.6.0` | +| `op-node` | `v1.19.8` | -Per Optimism, `op-geth` support ends on May 31, 2026, and nodes still running -it at the L1 Glamsterdam hardfork will not be able to follow the canonical -chain. `op-node` is not being deprecated. See the +`op-geth` reached end of support on **May 31, 2026**, and the **Karst** +hardfork activated on Ink Mainnet on **July 8, 2026** without `op-geth` support. +This stack runs `op-reth` as its execution client. Post-Karst `op-reth` needs +`op-node` `v1.19.1` or later because of the new `getPayloadV5` engine API +method, and `op-reth` `v2.3.3` or later (`v2.3.2` shipped a known +`eth_estimateGas` bug after Karst activation). + +See the [op-geth deprecation notice](https://docs.optimism.io/notices/op-geth-deprecation) and the [op-reth configuration guide](https://docs.optimism.io/node-operators/guides/configuration/execution-clients#op-reth-configuration). -If you operate a production or long-lived node, start planning an `op-reth` -migration now. Run it in parallel, validate it over a meaningful window, and -prepare a fresh snapshot before the hardfork window. Treat this as an -operator-owned migration rather than something to delay until a later -sequencer-side client switch. - -This repository does not yet ship an `op-reth` Compose path. Before it can, the -repo still needs: - -- a validated `op-reth` service, image, and entrypoint in `docker-compose.yml` -- an `op-node` engine endpoint that no longer points at `http://op-geth:8551` -- archive init and snapshot handling that can consume `op-reth` snapshots where - available. The checked Sepolia Ink Gelato index already exposes - `reth/full/datadir` artifacts, but this repo does not use them yet and the - checked mainnet Ink index still only exposes geth archives -- healthcheck and monitoring updates, which still target `op-geth` and the - `opgeth` InfluxDB database -- env and port naming that no longer assumes `op-geth`, such as - `PORT__OP_GETH_*` and `envs/*/op-geth.env` +### Migrating from the `op-geth` stack + +- `op-geth` data cannot be reused. `op-reth` starts from an `op-reth` snapshot + (see [Snapshot sources](#snapshot-sources)), so run `docker compose down -v` + once, or remove the old `op_geth` volume, to reclaim the disk +- Port variables were renamed from `PORT__OP_GETH_*` to `PORT__OP_RETH_*`, and + `envs//op-geth.env` is now `envs//op-reth.env`. Update any + existing `.env` +- InfluxDB and its `opgeth` database are gone. The dashboard reads `op-reth` + metrics from Prometheus instead +- `op-node` flags `--rollup.halt` and `--rollup.load-protocol-versions` were + removed upstream and are no longer passed ## Recommended Hardware @@ -57,7 +56,11 @@ repo still needs: - Docker Engine and Docker Compose v2 on Linux, or Docker Desktop on macOS and Windows - Working L1 execution RPC and L1 beacon API endpoints for the Ethereum network - that matches your target Ink network + that matches your target Ink network. After the snapshot restore, `op-node` + derives the chain from L1 starting at the snapshot date, so the L1 RPC must + serve receipts for blocks up to about a week old and have high rate limits. + Free public endpoints are not enough (see + [`op-node` cannot connect to L1](#op-node-cannot-connect-to-l1)) - Enough free disk for your chosen node type On Apple Silicon, the `healthcheck` sidecar runs as `linux/amd64`. Docker @@ -107,8 +110,7 @@ cp .env.example .env ### 3. Edit `.env` -For the lowest-friction first run on the current `op-geth` stack, start with -`ink-sepolia` and a `full` node: +For the lowest-friction first run, start with `ink-sepolia` and a `full` node: ```sh NETWORK_NAME=ink-sepolia @@ -122,16 +124,14 @@ HEALTHCHECK__REFERENCE_RPC_PROVIDER=https://rpc-gel-sepolia.inkonchain.com Configuration notes: - `NETWORK_NAME`: `ink-sepolia` or `ink-mainnet` -- `NODE_TYPE=full`: starts from an empty local datadir. This is the validated - first-run path in this repo -- `NODE_TYPE=archive`: resolves the newest archival geth datadir for the - current `op-geth` stack from the Gelato ChainSnap index for your network, - downloads the matching `.sha256`, verifies the archive, and extracts it - during `bedrock-init` +- `NODE_TYPE=full`: restores the latest `op-reth` full snapshot and runs + `op-reth --full`, which prunes old state +- `NODE_TYPE=archive`: restores the latest `op-reth` archive snapshot and keeps + all history. See [Snapshot sources](#snapshot-sources) for download sizes - `OP_NODE__RPC_TYPE=basic`: the right default for generic providers; use `alchemy`, `quicknode`, or `erigon` only when your provider requires it - `.env` overrides the same variable for services that load `.env` in - `docker-compose.yml`, including `op-geth`, `op-node`, `healthcheck`, and + `docker-compose.yml`, including `op-reth`, `op-node`, `healthcheck`, and `bedrock-init` - `envs//op-node.env` already supplies the network P2P defaults, so most first-time setups only need the `.env` values above @@ -140,9 +140,9 @@ Configuration notes: - For `ink-mainnet`, switch the healthcheck reference RPC to `https://rpc-gel.inkonchain.com` - Advanced wrapper inputs such as `OVERRIDE_HOLOCENE` and `EXTENDED_ARG` live - in `.env.example`. The shell entrypoints append them to both `op-geth` and - `op-node`, so leave them empty unless you know the flag is compatible with - the process you want to change + in `.env.example`. `EXTENDED_ARG` is appended to both `op-reth` and `op-node`, + and `OVERRIDE_HOLOCENE` to `op-node` only, so leave them empty unless you + know the flag is compatible with the process you want to change ### 4. Start the stack @@ -150,20 +150,19 @@ Configuration notes: docker compose up -d --build ``` -This pulls the service images, builds the local `bedrock-init` image, creates a -JWT, and starts: +This pulls the service images, builds the local `bedrock-init` image, downloads +and extracts the latest `op-reth` snapshot, creates a JWT, and starts: - `bedrock-init` (one-time init) -- `op-geth` (current execution client in this repo) +- `op-reth` (execution client) - `op-node` - `healthcheck` - `prometheus` - `grafana` -- `influxdb` -`op-geth` and `op-node` both wait for `bedrock-init` to create -`/shared/initialized.txt`. If the stack looks stuck, check `bedrock-init` -first. +`op-reth` and `op-node` both wait for `bedrock-init` to create +`/shared/initialized.txt`. The snapshot is hundreds of GB, so the first start can +take a long time. If the stack looks stuck, check `bedrock-init` first. ## Validate Startup @@ -181,19 +180,19 @@ once it exits. If you want to confirm it finished successfully, run ### Check the key logs ```sh -docker compose logs --tail 50 bedrock-init op-geth op-node +docker compose logs --tail 50 bedrock-init op-reth op-node ``` Good startup signals: - `bedrock-init` on first boot: `Creating JWT...` and `Creating Bedrock flag...` - `bedrock-init` on restart with existing volumes: `Bedrock node already initialized` -- `op-geth`: `HTTP server started` +- `op-reth`: `RPC HTTP server started` - `op-node`: `Rollup node started` ### Smoke test the RPC endpoints -Execution RPC for the current `op-geth` service: +Execution RPC for the `op-reth` service: ```sh curl -fsS -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":1}' http://127.0.0.1:9993 @@ -214,9 +213,10 @@ Sync status: curl -fsS -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"optimism_syncStatus","params":[],"id":1}' http://127.0.0.1:9545 ``` -On a brand-new `full` node, this is the best early signal that the rollup node -is moving forward. Look for `current_l1` and `head_l1` values to advance even -while local L2 block height is still `0x0`. +This is the best early signal that the rollup node is moving forward. Look for +`current_l1` to advance toward `head_l1`. Right after a snapshot restore, +`unsafe_l2` and `eth_blockNumber` stay at the snapshot height until derivation +produces new blocks. Healthcheck metrics: @@ -224,10 +224,9 @@ Healthcheck metrics: curl -fsS http://127.0.0.1:7300/metrics | grep -E 'healthcheck_(reference_height|target_height|height_difference)' ``` -On a brand-new `full` node, `eth_blockNumber` can stay at `0x0` for a while. -That is expected. During that window it is also normal for -`healthcheck_target_height` to stay at `0`. Use `optimism_syncStatus` and the -healthcheck metrics to confirm the node is moving forward during early sync. +After restoring a snapshot, `eth_blockNumber` starts at the snapshot height and +catches up to the chain head. Use `optimism_syncStatus` and the healthcheck +metrics to confirm the node is moving forward during catch-up. ### Open Grafana @@ -299,10 +298,10 @@ run: ./progress.sh ``` -On a brand-new `full` node, `./progress.sh` can return `Error: Not syncing` -while `eth_blockNumber` is still `0x0`. In that phase, use +Right after startup, `./progress.sh` can return `Error: Not syncing` until the +execution client starts importing blocks. In that phase, use `optimism_syncStatus` and the healthcheck metrics from the validation section, -then retry the script after the local block height starts moving. +then retry the script. If you do not want to install `cast`, use the RPC and metrics checks above instead. @@ -313,10 +312,11 @@ The `op-node` bootstrap and static peers for each network are already set in `envs//op-node.env`, so a clean checkout needs no manual peering setup. The values below are execution-layer peers and are **not** used by the current -stack: `op-geth` runs with `--maxpeers=0 --nodiscover`, because `op-node` runs -`--syncmode=consensus-layer` and payloads arrive over the Engine API. They are -recorded here as the reference for the `op-reth` migration described in -[Current Status](#current-status). +stack: `op-reth` runs with no peers and discovery disabled, because `op-node` +runs `--syncmode=consensus-layer` and payloads arrive over the Engine API. They +are recorded here as a reference if you want to enable `op-reth` P2P (remove +`--max-outbound-peers=0 --max-inbound-peers=0` and the `--disable-*-discovery` +flags in `scripts/start-op-reth.sh`). `op-reth` `--bootnodes`, both networks: @@ -344,11 +344,6 @@ enode://c2dd4ad2f3f5dd2e3d6c77acbb4f96a73d692f3172181caf457863bd9ac0645c4b709b98 ## Troubleshooting -### `bedrock-init` exits quickly on a full node - -That is expected. `full` nodes do not download a snapshot. If you want a -snapshot restore path, switch to `NODE_TYPE=archive`. - ### `bedrock-init` says `Bedrock node already initialized` That means the stack is reusing existing Docker volumes. This is expected on @@ -358,9 +353,10 @@ restarts. If you intentionally want a clean first-boot flow, wipe the volumes: docker compose down -v ``` -### `bedrock-init` takes a long time on an archive node +### `bedrock-init` takes a long time -That is expected while the snapshot is downloading and extracting. Check: +That is expected while the snapshot is downloading and extracting. Snapshots are +roughly 250-400 GB. Check: ```sh docker compose logs -f bedrock-init @@ -370,36 +366,51 @@ If image pulls or snapshot downloads fail, make sure the host can reach: - `docker.io` - `us-docker.pkg.dev` -- `ink.t.snapshots.gelato.cloud` -- `ink.snapshots.gelato.cloud` +- `snapshots.optimism.io` +- `*.r2.cloudflarestorage.com` (snapshot downloads redirect here) -Archive geth snapshots for the current stack are resolved from these indexes: +If `bedrock-init` exits with `Unexpected checksum file format`, +`Checksum file does not match downloaded archive`, or `SHA256 verification +failed`, do not reuse that download. Retry later or verify the checksum +yourself before attempting another restore. -- Sepolia: [https://ink.t.snapshots.gelato.cloud/index.html](https://ink.t.snapshots.gelato.cloud/index.html) -- Mainnet: [https://ink.snapshots.gelato.cloud/index.html](https://ink.snapshots.gelato.cloud/index.html) +### Snapshot sources -`bedrock-init` downloads the matching `.sha256` file and verifies the archive -before extraction. This is still a geth datadir path, not an `op-reth` -bootstrap flow. +Ink snapshots are published by Optimism at +[https://snapshots.optimism.io/](https://snapshots.optimism.io/). The former +Gelato ChainSnap indexes (`ink.snapshots.gelato.cloud` and +`ink.t.snapshots.gelato.cloud`) are retired. -At the time of this docs refresh, the Sepolia Ink Gelato index also exposes -`reth/full/datadir` artifacts, but the checked mainnet Ink index does not yet -show `reth` artifacts. This repository does not consume those `reth` snapshots -yet. +The service lists `op-reth` `full` and `archive` snapshots for both Ink +Mainnet (`ink-mainnet-0`) and Ink Sepolia (`ink-sepolia-0`). `bedrock-init` +downloads the latest snapshot matching `NODE_TYPE` from a stable "latest" +download pair: -If `bedrock-init` exits with `Failed to resolve latest snapshot` or -`Unexpected snapshot filename format`, the index is unreachable or its format -changed. Switch back to `NODE_TYPE=full` and retry, or pick a direct archive -from the index page and update the script before retrying. +``` +https://snapshots.optimism.io/api/snapshots//latest//archive +https://snapshots.optimism.io/api/snapshots//latest//checksum +``` -If `bedrock-init` exits with `Unexpected checksum file format`, -`Checksum file does not match downloaded archive`, or `SHA256 verification -failed`, do not reuse that download. Retry later or verify the checksum file -from the index page before attempting another restore. +For example, the latest Ink Sepolia full snapshot: -### `eth_blockNumber` stays at `0x0` right after startup +```sh +curl -LOJ https://snapshots.optimism.io/api/snapshots/ink-sepolia-0/latest/full/checksum +curl -LOJ https://snapshots.optimism.io/api/snapshots/ink-sepolia-0/latest/full/archive +sha256sum -c ink-sepolia-0-op-reth-full-*.tar.zst.sha256sum +``` + +Both endpoints redirect to a presigned Cloudflare R2 URL, so follow redirects. +Archives are `.tar.zst`, and the checksum file names the dated archive it +covers, so `-OJ` keeps the two filenames in sync. + +These are `op-reth` datadirs, so `bedrock-init` extracts them straight into +the `op_reth` volume. To be safe, do not mix `NODE_TYPE` values on one volume: wipe the +volumes before switching between `full` and `archive`. + +### `eth_blockNumber` looks stuck right after startup -That is normal for a fresh `full` node. Check the rollup node instead: +`op-reth` only advances once `op-node` is connected to L1 and sending payloads +over the Engine API. Check the rollup node: ```sh curl -fsS -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"optimism_syncStatus","params":[],"id":1}' http://127.0.0.1:9545 @@ -407,10 +418,28 @@ curl -fsS -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0"," ### `./progress.sh` says `Error: Not syncing` -That is expected during the earliest part of a fresh `full` node bootstrap. The -script samples `eth_blockNumber` twice over 10 seconds, so it cannot estimate -sync speed until the local execution client starts importing blocks. Use -`optimism_syncStatus` and the healthcheck metrics first, then retry later. +That is expected until the execution client starts importing blocks. The script +samples `eth_blockNumber` twice over 10 seconds, so it cannot estimate sync +speed before then. Use `optimism_syncStatus` and the healthcheck metrics first, +then retry later. + +### `op-node` logs L1 receipt errors, or `current_l1` is stuck + +After a snapshot restore, `op-node` fetches L1 receipts starting at the snapshot +date. Typical symptoms with an under-provisioned L1 RPC: + +- `receipt 0 has unexpected nil block number`: the provider does not serve + receipts for older blocks (seen with PublicNode on Ink Sepolia) +- `429 Too Many Requests`: the provider is rate limiting (seen with Tenderly's + public gateway) +- `Batch of more than 3 requests are not allowed`: the provider limits batch + size. Set `OP_NODE_L1_RPC_MAX_BATCH_SIZE=3` in `.env`. With dRPC's free plan + this unblocked derivation, but it still advanced only about 0.13 L1 blocks per + second against L1's 0.083 blocks per second of chain growth, so a multi-day + gap takes days to close + +Use a provider with receipt history and higher limits for the L1 execution RPC. +Progress is visible as `current_l1` rising in `optimism_syncStatus`. ### `op-node` cannot connect to L1 diff --git a/docker-compose.yml b/docker-compose.yml index 1174236..cc4f8d8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,28 +10,28 @@ services: ports: - ${PORT__HEALTHCHECK_METRICS:-7300}:7300 - op-geth: - image: us-docker.pkg.dev/oplabs-tools-artifacts/images/op-geth:v1.101503.4 + op-reth: + image: us-docker.pkg.dev/oplabs-tools-artifacts/images/op-reth:v2.6.0 restart: unless-stopped stop_grace_period: 5m - entrypoint: /scripts/start-op-geth.sh + entrypoint: /scripts/start-op-reth.sh env_file: - - ./envs/${NETWORK_NAME}/op-geth.env + - ./envs/${NETWORK_NAME}/op-reth.env - .env volumes: - ./scripts/:/scripts - shared:/shared - - op_geth:/geth + - op_reth:/reth ports: - - ${PORT__OP_GETH_HTTP:-9993}:8545 - - ${PORT__OP_GETH_WS:-9994}:8546 - - ${PORT__OP_GETH_P2P:-39393}:${PORT__OP_GETH_P2P:-39393}/udp - - ${PORT__OP_GETH_P2P:-39393}:${PORT__OP_GETH_P2P:-39393}/tcp + - ${PORT__OP_RETH_HTTP:-9993}:8545 + - ${PORT__OP_RETH_WS:-9994}:8546 + - ${PORT__OP_RETH_P2P:-39393}:${PORT__OP_RETH_P2P:-39393}/udp + - ${PORT__OP_RETH_P2P:-39393}:${PORT__OP_RETH_P2P:-39393}/tcp extra_hosts: - "host.docker.internal:host-gateway" op-node: - image: us-docker.pkg.dev/oplabs-tools-artifacts/images/op-node:v1.13.2 + image: us-docker.pkg.dev/oplabs-tools-artifacts/images/op-node:v1.19.8 restart: unless-stopped stop_grace_period: 5m entrypoint: /scripts/start-op-node.sh @@ -54,14 +54,13 @@ services: dockerfile: Dockerfile.bedrock-init entrypoint: /scripts/init-bedrock.sh env_file: - - ./envs/${NETWORK_NAME}/op-geth.env + - ./envs/${NETWORK_NAME}/op-reth.env - .env volumes: - ./scripts/:/scripts - shared:/shared - - op_geth:/geth - - geth:/legacy-geth - - torrent_downloads:/downloads + - op_reth:/reth + - snapshot_downloads:/downloads prometheus: image: prom/prometheus:${IMAGE_TAG__PROMETHEUS:-latest} @@ -86,22 +85,9 @@ services: ports: - ${PORT__GRAFANA:-3000}:3000 - influxdb: - image: influxdb:${IMAGE_TAG__INFLUXDB:-1.8} - restart: unless-stopped - env_file: - - ./envs/common/influxdb.env - volumes: - - ./docker/influxdb/influx_init.iql:/docker-entrypoint-initdb.d/influx_init.iql - - influxdb_data:/var/lib/influxdb - ports: - - ${PORT__INFLUXDB:-8086}:8086 - volumes: - geth: prometheus_data: grafana_data: - influxdb_data: shared: - op_geth: - torrent_downloads: + op_reth: + snapshot_downloads: diff --git a/docker/grafana/dashboards/simple_node_dashboard.json b/docker/grafana/dashboards/simple_node_dashboard.json index 71eebdd..e44783d 100644 --- a/docker/grafana/dashboards/simple_node_dashboard.json +++ b/docker/grafana/dashboards/simple_node_dashboard.json @@ -42,8 +42,8 @@ }, { "datasource": { - "type": "influxdb", - "uid": "4knV40nVb" + "type": "prometheus", + "uid": "6R74VAnVz" }, "description": "", "fieldConfig": { @@ -123,112 +123,22 @@ "pluginVersion": "7.5.5", "targets": [ { - "alias": "Unsafe Head", - "datasource": { - "type": "influxdb", - "uid": "4knV40nVb" - }, - "groupBy": [ - { - "params": ["$__interval"], - "type": "time" - }, - { - "params": ["null"], - "type": "fill" - } - ], - "hide": false, - "measurement": "geth.chain/head/block.gauge", - "orderByTime": "ASC", - "policy": "default", - "refId": "A", - "resultFormat": "time_series", - "select": [ - [ - { - "params": ["value"], - "type": "field" - }, - { - "params": [], - "type": "mean" - } - ] - ], - "tags": [] - }, - { - "alias": "Safe Head", "datasource": { - "type": "influxdb", - "uid": "4knV40nVb" + "type": "prometheus", + "uid": "6R74VAnVz" }, - "groupBy": [ - { - "params": ["$__interval"], - "type": "time" - }, - { - "params": ["null"], - "type": "fill" - } - ], - "hide": false, - "measurement": "geth.chain/head/safe.gauge", - "orderByTime": "ASC", - "policy": "default", - "refId": "B", - "resultFormat": "time_series", - "select": [ - [ - { - "params": ["value"], - "type": "field" - }, - { - "params": [], - "type": "mean" - } - ] - ], - "tags": [] + "expr": "healthcheck_target_height", + "legendFormat": "head", + "refId": "A" }, { - "alias": "Finalized Head", "datasource": { - "type": "influxdb", - "uid": "4knV40nVb" + "type": "prometheus", + "uid": "6R74VAnVz" }, - "groupBy": [ - { - "params": ["$__interval"], - "type": "time" - }, - { - "params": ["null"], - "type": "fill" - } - ], - "hide": false, - "measurement": "geth.chain/head/finalized.gauge", - "orderByTime": "ASC", - "policy": "default", - "refId": "C", - "resultFormat": "time_series", - "select": [ - [ - { - "params": ["value"], - "type": "field" - }, - { - "params": [], - "type": "mean" - } - ] - ], - "tags": [] + "expr": "reth_blockchain_tree_safe_block_height", + "legendFormat": "safe", + "refId": "B" } ], "title": "Node Block Height", @@ -392,7 +302,9 @@ "options": { "orientation": "auto", "reduceOptions": { - "calcs": ["lastNotNull"], + "calcs": [ + "lastNotNull" + ], "fields": "", "values": false }, @@ -486,7 +398,9 @@ "justifyMode": "auto", "orientation": "auto", "reduceOptions": { - "calcs": ["lastNotNull"], + "calcs": [ + "lastNotNull" + ], "fields": "", "values": false }, @@ -523,13 +437,13 @@ }, "id": 26, "panels": [], - "title": "Geth Performance", + "title": "Execution Client Performance", "type": "row" }, { "datasource": { - "type": "influxdb", - "uid": "4knV40nVb" + "type": "prometheus", + "uid": "6R74VAnVz" }, "fieldConfig": { "defaults": { @@ -581,7 +495,7 @@ } ] }, - "unit": "%" + "unit": "percentunit" }, "overrides": [] }, @@ -608,111 +522,13 @@ "pluginVersion": "7.5.5", "targets": [ { - "alias": "system", - "datasource": { - "type": "influxdb", - "uid": "4knV40nVb" - }, - "groupBy": [ - { - "params": ["$__interval"], - "type": "time" - }, - { - "params": ["null"], - "type": "fill" - } - ], - "measurement": "geth.system/cpu/sysload.gauge", - "orderByTime": "ASC", - "policy": "default", - "refId": "A", - "resultFormat": "time_series", - "select": [ - [ - { - "params": ["value"], - "type": "field" - }, - { - "params": [], - "type": "mean" - } - ] - ], - "tags": [] - }, - { - "alias": "geth", - "datasource": { - "type": "influxdb", - "uid": "4knV40nVb" - }, - "groupBy": [ - { - "params": ["$__interval"], - "type": "time" - }, - { - "params": ["null"], - "type": "fill" - } - ], - "hide": false, - "measurement": "geth.system/cpu/procload.gauge", - "orderByTime": "ASC", - "policy": "default", - "refId": "B", - "resultFormat": "time_series", - "select": [ - [ - { - "params": ["value"], - "type": "field" - }, - { - "params": [], - "type": "mean" - } - ] - ], - "tags": [] - }, - { - "alias": "IO", "datasource": { - "type": "influxdb", - "uid": "4knV40nVb" + "type": "prometheus", + "uid": "6R74VAnVz" }, - "groupBy": [ - { - "params": ["$__interval"], - "type": "time" - }, - { - "params": ["null"], - "type": "fill" - } - ], - "hide": false, - "measurement": "geth.system/cpu/syswait.gauge", - "orderByTime": "ASC", - "policy": "default", - "refId": "C", - "resultFormat": "time_series", - "select": [ - [ - { - "params": ["value"], - "type": "field" - }, - { - "params": [], - "type": "mean" - } - ] - ], - "tags": [] + "expr": "rate(reth_process_cpu_seconds_total[1m])", + "legendFormat": "process", + "refId": "A" } ], "title": "CPU", @@ -720,8 +536,8 @@ }, { "datasource": { - "type": "influxdb", - "uid": "4knV40nVb" + "type": "prometheus", + "uid": "6R74VAnVz" }, "fieldConfig": { "defaults": { @@ -800,75 +616,22 @@ "pluginVersion": "7.5.5", "targets": [ { - "alias": "used", "datasource": { - "type": "influxdb", - "uid": "4knV40nVb" + "type": "prometheus", + "uid": "6R74VAnVz" }, - "groupBy": [ - { - "params": ["$__interval"], - "type": "time" - }, - { - "params": ["null"], - "type": "fill" - } - ], - "measurement": "geth.system/memory/used.gauge", - "orderByTime": "ASC", - "policy": "default", - "refId": "A", - "resultFormat": "time_series", - "select": [ - [ - { - "params": ["value"], - "type": "field" - }, - { - "params": [], - "type": "mean" - } - ] - ], - "tags": [] + "expr": "reth_jemalloc_resident", + "legendFormat": "resident", + "refId": "A" }, { - "alias": "held", "datasource": { - "type": "influxdb", - "uid": "4knV40nVb" + "type": "prometheus", + "uid": "6R74VAnVz" }, - "groupBy": [ - { - "params": ["$__interval"], - "type": "time" - }, - { - "params": ["null"], - "type": "fill" - } - ], - "hide": false, - "measurement": "geth.system/memory/held.gauge", - "orderByTime": "ASC", - "policy": "default", - "refId": "B", - "resultFormat": "time_series", - "select": [ - [ - { - "params": ["value"], - "type": "field" - }, - { - "params": [], - "type": "mean" - } - ] - ], - "tags": [] + "expr": "reth_jemalloc_allocated", + "legendFormat": "allocated", + "refId": "B" } ], "title": "Memory", @@ -876,8 +639,8 @@ }, { "datasource": { - "type": "influxdb", - "uid": "4knV40nVb" + "type": "prometheus", + "uid": "6R74VAnVz" }, "fieldConfig": { "defaults": { @@ -956,77 +719,22 @@ "pluginVersion": "7.5.5", "targets": [ { - "alias": "read", "datasource": { - "type": "influxdb", - "uid": "4knV40nVb" + "type": "prometheus", + "uid": "6R74VAnVz" }, - "groupBy": [ - { - "params": ["$__interval"], - "type": "time" - }, - { - "params": ["null"], - "type": "fill" - } - ], - "measurement": "geth.system/disk/readdata.meter", - "orderByTime": "ASC", - "policy": "default", - "refId": "A", - "resultFormat": "time_series", - "select": [ - [ - { - "params": ["m1"], - "type": "field" - }, - { - "params": [], - "type": "mean" - } - ] - ], - "tags": [] + "expr": "rate(reth_io_read_bytes[1m])", + "legendFormat": "read", + "refId": "A" }, { - "alias": "write", "datasource": { - "type": "influxdb", - "uid": "4knV40nVb" + "type": "prometheus", + "uid": "6R74VAnVz" }, - "groupBy": [ - { - "params": ["$__interval"], - "type": "time" - }, - { - "params": ["null"], - "type": "fill" - } - ], - "hide": false, - "measurement": "geth.system/disk/writedata.meter", - "orderByTime": "ASC", - "policy": "default", - "query": "SELECT mean(\"m1\") FROM \"geth.system/disk/writedata.meter\" WHERE $timeFilter GROUP BY time($__interval) fill(null)", - "rawQuery": false, - "refId": "B", - "resultFormat": "time_series", - "select": [ - [ - { - "params": ["m1"], - "type": "field" - }, - { - "params": [], - "type": "mean" - } - ] - ], - "tags": [] + "expr": "rate(reth_io_write_bytes[1m])", + "legendFormat": "write", + "refId": "B" } ], "title": "Disk", @@ -1048,6 +756,6 @@ "timezone": "", "title": "Simple Node Dashboard", "uid": "fNH7uZ97k", - "version": 3, + "version": 4, "weekStart": "" } diff --git a/docker/grafana/provisioning/datasources/all.yml b/docker/grafana/provisioning/datasources/all.yml index 01ae218..e1e741f 100644 --- a/docker/grafana/provisioning/datasources/all.yml +++ b/docker/grafana/provisioning/datasources/all.yml @@ -3,6 +3,7 @@ apiVersion: 1 deleteDatasources: - name: "Prometheus" - name: "InfluxDB" + - name: "InfluxDB (op-geth)" datasources: - access: "proxy" @@ -14,13 +15,3 @@ datasources: type: "prometheus" url: "http://prometheus:9090" version: 1 - - access: "proxy" - editable: true - is_default: false - name: "InfluxDB (op-geth)" - uid: "4knV40nVb" - org_id: 1 - type: "influxdb" - database: "opgeth" - url: "http://influxdb:8086" - version: 1 diff --git a/docker/influxdb/influx_init.iql b/docker/influxdb/influx_init.iql deleted file mode 100644 index b76f092..0000000 --- a/docker/influxdb/influx_init.iql +++ /dev/null @@ -1 +0,0 @@ -CREATE DATABASE "opgeth" diff --git a/docker/prometheus/prometheus.yml b/docker/prometheus/prometheus.yml index 7fe1256..040e7bd 100644 --- a/docker/prometheus/prometheus.yml +++ b/docker/prometheus/prometheus.yml @@ -10,3 +10,8 @@ scrape_configs: - job_name: 'op-node' static_configs: - targets: ['op-node:7300'] + + - job_name: 'op-reth' + metrics_path: /metrics + static_configs: + - targets: ['op-reth:9001'] diff --git a/envs/common/healthcheck.env b/envs/common/healthcheck.env index 05317a1..c6a3890 100644 --- a/envs/common/healthcheck.env +++ b/envs/common/healthcheck.env @@ -1 +1 @@ -HEALTHCHECK__TARGET_RPC_PROVIDER=http://op-geth:8545 +HEALTHCHECK__TARGET_RPC_PROVIDER=http://op-reth:8545 diff --git a/envs/common/influxdb.env b/envs/common/influxdb.env deleted file mode 100644 index e21b086..0000000 --- a/envs/common/influxdb.env +++ /dev/null @@ -1 +0,0 @@ -INFLUXDB_HTTP_AUTH_ENABLED=false diff --git a/envs/ink-mainnet/op-node.env b/envs/ink-mainnet/op-node.env index 522d0f3..76d1d47 100644 --- a/envs/ink-mainnet/op-node.env +++ b/envs/ink-mainnet/op-node.env @@ -1,3 +1,2 @@ OP_NODE_P2P_BOOTNODES="enode://92534205dd72a8787df902c89a775d9a45882739a973a7030d4d338c9b65387cfb77629907f9b6afb4e2bd98d9e6d2ccfde02d8a968b4fbccb68f0f4db5f4d83@34.13.199.202:30305?discport=30305,enode://26b0306725a78a8d193c2074bfd9e71233dbd3b75ab74be0ab555f72865fd88a285774526243f36653844eb95d62108c35f8c2723656b2c9568716ee2463f8d7@34.7.48.80:30305?discport=30305,enode://0c7bbb6bca9ce80952d8d8f8ba966e6b9e80faf75a165f320a53722f32b51c4b1da16ba59ab14f5194e51095a2755d8d3086a0220e34d88729cc8f4cc5499116@35.204.27.165:30305?discport=30305,enode://869d07b5932f17e8490990f75a3f94195e9504ddb6b85f7189e5a9c0a8fff8b00aecf6f3ac450ecba6cdabdb5858788a94bde2b613e0f2d82e9b395355f76d1a@34.65.67.101:30305?discport=30305,enode://2d4e7e9d48f4dd4efe9342706dd1b0024681bd4c3300d021f86fc75eab7865d4e0cbec6fbc883f011cfd6a57423e7e2f6e104baad2b744c3cafaec6bc7dc92c1@34.65.43.171:30305?discport=30305,enode://9d7a3efefe442351217e73b3a593bcb8efffb55b4807699972145324eab5e6b382152f8d24f6301baebbfb5ecd4127bd3faab2842c04cd432bdf50ba092f6645@34.65.109.126:30305?discport=30305" OP_NODE_P2P_STATIC="/ip4/34.6.118.237/tcp/9003/p2p/16Uiu2HAmKjbznKezrhsXMXVT3tSwviv8jojmfLeY9Zd53VvLmGsn,/ip4/34.178.43.233/tcp/9003/p2p/16Uiu2HAm27U7EgvM6C7N2Y3152ysiEd7K3YGXVzZ2ypsnu5ZE4cY,/ip4/34.6.162.247/tcp/9003/p2p/16Uiu2HAmDhreSpDkx8F78jiJPRV9Npm6VoNB2trgNBNWBreLsBmH" -OP_NODE_ROLLUP_LOAD_PROTOCOL_VERSIONS=true diff --git a/envs/ink-mainnet/op-geth.env b/envs/ink-mainnet/op-reth.env similarity index 71% rename from envs/ink-mainnet/op-geth.env rename to envs/ink-mainnet/op-reth.env index 79e29c6..ebe99a0 100644 --- a/envs/ink-mainnet/op-geth.env +++ b/envs/ink-mainnet/op-reth.env @@ -1,2 +1,2 @@ BEDROCK_SEQUENCER_HTTP=https://rpc-gel.inkonchain.com -BEDROCK_DATADIR=/geth +BEDROCK_DATADIR=/reth diff --git a/envs/ink-sepolia/op-node.env b/envs/ink-sepolia/op-node.env index 6714314..4fc2fd5 100644 --- a/envs/ink-sepolia/op-node.env +++ b/envs/ink-sepolia/op-node.env @@ -1,3 +1,2 @@ OP_NODE_P2P_BOOTNODES="enode://410e7729ff4edd1b913efee100a20fed51a2bf0b5b1e0dde4dd66506d0f5cd1dd8a4bef566219d1fe4577174acc656c47186bed389991de629efa8664d0e1150@34.7.113.144:30305?discport=30305,enode://dbbcefd1b8c57c402cf4db35005b1125a42293457f67965d3c0f8370350f3667c8c9d840f820b37abebc2b17bba3cb46ae80d4306e2020cdac417dcc5ca653bd@34.158.168.67:30305?discport=30305,enode://42445d7a71c2519492bd355ab08859c9e24b52dcc330a2672561cce944714ecb94c15861a31a8624808011651662d46a5d82f0d932f2fce96c94615b2259020f@34.178.218.241:30305?discport=30305,enode://869d07b5932f17e8490990f75a3f94195e9504ddb6b85f7189e5a9c0a8fff8b00aecf6f3ac450ecba6cdabdb5858788a94bde2b613e0f2d82e9b395355f76d1a@34.65.67.101:30305?discport=30305,enode://2d4e7e9d48f4dd4efe9342706dd1b0024681bd4c3300d021f86fc75eab7865d4e0cbec6fbc883f011cfd6a57423e7e2f6e104baad2b744c3cafaec6bc7dc92c1@34.65.43.171:30305?discport=30305" OP_NODE_P2P_STATIC="/ip4/34.90.221.85/tcp/9003/p2p/16Uiu2HAmMLp2HvyuJt3eWgGRvsxAiT2ThP6CvyyNscjm7xAgL1xH,/ip4/34.178.231.114/tcp/9003/p2p/16Uiu2HAmL2D9SnbBxd9v5ATrchRp5cbJvAvK4JBwbm86sCs5TB15,/ip4/34.13.232.240/tcp/9003/p2p/16Uiu2HAm4QD8iwJPt2KCMy2LkkXcvNiBm4RrkUNwNyMNumdKaYL4" -OP_NODE_ROLLUP_LOAD_PROTOCOL_VERSIONS=true diff --git a/envs/ink-sepolia/op-geth.env b/envs/ink-sepolia/op-reth.env similarity index 73% rename from envs/ink-sepolia/op-geth.env rename to envs/ink-sepolia/op-reth.env index 10cd532..fee45d6 100644 --- a/envs/ink-sepolia/op-geth.env +++ b/envs/ink-sepolia/op-reth.env @@ -1,2 +1,2 @@ BEDROCK_SEQUENCER_HTTP=https://rpc-gel-sepolia.inkonchain.com -BEDROCK_DATADIR=/geth +BEDROCK_DATADIR=/reth diff --git a/progress.sh b/progress.sh index 204d9ab..03d28d1 100755 --- a/progress.sh +++ b/progress.sh @@ -15,7 +15,7 @@ if [ -f .env ]; then fi # Set default RPC URL with error checking -export ETH_RPC_URL=${ETH_RPC_URL:-http://localhost:${PORT__OP_GETH_HTTP:-9993}} +export ETH_RPC_URL=${ETH_RPC_URL:-http://localhost:${PORT__OP_RETH_HTTP:-9993}} [ -z "$ETH_RPC_URL" ] && error_exit "ETH_RPC_URL is not set" # Get chain ID with error handling diff --git a/scripts/init-bedrock.sh b/scripts/init-bedrock.sh index 6b47cf0..263d866 100755 --- a/scripts/init-bedrock.sh +++ b/scripts/init-bedrock.sh @@ -7,61 +7,20 @@ source ./scripts/utils.sh # Common variables. INITIALIZED_FLAG=/shared/initialized.txt BEDROCK_JWT_PATH=/shared/jwt.txt -GETH_DATA_DIR=$BEDROCK_DATADIR -TORRENTS_DIR=/torrents/$NETWORK_NAME -BEDROCK_TAR_PATH=/downloads/bedrock.tar -BEDROCK_TAR_CHECKSUM_PATH= -BEDROCK_TMP_PATH=/bedrock-tmp +RETH_DATA_DIR=$BEDROCK_DATADIR +SNAPSHOT_PATH=/downloads/snapshot.tar.zst +SNAPSHOT_CHECKSUM_PATH=/downloads/snapshot.tar.zst.sha256 +SNAPSHOTS_BASE_URL="https://snapshots.optimism.io/api/snapshots" function validate_snapshot_filename() { local snapshot_filename="$1" - if [[ -z "$snapshot_filename" ]]; then - echo "Snapshot filename lookup returned an empty response" >&2 - exit 1 - fi - - if [[ ! "$snapshot_filename" =~ ^[A-Za-z0-9._-]+\.tar(\.zst|\.lz4)?$ ]]; then + if [[ ! "$snapshot_filename" =~ ^[A-Za-z0-9._-]+\.tar\.zst$ ]]; then echo "Unexpected snapshot filename format: $snapshot_filename" >&2 exit 1 fi } -function resolve_latest_snapshot_filename() { - local index_url="$1" - local filename_regex="$2" - local snapshot_filename - - snapshot_filename="$( - curl -fsS "$index_url" | python3 -c ' -import re -import sys - -filename_pattern = re.compile(sys.argv[1]) -timestamp_pattern = re.compile(r"-(\d+)\.tar(?:\.(?:zst|lz4))?$") -content = sys.stdin.read() - -matches = sorted( - {match.group(0) for match in filename_pattern.finditer(content)}, - key=lambda name: int(timestamp_pattern.search(name).group(1)), - reverse=True, -) - -if not matches: - print("No matching snapshot files found in index", file=sys.stderr) - sys.exit(1) - -print(matches[0]) -' "$filename_regex" - )" || { - echo "Failed to resolve latest snapshot from $index_url" >&2 - exit 1 - } - - validate_snapshot_filename "$snapshot_filename" - echo "$snapshot_filename" -} - # Exit early if we've already initialized. if [ -e "$INITIALIZED_FLAG" ]; then echo "Bedrock node already initialized" @@ -71,58 +30,46 @@ fi echo "Bedrock node needs to be initialized..." echo "Initializing via download..." -# Resolve the latest archival geth datadir snapshot from the ChainSnap indexes. -echo "Fetching download link..." - -if [ "$NODE_TYPE" = "archive" ]; then - if [ "$NETWORK_NAME" = "ink-sepolia" ]; then - SNAPSHOT_FILENAME="$(resolve_latest_snapshot_filename \ - "https://ink.t.snapshots.gelato.cloud/index.html" \ - 'ink-sepolia-geth-archival-datadir-[0-9]+-[0-9]+\.tar(?:\.(?:zst|lz4))?')" - BEDROCK_TAR_DOWNLOAD="https://ink.t.snapshots.gelato.cloud/geth/archival/datadir/$SNAPSHOT_FILENAME" - echo "Using snapshot file: $SNAPSHOT_FILENAME" - elif [ "$NETWORK_NAME" = "ink-mainnet" ]; then - SNAPSHOT_FILENAME="$(resolve_latest_snapshot_filename \ - "https://ink.snapshots.gelato.cloud/index.html" \ - 'ink-geth-archival-datadir-[0-9]+-[0-9]+\.tar(?:\.(?:zst|lz4))?')" - BEDROCK_TAR_DOWNLOAD="https://ink.snapshots.gelato.cloud/geth/archival/datadir/$SNAPSHOT_FILENAME" - echo "Using snapshot file: $SNAPSHOT_FILENAME" - else - echo "Unsupported archive network: $NETWORK_NAME" >&2 +# Resolve the latest op-reth snapshot published at https://snapshots.optimism.io/ +# for this network. Snapshot networks are named -0. +case "$NODE_TYPE" in + full | archive) ;; + *) + echo "Unsupported NODE_TYPE: $NODE_TYPE (expected full or archive)" >&2 exit 1 - fi -fi + ;; +esac -if [ -n "$BEDROCK_TAR_DOWNLOAD" ]; then - if [[ "$BEDROCK_TAR_DOWNLOAD" == *.zst ]]; then - BEDROCK_TAR_PATH+=".zst" - elif [[ "$BEDROCK_TAR_DOWNLOAD" == *.lz4 ]]; then - BEDROCK_TAR_PATH+=".lz4" - fi - BEDROCK_TAR_CHECKSUM_PATH="${BEDROCK_TAR_PATH}.sha256" +case "$NETWORK_NAME" in + ink-mainnet | ink-sepolia) ;; + *) + echo "Unsupported network: $NETWORK_NAME" >&2 + exit 1 + ;; +esac - echo "Downloading bedrock.tar checksum..." - curl -fsS "$BEDROCK_TAR_DOWNLOAD.sha256" -o "$BEDROCK_TAR_CHECKSUM_PATH" +SNAPSHOT_URL="$SNAPSHOTS_BASE_URL/$NETWORK_NAME-0/latest/$NODE_TYPE" - echo "Downloading bedrock.tar..." - download "$BEDROCK_TAR_DOWNLOAD" "$BEDROCK_TAR_PATH" +echo "Downloading snapshot checksum..." +curl -fsSL "$SNAPSHOT_URL/checksum" -o "$SNAPSHOT_CHECKSUM_PATH" - echo "Verifying bedrock.tar checksum..." - verify_sha256_checksum "$BEDROCK_TAR_PATH" "$BEDROCK_TAR_CHECKSUM_PATH" "$SNAPSHOT_FILENAME" +# The checksum file is " ". +read -r _ SNAPSHOT_FILENAME _ < "$SNAPSHOT_CHECKSUM_PATH" +validate_snapshot_filename "$SNAPSHOT_FILENAME" +echo "Using snapshot file: $SNAPSHOT_FILENAME" - echo "Extracting bedrock.tar..." - if [[ "$BEDROCK_TAR_DOWNLOAD" == *.zst ]]; then - extractzst "$BEDROCK_TAR_PATH" "$GETH_DATA_DIR" - elif [[ "$BEDROCK_TAR_DOWNLOAD" == *.lz4 ]]; then - extractlz4 "$BEDROCK_TAR_PATH" "$GETH_DATA_DIR" - else - extract "$BEDROCK_TAR_PATH" "$GETH_DATA_DIR" - fi +echo "Downloading snapshot..." +download "$SNAPSHOT_URL/archive" "$SNAPSHOT_PATH" - # Remove tar file to save disk space - rm "$BEDROCK_TAR_PATH" - rm "$BEDROCK_TAR_CHECKSUM_PATH" -fi +echo "Verifying snapshot checksum..." +verify_sha256_checksum "$SNAPSHOT_PATH" "$SNAPSHOT_CHECKSUM_PATH" "$SNAPSHOT_FILENAME" + +echo "Extracting snapshot..." +extractzst "$SNAPSHOT_PATH" "$RETH_DATA_DIR" + +# Remove downloaded files to save disk space +rm "$SNAPSHOT_PATH" +rm "$SNAPSHOT_CHECKSUM_PATH" echo "Creating JWT..." mkdir -p "$(dirname "$BEDROCK_JWT_PATH")" diff --git a/scripts/start-op-geth.sh b/scripts/start-op-geth.sh deleted file mode 100755 index e18145b..0000000 --- a/scripts/start-op-geth.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/sh -set -e - -# Wait for the Bedrock flag for this network to be set. -echo "Waiting for Bedrock node to initialize..." -while [ ! -f /shared/initialized.txt ]; do - sleep 1 -done - -# Override Holocene -if [ ! -z "$OVERRIDE_HOLOCENE" ]; then - EXTENDED_ARG="$EXTENDED_ARG --override.holocene=$OVERRIDE_HOLOCENE" -fi - -# Start op-geth. -exec geth \ - --op-network=$NETWORK_NAME \ - --datadir="$BEDROCK_DATADIR" \ - --http \ - --http.corsdomain="*" \ - --http.vhosts="*" \ - --http.addr=0.0.0.0 \ - --http.port=8545 \ - --http.api=eth,engine,web3,debug,net \ - --metrics \ - --metrics.influxdb \ - --metrics.influxdb.endpoint=http://influxdb:8086 \ - --metrics.influxdb.database=opgeth \ - --authrpc.vhosts="*" \ - --authrpc.addr=0.0.0.0 \ - --authrpc.port=8551 \ - --authrpc.jwtsecret=/shared/jwt.txt \ - --rollup.sequencerhttp="$BEDROCK_SEQUENCER_HTTP" \ - --rollup.disabletxpoolgossip=true \ - --port="${PORT__OP_GETH_P2P:-39393}" \ - --discovery.port="${PORT__OP_GETH_P2P:-39393}" \ - --db.engine=pebble \ - --state.scheme=hash \ - --txlookuplimit=0 \ - --history.state=0 \ - --history.transactions=0 \ - --txpool.pricebump=10 \ - --txpool.lifetime=12h0m0s \ - --rpc.txfeecap=4 \ - --rpc.evmtimeout=0 \ - --maxpeers=0 \ - --nodiscover \ - --gpo.percentile=60 \ - --verbosity=3 \ - --syncmode="full" \ - --gcmode="$NODE_TYPE" \ - $EXTENDED_ARG $@ diff --git a/scripts/start-op-node.sh b/scripts/start-op-node.sh index 7ccd477..572e985 100755 --- a/scripts/start-op-node.sh +++ b/scripts/start-op-node.sh @@ -13,7 +13,7 @@ P2P_PORT="9003" L1_RPC_ENDPOINT="$OP_NODE__RPC_ENDPOINT" L1_BEACON_ENDPOINT="$OP_NODE__L1_BEACON" L1_RPC_TYPE="$OP_NODE__RPC_TYPE" -export EXTENDED_ARG="${EXTENDED_ARG:-} --network=$NETWORK_NAME --rollup.load-protocol-versions=true --rollup.halt=major" +export EXTENDED_ARG="${EXTENDED_ARG:-} --network=$NETWORK_NAME" # Override Holocene if [ ! -z "$OVERRIDE_HOLOCENE" ]; then @@ -26,7 +26,7 @@ unset OP_NODE__RPC_ENDPOINT OP_NODE__L1_BEACON OP_NODE__RPC_TYPE # Start op-node. exec op-node \ --l1="$L1_RPC_ENDPOINT" \ - --l2=http://op-geth:8551 \ + --l2=http://op-reth:8551 \ --rpc.addr=0.0.0.0 \ --rpc.port=9545 \ --l2.jwt-secret=/shared/jwt.txt \ diff --git a/scripts/start-op-reth.sh b/scripts/start-op-reth.sh new file mode 100755 index 0000000..d28a6c9 --- /dev/null +++ b/scripts/start-op-reth.sh @@ -0,0 +1,54 @@ +#!/bin/sh +set -e + +# Wait for the Bedrock flag for this network to be set. +echo "Waiting for Bedrock node to initialize..." +while [ ! -f /shared/initialized.txt ]; do + sleep 1 +done + +# op-reth selects the network by chain name rather than the op-node/op-geth +# network name. +case "$NETWORK_NAME" in + ink-mainnet) RETH_CHAIN="ink" ;; + ink-sepolia) RETH_CHAIN="ink-sepolia" ;; + *) + echo "Unsupported network: $NETWORK_NAME" >&2 + exit 1 + ;; +esac + +# op-reth keeps full history by default. "full" prunes old state. +if [ "$NODE_TYPE" = "full" ]; then + EXTENDED_ARG="$EXTENDED_ARG --full" +fi + +# Start op-reth. +exec op-reth node \ + --chain="$RETH_CHAIN" \ + --datadir="$BEDROCK_DATADIR" \ + --http \ + --http.corsdomain="*" \ + --http.addr=0.0.0.0 \ + --http.port=8545 \ + --http.api=eth,web3,debug,net \ + --ws \ + --ws.addr=0.0.0.0 \ + --ws.port=8546 \ + --ws.api=eth,web3,net \ + --metrics=0.0.0.0:9001 \ + --authrpc.addr=0.0.0.0 \ + --authrpc.port=8551 \ + --authrpc.jwtsecret=/shared/jwt.txt \ + --rollup.sequencer="$BEDROCK_SEQUENCER_HTTP" \ + --rollup.disable-tx-pool-gossip \ + --port="${PORT__OP_RETH_P2P:-39393}" \ + --discovery.port="${PORT__OP_RETH_P2P:-39393}" \ + --max-outbound-peers=0 \ + --max-inbound-peers=0 \ + --disable-discv4-discovery \ + --disable-discv5-discovery \ + --disable-dns-discovery \ + --txpool.pricebump=10 \ + --rpc.txfeecap=4 \ + $EXTENDED_ARG $@