Skip to content

feat(reth): harden morph-reth runtime, snapshots, submodules, and CI for production - #177

Open
panos-xyz wants to merge 3 commits into
mainfrom
fix/reth-production-readiness
Open

panos-xyz wants to merge 3 commits into
mainfrom
fix/reth-production-readiness

Conversation

@panos-xyz

Copy link
Copy Markdown
Contributor

Summary

Prepares run-morph-node for migrating Morph's execution layer from go-ethereum to morph-reth by resolving P0 runtime/compatibility blockers, closing geth/reth operational parity gaps, and adding CI validation.

P0 — Blockers Fixed

  • Docker bind-mount permissions (docker-compose.reth.yml, Makefile): The published ghcr.io/morph-l2/morph-reth image runs as non-root USER morph-reth, which fails with Permission denied on host bind mounts (/db) on Linux. Added user: "${RETH_UID:-0}:${RETH_GID:-0}" in docker-compose.reth.yml and pass RETH_UID=$(id -u) RETH_GID=$(id -g) from Makefile reth targets so the container matches host directory ownership.
  • Stale git submodules for binary builds (.gitmodules, morph, go-ethereum, morph-reth): Updated morph submodule from v0.6.3 (pre-Celadon / missing MorphTx v2) to v0.6.5 (c6f1e14f), go-ethereum from morph-v2.2.6 to morph-v2.2.8 (1c528b35), and registered morph-reth as a git submodule pinned at v1.5.0 (c25b9a37) instead of cloning an untracked repo into the working tree.
  • Outdated default snapshots & broken Mainnet Beacon RPC (.env, .env_hoodi): Updated default Mainnet/Hoodi geth & reth snapshots and heights to the latest entries in README.md (20261117-1 / 20261115-1). Replaced the invalid Mainnet L1_BEACON_CHAIN_RPC (https://rpc.ankr.com/eth, an EL RPC) with a real Beacon REST API default (https://ethereum-beacon-api.publicnode.com), and provided working public Hoodi EL/CL defaults.
  • Safe geth -> reth migration & snapshot replacement (Makefile, README.md): setup-snapshot-data-reth (and setup-snapshot-data) now validate the extracted tarball layout and replace existing node-data/data/* and stale reth-data/ members (including historical-proofs) cleanly instead of failing mid-way with Directory not empty. Added a dedicated Migrating from geth to morph-reth section covering both in-place cutover and side-by-side shadow runs.

P1 — Parity & Config Completeness

  • Configurable entrypoint-reth.sh & upcoming morph_ RPC gating (PR #241): Added --ipcdisable, LOG_DIR=/db/logs, RETH_HTTP_API / RETH_WS_API (default web3,debug,eth,txpool,net,trace, with upgrade guidance to append ,morph once upgrading past v1.5.0), RETH_LOG_FILTER, RETH_EXTRA_FLAGS, and optional RETH_PROOFS_HISTORY=true (with post-Jade DB guard and idempotent morph-reth proofs init).
  • Binary workflow & version governance (Makefile, .gitignore): Added download-reth-binary (downloads official Linux x86_64/aarch64 GitHub Release tarballs with SHA-256 verification), tightened build-reth to use cargo build --profile profiling --locked --bin morph-reth with version-aware rebuild checks, fixed set-versions to keep both compose files, all submodules, Makefile, and README.md in sync, and gitignored .geth.pid / .reth.pid / .node.pid.
  • Reth validator targets & custom RETH_HOME support (Makefile): Added run-reth-validator, run-hoodi-reth-validator, stop-reth-validator, rm-reth-validator, and -binary variants. Captured MORPH_HOME_* / RETH_HOME_* via := and removed hardcoded ../mainnet / ../hoodi paths across quickstart, download, and clean targets, with automatic config/static-nodes bootstrap and mkdir -p for generate-jwt.
  • Complete clean-*-reth & graceful binary lifecycle (Makefile, run-binary-reth.sh): Expanded clean-*-reth to remove historical-proofs, exex, blobstore, txpool-transactions-backup.rlp, known-peers.json, invalid_block_hooks, and logs. Hardened run-binary-reth.sh & stop-binary to stop morphnode before morph-reth and wait for clean exit, increased readiness timeout to 120s (RETH_READY_TIMEOUT), removed hard nc dependency, fixed absolute path env sourcing and non-zero timeout exit code.

P2 — Operational Hardening, Static Assets, CI & Docs

  • Docker Compose v2 & runtime hardening (docker-compose.reth.yml, Makefile): Auto-detect docker compose v2 (falling back to docker-compose), switched run-* targets from background & to detached up -d, added ulimits.nofile=65535, pure-bash TCP healthcheck on port 8551, configurable ports (RETH_RPC_PORT, RETH_WS_PORT, RETH_METRICS_PORT, RETH_P2P_PORT) and container names, and Compose service DNS (http://reth:8545 / http://reth:8551).
  • Snapshot integrity & resume (Makefile): Added wget -c resumable downloads, automatic .sha256 checksum verification (bypassable via SKIP_SHA256_CHECK=1), and pigz multi-core extraction when available.
  • Refreshed static assets & CI (.github/workflows/ci.yml, genesis.json, data.zip, README.md): Updated mainnet/geth-data/genesis.json & hoodi/geth-data/genesis.json with celadonTime and maxTxPayloadBytesPerBlock: 737280, rebuilt mainnet/data.zip & hoodi/data.zip without .DS_Store/__MACOSX and with current configs + reth-data/, added GitHub Actions CI (sh -n, shellcheck, docker compose config, make -n, JSON/version/snapshot/data.zip consistency), and updated README.md (removed outdated internal-testing disclaimer, documented x86-64-v3 + pclmulqdq CPU baseline and reference-index pruning constraints).

Test Plan

  • sh -n and dash -n syntax checks on all morph-node/*.sh scripts
  • make -C morph-node -n dry-run verification across all reth/geth targets
  • Functional tests of entrypoint-reth.sh (default flags, RETH_PROOFS_HISTORY=true empty-DB rejection & post-Jade proofs init, RETH_EXTRA_FLAGS, empty static-nodes.json)
  • Functional tests of run-binary-reth.sh (graceful stop order morphnode -> morph-reth, clean PID removal, timeout exit code 1) and make stop-binary
  • Functional migration test of setup-snapshot-data-reth over existing geth node-data/data + stale historical-proofs in a custom RETH_HOME
  • Verified all 25 CLI flags emitted by entrypoint-reth.sh against the compiled morph-reth binary
  • Verified live .sha256 formats and public Mainnet/Hoodi L1 Beacon endpoints
  • GitHub Actions CI workflow validation on this PR

panos-xyz and others added 3 commits December 1, 2026 02:09
…up, and docs

- Run node (both compose files) and geth containers with host UID:GID via Makefile
  (RETH_UID/RETH_GID and MORPH_UID/MORPH_GID, falling back to 0:0) and pre-create
  bind-mount dirs so Linux clean/migration/binary-switch never hits Permission denied.
- Clean morphnode's LevelDB store (node-data/node-data) and node.log/reth.toml in
  clean-* and setup-snapshot-data* so restored snapshots honor configured L1 heights.
- Harden run-binary.sh to match run-binary-reth.sh (set -eu, absolute env paths,
  120s GETH_READY_TIMEOUT, portable TCP probe without nc, stop morphnode before
  geth with wait, non-zero exit on timeout).
- Preserve caller environment overrides in run-binary.sh and run-binary-reth.sh
  (matching docker compose --env-file precedence), detect unexpected child crashes
  instead of hanging, and display exact reth log path (logs/<chain_id>/reth.log).
- Switch quickstart-* Docker targets from 'up node' to 'up' so Ctrl+C stops both
  execution client and node cleanly; capture per-network RETH_CONTAINER_NAME for
  stop-reth-node / stop-hoodi-reth-node; fix set-versions RETH_VERSION origin check.
- Document geth binary mode and bootstrap-safe side-by-side shadow run in README.md.
`morph-reth proofs init` copies the full state at the current tip and can
take far longer than the 120s engine-RPC readiness timeout on mainnet.
Because the entrypoint ran it in the foreground without a signal handler,
stopping during init orphaned the init process (PPID 1) while it kept
writing the proof DB, so a following start could run a second init against
the same MDBX.

- entrypoint-reth.sh: run `proofs init` in the background, forward
  SIGTERM/SIGINT to it, and exit 143/130 (or the init exit code) instead of
  launching the node. As PID 1 in Docker this also makes `docker stop`
  interrupt init instead of waiting for SIGKILL.
- run-binary-reth.sh: default to no readiness timeout when
  RETH_PROOFS_HISTORY=true (RETH_READY_TIMEOUT=0 means unlimited), reject
  non-numeric values, and print a waiting heartbeat. Crash detection is
  unchanged.
- Document the behaviour and the resumability constraints in README and
  .env/.env_hoodi.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant