From 25bdad4a422dd3dc92588593c91e61551fb376f2 Mon Sep 17 00:00:00 2001 From: panos Date: Tue, 1 Dec 2026 02:09:58 +0000 Subject: [PATCH 1/3] feat(reth): harden morph-reth runtime, snapshots, submodules, and CI for production --- .github/workflows/ci.yml | 152 +++++++++ .gitignore | 5 +- .gitmodules | 3 + README.md | 423 ++++++++++++------------ go-ethereum | 2 +- hoodi/data.zip | Bin 7653 -> 8319 bytes hoodi/geth-data/genesis.json | 3 +- mainnet/data.zip | Bin 10423 -> 9730 bytes mainnet/geth-data/genesis.json | 3 +- morph | 2 +- morph-node/.env | 66 +++- morph-node/.env_hoodi | 69 +++- morph-node/Makefile | 497 ++++++++++++++++++++--------- morph-node/docker-compose.reth.yml | 51 ++- morph-node/entrypoint-reth.sh | 63 +++- morph-node/run-binary-reth.sh | 175 +++++++--- morph-node/run-binary.sh | 8 +- morph-reth | 1 + 18 files changed, 1082 insertions(+), 441 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 160000 morph-reth diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c70bacc --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,152 @@ +name: CI + +on: + push: + branches: ["main"] + pull_request: + +permissions: + contents: read + +jobs: + validate: + name: Validate Scripts, Compose, and Config Consistency + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Check POSIX shell syntax + run: | + for f in morph-node/*.sh; do + echo "Checking syntax: $f" + sh -n "$f" + done + + - name: Run shellcheck + run: shellcheck -S warning morph-node/*.sh + + - name: Validate Docker Compose configs + run: | + docker compose -f morph-node/docker-compose.yml --env-file morph-node/.env config -q + docker compose -f morph-node/docker-compose.yml --env-file morph-node/.env_hoodi config -q + docker compose -f morph-node/docker-compose.reth.yml --env-file morph-node/.env config -q + docker compose -f morph-node/docker-compose.reth.yml --env-file morph-node/.env_hoodi config -q + + - name: Dry-run Makefile targets + run: | + make -C morph-node -n generate-jwt generate-jwt-hoodi \ + download-and-decompress-mainnet-snapshot download-and-decompress-hoodi-snapshot \ + download-and-decompress-mainnet-reth-snapshot download-and-decompress-hoodi-reth-snapshot \ + clean-mainnet-binary clean-hoodi-binary clean-mainnet-reth clean-hoodi-reth \ + stop-binary >/dev/null + + - name: Verify JSON, versions, snapshots, and data.zip consistency + run: | + python3 - <<'PY' + import json + import pathlib + import re + import zipfile + + root = pathlib.Path(".") + + # 1. Validate JSON files + json_files = [ + "mainnet/reth-data/static-nodes.json", + "hoodi/reth-data/static-nodes.json", + "mainnet/geth-data/static-nodes.json", + "hoodi/geth-data/static-nodes.json", + "mainnet/geth-data/genesis.json", + "hoodi/geth-data/genesis.json", + "mainnet/node-data/config/genesis.json", + "hoodi/node-data/config/genesis.json", + ] + for rel in json_files: + with (root / rel).open() as fh: + json.load(fh) + print(f"Validated {len(json_files)} JSON files.") + + # 2. Check Docker image tag & Makefile/README RETH_VERSION alignment + compose_geth = (root / "morph-node/docker-compose.yml").read_text() + compose_reth = (root / "morph-node/docker-compose.reth.yml").read_text() + makefile = (root / "morph-node/Makefile").read_text() + readme = (root / "README.md").read_text() + + node_geth = re.search(r"ghcr\.io/morph-l2/node:([0-9A-Za-z._-]+)", compose_geth) + node_reth = re.search(r"ghcr\.io/morph-l2/node:([0-9A-Za-z._-]+)", compose_reth) + assert node_geth and node_reth, "Missing morph-l2/node image tag" + assert node_geth.group(1) == node_reth.group(1), ( + f"Node image tag mismatch: docker-compose.yml={node_geth.group(1)} " + f"vs docker-compose.reth.yml={node_reth.group(1)}" + ) + + reth_img = re.search(r"ghcr\.io/morph-l2/morph-reth:v([0-9A-Za-z._-]+)", compose_reth) + reth_mk = re.search(r"^RETH_VERSION\s*\?=\s*([0-9A-Za-z._-]+)", makefile, re.M) + assert reth_img and reth_mk, "Missing morph-reth version" + assert reth_img.group(1) == reth_mk.group(1), ( + f"Reth version mismatch: docker-compose.reth.yml=v{reth_img.group(1)} " + f"vs Makefile={reth_mk.group(1)}" + ) + assert f"(default `{reth_img.group(1)}`, kept in sync with the image in" in readme, ( + f"README.md default RETH_VERSION out of sync with v{reth_img.group(1)}" + ) + print(f"Versions aligned: node={node_geth.group(1)}, morph-reth=v{reth_img.group(1)}.") + + # 3. Parse README snapshot tables and verify .env / .env_hoodi defaults match + table_rows = {} + row_re = re.compile( + r"^\|\s*\[([^\]]+)\]\(([^)]+)\)\s*\|\s*(\d+)\s*\|\s*(\d+)\s*\|\s*(\d+)\s*\|$", + re.M, + ) + for name, url, deriv, l1msg, l2base in row_re.findall(readme): + net = "mainnet" if "/mainnet/" in url else "hoodi" + table_rows[(net, name)] = (deriv, l1msg, l2base) + + def parse_env(path: pathlib.Path) -> dict[str, str]: + env = {} + for line in path.read_text().splitlines(): + line = line.strip() + if not line or line.startswith("#") or "=" not in line: + continue + k, v = line.split("=", 1) + env[k.strip()] = v.strip() + return env + + env_mainnet = parse_env(root / "morph-node/.env") + env_hoodi = parse_env(root / "morph-node/.env_hoodi") + + checks = [ + ("mainnet", env_mainnet["MAINNET_SNAPSHOT_NAME"], + (env_mainnet["DERIVATION_START_HEIGHT"], env_mainnet["L1_MSG_START_HEIGHT"], env_mainnet["L2_BASE_HEIGHT"])), + ("mainnet", env_mainnet["MAINNET_RETH_SNAPSHOT_NAME"], + (env_mainnet["RETH_DERIVATION_START_HEIGHT"], env_mainnet["RETH_L1_MSG_START_HEIGHT"], env_mainnet["RETH_L2_BASE_HEIGHT"])), + ("hoodi", env_hoodi["HOODI_SNAPSHOT_NAME"], + (env_hoodi["DERIVATION_START_HEIGHT"], env_hoodi["L1_MSG_START_HEIGHT"], env_hoodi["L2_BASE_HEIGHT"])), + ("hoodi", env_hoodi["HOODI_RETH_SNAPSHOT_NAME"], + (env_hoodi["RETH_DERIVATION_START_HEIGHT"], env_hoodi["RETH_L1_MSG_START_HEIGHT"], env_hoodi["RETH_L2_BASE_HEIGHT"])), + ] + for net, snap, heights in checks: + assert (net, snap) in table_rows, f"{net} snapshot {snap} from env file is not listed in README.md" + assert table_rows[(net, snap)] == heights, ( + f"Height mismatch for {net}/{snap}: env={heights} vs README={table_rows[(net, snap)]}" + ) + print("All .env / .env_hoodi default snapshots and heights match README.md.") + + # 4. Verify data.zip archives are clean and up to date with tracked files + for net in ("mainnet", "hoodi"): + zpath = root / net / "data.zip" + with zipfile.ZipFile(zpath) as zf: + names = zf.namelist() + assert not any(".DS_Store" in n or "__MACOSX" in n for n in names), f"Junk metadata in {zpath}" + for member in ( + "node-data/config/config.toml", + "node-data/config/genesis.json", + "reth-data/static-nodes.json", + ): + assert member in names, f"Missing {member} in {zpath}" + assert zf.read(member) == (root / net / member).read_bytes(), ( + f"{zpath}:{member} diverges from {net}/{member}" + ) + print("Verified mainnet/data.zip and hoodi/data.zip match tracked configs.") + PY diff --git a/.gitignore b/.gitignore index 62c8935..35f5c44 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ -.idea/ \ No newline at end of file +.idea/ +morph-node/.geth.pid +morph-node/.reth.pid +morph-node/.node.pid \ No newline at end of file diff --git a/.gitmodules b/.gitmodules index 8cf7a27..ba5e35c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "morph"] path = morph url = https://github.com/morph-l2/morph.git +[submodule "morph-reth"] + path = morph-reth + url = https://github.com/morph-l2/morph-reth.git diff --git a/README.md b/README.md index a20726a..d49d9c8 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,24 @@ # run-morph-node -`run-morph-node` is a repository designed to facilitate the deployment and management of Morph nodes using Docker. Morph is an innovative platform that enhances Ethereum Layer 2 scalability by combining optimistic rollups and zk technology, aiming to revolutionize consumer blockchain applications. +`run-morph-node` is a repository designed to facilitate the deployment and management of Morph nodes using Docker or standalone binaries. Morph is an innovative platform that enhances Ethereum Layer 2 scalability by combining optimistic rollups and zk technology, aiming to revolutionize consumer blockchain applications. ## Features -- **Dockerized Deployment**: Simplifies the process of setting up Morph nodes using Docker containers. +- **Dockerized & Binary Deployment**: Run Morph nodes via Docker Compose or standalone host binaries. - **Network Support**: Provides configurations for both Mainnet and Hoodi testnet environments. -- **Execution Client Choice**: Run the node with either **geth** (`go-ethereum`) or **reth** (`morph-reth`) as the execution client. -- **Snapshot Synchronization**: Supports synchronizing node data from snapshots to expedite the setup process. +- **Execution Client Choice**: Run the execution layer with **reth** (`morph-reth`, progressively replacing `go-ethereum`) or **geth** (`go-ethereum`). +- **Snapshot Synchronization**: Supports resumable snapshot downloads with automatic SHA-256 verification. ## Prerequisites -Before setting up a Morph node, ensure you have the following installed: - -- **Docker**: Containerization platform to run the node. -- **Docker Compose**: Tool for defining and running multi-container Docker applications. +- **Docker mode**: + - **Docker** and **Docker Compose v2** (`docker compose`; legacy `docker-compose` is used as a fallback). + - `wget`, `tar`, `openssl` (and optionally `pigz` for faster multi-core snapshot extraction). +- **Binary mode**: + - **morph-reth**: either download a pre-built Linux (`x86_64` / `aarch64`) binary with `make download-reth-binary`, or build from source with **Rust >= 1.95**, **Cargo**, `libclang-dev`, and `pkg-config`. + - **morphnode / geth**: **Go >= 1.24** to build from the pinned git submodules. +- **CPU baseline for pre-built `morph-reth` artifacts**: + - Published `ghcr.io/morph-l2/morph-reth` Docker images and Linux `x86_64` GitHub Release binaries are compiled with `x86-64-v3 + pclmulqdq` (Intel Haswell+ / AMD Excavator+). Older x86_64 CPUs (or VMs exposing `qemu64` / `x86-64-v1`) will crash with `SIGILL` and should build from source with `make build-reth`. ## Quick Start @@ -24,201 +28,235 @@ Before setting up a Morph node, ensure you have the following installed: git clone https://github.com/morph-l2/run-morph-node.git ``` -2. **Navigate to the Project Directory**: +2. **Navigate to the Node Directory**: ```bash - cd run-morph-node + cd run-morph-node/morph-node ``` 3. **Configure Environment Variables**: - Edit the `.env` file to set the appropriate values for your setup if needed. For instance, specify the `MORPH_HOME` if you plan to user your specified directory as your node data home. By default, it takes `./mainnet` as the node data home for mainnet network. - -4. **Download and Decompress Snapshot (Optional but Recommended)**: - -- To expedite synchronization, download the latest snapshot: - - ```bash - make download-and-decompress-mainnet-snapshot - ``` - -- For Hoodi testnet, use the corresponding command: - - ```bash - make download-and-decompress-hoodi-snapshot - ``` - -- After downloading the snapshot, you need to manually place the decompressed data files in the appropriate node data directories. Alternatively, use the `quickstart-*` targets (e.g. `make quickstart-mainnet-node`) which handle snapshot download and placement automatically. - - `make download-and-decompress-*` now extracts snapshots under network directories (`../mainnet` or `../hoodi`). - - For example, if the snapshot folder is named `snapshot-20260415-1`, move the directory to the `MORPH_HOME` directories: - ``` - mv ${MORPH_HOME}/snapshot-20260415-1/geth ${MORPH_HOME}/geth-data - mv ${MORPH_HOME}/snapshot-20260415-1/data/* ${MORPH_HOME}/node-data/data - ``` - - - The folder structure will be like - ``` - └── ${MORPH_HOME} - ├── geth-data // data directory for geth - │ └── geth // directory from snapshot/geth - └── node-data // data directory for node - ├── config - │ ├── config.toml - │ └── genesis.json - └── data // data directory from snapshot/node - ``` - - - **Reth uses a different snapshot** (the `*-reth-*` rows in the snapshot - table) with a different execution-client layout. Its tarball contains a - `reth-data/` tree plus the same `data/` for the node. `static-nodes.json` - is not in the snapshot; the `quickstart-*-reth-*` / `setup-snapshot-data-reth` - helpers copy it from `geth-data/` into `reth-data/` for `--trusted-peers`. - For example, if the reth snapshot folder is named `snapshot-archive-reth-20260902-1`, - move the directories into the `MORPH_HOME` directories: - ``` - mv ${MORPH_HOME}/snapshot-archive-reth-20260902-1/reth-data/* ${MORPH_HOME}/reth-data - mv ${MORPH_HOME}/snapshot-archive-reth-20260902-1/data/* ${MORPH_HOME}/node-data/data - ``` - The folder structure will be like - ``` - └── ${MORPH_HOME} - ├── reth-data // data directory for reth - │ ├── db // from snapshot/reth-data - │ ├── static_files // from snapshot/reth-data - │ ├── rocksdb // from snapshot/reth-data - │ ├── morph // from snapshot/reth-data - │ └── static-nodes.json // copied from geth-data, parsed into --trusted-peers - └── node-data // data directory for node - ├── config - │ ├── config.toml - │ └── genesis.json - └── data // data directory from snapshot/node - ``` - - -5. **Run the Node**: - -- Start the node using Docker Compose: - - ```bash - make run-node - ``` - - For Hoodi testnet, run - - ```bash - make run-hoodi-node - ``` - -- This command will set up and run the node based on the configurations specified in your .env file. - -### Running with reth instead of geth - -The node can run with **reth** (`morph-reth`) as its execution client instead of -geth. Reth uses a **separate execution-client data directory** (`${MORPH_HOME}/reth-data`) -and, importantly, a **different snapshot** than geth (see the [Snapshot Information](#snapshot-information) -table — reth snapshots are the `*-reth-*` rows). The `morph-node` (derivation) side -is identical; only the execution client and its snapshot differ. - -- Start a reth-backed node with Docker Compose: - - ```bash - make run-reth-node # mainnet - make run-hoodi-reth-node # hoodi - ``` - - Stop / remove: - - ```bash - make stop-reth-node - make rm-reth-node - ``` - -- Or use a one-command quickstart (downloads the reth snapshot, places the data, and runs): - - ```bash - make quickstart-mainnet-reth-node # mainnet, Docker - make quickstart-hoodi-reth-node # hoodi, Docker - ``` - -- **Binary mode** (build `morph-reth` from source with `cargo`, then run the binaries directly): - - ```bash - make build-reth-all # builds morph-reth + morphnode into ./bin - make run-reth-node-binary # mainnet - make run-hoodi-reth-node-binary # hoodi - make stop-binary # stops geth/reth/morphnode - # or one-command: make quickstart-mainnet-reth-node-binary / quickstart-hoodi-reth-node-binary - ``` - - `build-reth` clones `morph-reth` into `../morph-reth` and checks out a pinned - tag `v$(RETH_VERSION)` (default `1.5.0`, kept in sync with the image in - `docker-compose.reth.yml`) so the binary and Docker paths run the same version. - Bump it in one place with `make set-versions RETH_VERSION=1.4.0 ...` (rewrites the - compose image tag), or build a one-off with `make build-reth RETH_VERSION=1.4.0`. - -`morph-reth` reads the boot nodes from `static-nodes.json` and passes them to -`--trusted-peers` (discovery is disabled). The snapshot does **not** contain -`static-nodes.json`, so the snapshot setup copies it from `${MORPH_HOME}/geth-data/static-nodes.json` -into `${MORPH_HOME}/reth-data/`. The reth launch command used by the entrypoint is: + Edit `.env` (Mainnet) or `.env_hoodi` (Hoodi) if needed. For example, set `MORPH_HOME` (or `RETH_HOME` independently) to store data on an external disk, and replace the public `L1_ETH_RPC` / `L1_BEACON_CHAIN_RPC` defaults with dedicated endpoints for production or validator workloads. -```bash -morph-reth node \ - --chain \ - --datadir $RETH_DATA_DIR \ - --http --http.addr 0.0.0.0 --http.port 8545 --http.corsdomain '*' \ - --http.api web3,eth,txpool,net,trace \ - --ws --ws.addr 0.0.0.0 --ws.port 8546 --ws.origins '*' \ - --ws.api web3,eth,txpool,net,trace \ - --authrpc.addr 0.0.0.0 --authrpc.port 8551 --authrpc.jwtsecret /jwt-secret.txt \ - --disable-discovery --nat none \ - --metrics 0.0.0.0:6060 \ - --log.file.directory $LOG_DIR --log.file.filter info \ - --trusted-peers $TRUSTED_PEERS # parsed from static-nodes.json -``` +4. **One-Command Quickstart (Recommended)**: -### Running as a validator (batch verification mode) + Downloads the matching snapshot (with automatic `.sha256` verification), places the data, generates `jwt-secret.txt`, and starts the node: + + ```bash + # morph-reth (Docker) + make quickstart-mainnet-reth-node + make quickstart-hoodi-reth-node + + # go-ethereum (Docker) + make quickstart-mainnet-node + make quickstart-hoodi-node + ``` + +5. **Manual Snapshot Download and Placement (Optional)**: + + - Download and extract the latest **reth** snapshot (verifies `.sha256` automatically; set `SKIP_SHA256_CHECK=1` to bypass): + + ```bash + make download-and-decompress-mainnet-reth-snapshot + make download-and-decompress-hoodi-reth-snapshot + ``` + + - Or download the latest **geth** snapshot: + + ```bash + make download-and-decompress-mainnet-snapshot + make download-and-decompress-hoodi-snapshot + ``` + + - **Reth snapshot layout** (`*-reth-*` rows in the snapshot table): its tarball contains a `reth-data/` tree plus `data/` for `morph-node`. `static-nodes.json` is already tracked in `mainnet/reth-data/` and `hoodi/reth-data/` and parsed into `--trusted-peers`. When placing manually, clear any previous `node-data/data/` contents first so `mv` does not collide with stale directories: + + ```bash + rm -rf ${RETH_HOME}/reth-data/db ${RETH_HOME}/reth-data/static_files \ + ${RETH_HOME}/reth-data/rocksdb ${RETH_HOME}/reth-data/morph \ + ${RETH_HOME}/reth-data/historical-proofs + rm -rf ${RETH_HOME}/node-data/data/* + mv ${RETH_HOME}/snapshot-archive-reth-20261117-1/reth-data/* ${RETH_HOME}/reth-data/ + mv ${RETH_HOME}/snapshot-archive-reth-20261117-1/data/* ${RETH_HOME}/node-data/data/ + ``` + + Directory layout: + + ```text + └── ${RETH_HOME} + ├── reth-data // data directory for morph-reth + │ ├── db // from snapshot/reth-data + │ ├── static_files // from snapshot/reth-data + │ ├── rocksdb // from snapshot/reth-data + │ ├── morph // from snapshot/reth-data (reference index) + │ ├── logs // rotating reth.log files + │ └── static-nodes.json // tracked in repo, parsed into --trusted-peers + └── node-data // data directory for morph-node + ├── config + │ ├── config.toml + │ └── genesis.json + └── data // data directory from snapshot/data + ``` + + - **Geth snapshot layout**: + + ```bash + rm -rf ${MORPH_HOME}/geth-data/geth ${MORPH_HOME}/node-data/data/* + mv ${MORPH_HOME}/snapshot-20261117-1/geth ${MORPH_HOME}/geth-data/ + mv ${MORPH_HOME}/snapshot-20261117-1/data/* ${MORPH_HOME}/node-data/data/ + ``` + + Directory layout: + + ```text + └── ${MORPH_HOME} + ├── geth-data // data directory for geth + │ └── geth // directory from snapshot/geth + └── node-data // data directory for morph-node + ├── config + │ ├── config.toml + │ └── genesis.json + └── data // data directory from snapshot/data + ``` + +6. **Run the Node**: + + ```bash + # morph-reth (detached Docker Compose) + make run-reth-node # mainnet + make run-hoodi-reth-node # hoodi + + # go-ethereum (detached Docker Compose) + make run-node # mainnet + make run-hoodi-node # hoodi + ``` + +### Running with `morph-reth` + +`morph-reth` uses a **separate execution-client data directory** (`${RETH_HOME}/reth-data`) and a **different snapshot** than `geth` (the `*-reth-*` rows in the [Snapshot Information](#snapshot-information) table). The `morph-node` consensus/derivation layer is identical, but its `node-data/data` MUST come from the same paired snapshot as `reth-data`. + +- **Docker Compose**: + + ```bash + make run-reth-node # mainnet (detached, sets RETH_UID/RETH_GID to host user) + make run-hoodi-reth-node # hoodi + make stop-reth-node # stops morph-node first, then morph-reth cleanly + make rm-reth-node + ``` + + > **Bind-mount permissions on Linux**: the published `ghcr.io/morph-l2/morph-reth` image sets `USER morph-reth` (non-root system UID). The Makefile targets automatically pass `RETH_UID=$(id -u) RETH_GID=$(id -g)` so `morph-reth` runs as your host user and can write to `${RETH_HOME}/reth-data`. Direct `docker compose -f docker-compose.reth.yml ...` invocations default `RETH_UID`/`RETH_GID` to `0:0` unless overridden in the shell or env file. + +- **Binary mode** (pre-built Linux binary or build from the pinned `morph-reth` git submodule): + + ```bash + # Option A (Linux x86_64 / aarch64): download official verified release binary + make download-reth-binary build-morphnode + + # Option B: build both morph-reth and morphnode from source + make build-reth-all + + # Start / stop + make run-reth-node-binary # mainnet + make run-hoodi-reth-node-binary # hoodi + make stop-binary # stops morphnode first, then waits for reth/geth DB flush + + # Or one-command quickstart (builds from source + downloads reth snapshot + runs) + make quickstart-mainnet-reth-node-binary + make quickstart-hoodi-reth-node-binary + ``` + + `build-reth` initializes the `morph-reth` git submodule (`../morph-reth`) and builds the pinned tag `v$(RETH_VERSION)` (default `1.5.0`, kept in sync with the image in `docker-compose.reth.yml`) using the `profiling` Cargo profile (override with `RETH_BUILD_PROFILE=release`). Both `build-reth` and `download-reth-binary` verify the installed binary's `--version` against `RETH_VERSION` and automatically refresh it on version bumps (or when `FORCE_BUILD=1`). Bump all versions together with: + + ```bash + make set-versions GETH_VERSION=2.2.8 NODE_VERSION=0.6.5 RETH_VERSION=1.5.0 + ``` + +- **Launch command & customization**: -There is no separate validator service anymore — every node self-verifies L1 batches. The -mode is controlled by `DERIVATION_VERIFY_MODE` (`--derivation.verify-mode`) in the env file: + `entrypoint-reth.sh` parses `static-nodes.json` into `--trusted-peers` (with discovery disabled) and launches: -- `local` (default): rebuild the blob from local L2 blocks and compare versioned hashes - against L1. No beacon fetch on the happy path. -- `layer1`: pull the L1 beacon blob, decode it, and derive via the engine — equivalent to - the former validator node. + ```bash + morph-reth node \ + --chain \ + --datadir $RETH_DATADIR \ + --ipcdisable \ + --http --http.addr 0.0.0.0 --http.port 8545 --http.corsdomain '*' \ + --http.api "$RETH_HTTP_API" \ + --ws --ws.addr 0.0.0.0 --ws.port 8546 --ws.origins '*' \ + --ws.api "$RETH_WS_API" \ + --authrpc.addr 0.0.0.0 --authrpc.port 8551 --authrpc.jwtsecret /jwt-secret.txt \ + --disable-discovery --nat none \ + --metrics 0.0.0.0:6060 \ + --log.file.directory "$LOG_DIR" --log.file.filter "$RETH_LOG_FILTER" \ + --trusted-peers "$TRUSTED_PEERS" \ + $RETH_EXTRA_FLAGS + ``` -`L1_BEACON_CHAIN_RPC` is required in **both** modes — the node exits at startup without it. -`local` just doesn't fetch the blob on the happy path; `layer1` fetches it every batch. + Configurable environment variables in `.env` / `.env_hoodi`: + - `RETH_HTTP_API` / `RETH_WS_API`: default `web3,debug,eth,txpool,net,trace`. Note: in `morph-reth v1.5.0` the `morph_` RPC namespace (`morph_getTransactionHashesByReference`) is registered unconditionally and `"morph"` is rejected by `--http.api`/`--ws.api`. When upgrading to a release containing `morph-reth` PR #241 (`>v1.5.0`), append `,morph` to `RETH_HTTP_API` / `RETH_WS_API` to keep `morph_` methods enabled. + - `RETH_EXTRA_FLAGS`: extra CLI flags appended verbatim to `morph-reth node` (e.g. `--full`, `--txpool.*`, `--engine.persistence-threshold`). + - `RETH_LOG_FILTER`: rotating log file filter (default `info`, written under `reth-data/logs/`). + - `RETH_METRICS_PORT` / `RETH_P2P_PORT` / `RETH_RPC_PORT` / `RETH_WS_PORT`: host port bindings for Docker Compose (Prometheus metrics on `6060` work with the unified Grafana dashboard shipped in `morph-reth/etc/`). -`layer1` is what the former validator node did. Two ways to enable it: +- **Storage & pruning constraint**: -- **Validator commands** (kept for backward compatibility): `make run-validator` / - `make run-hoodi-validator` (or the `-binary` variants) run the single node in `layer1` - mode. Stop/remove with `make stop-validator` / `make rm-validator` (aliases of - `make stop-node` / `make rm-node`). -- **Env var:** set `DERIVATION_VERIFY_MODE=layer1` in `.env` / `.env_hoodi`, then `make run-node`. + `morph-reth` runs in archive mode by default, matching `snapshot-archive-reth-*`. Do **not** pass `--minimal` or `--prune.bodies.*` in `RETH_EXTRA_FLAGS`: Morph's mandatory reference index requires canonical block bodies from Jade onward, and `morph-reth` refuses to start if bodies-history pruning is configured. -There is no separate validator container anymore — both paths run the same `morph-node`. +- **Historical proofs (`--proofs-history`, optional for prover-facing nodes)**: -> `L1_SEQUENCER_CONTRACT` and `CONSENSUS_SWITCH_HEIGHT` are hardcoded per-network defaults -> in the binary and must not be set as operator config. + Set `RETH_PROOFS_HISTORY=true` (and optionally `RETH_PROOFS_WINDOW`, `RETH_PROOF_PERMITS`) in `.env` / `.env_hoodi` **only on a restored post-Jade paired snapshot** (never an empty DB). `entrypoint-reth.sh` verifies `${RETH_DATADIR}/db` exists, idempotently runs `morph-reth proofs init`, and launches `morph-reth node --proofs-history`. + +### Migrating from `geth` to `morph-reth` + +Because `morph-reth` and `geth` use different snapshot formats and their EL state must stay locked to `morph-node`'s `node-data/data` at the exact same block height, do **not** point `morph-reth` at a `geth` datadir or reuse `node-data/data` from a running `geth` node. + +- **Option A — In-place cutover**: + + 1. Stop and remove the `geth` stack: `make stop-node && make rm-node` (or `make stop-binary`). + 2. Clean old snapshot data (keeps `config.toml`, `genesis.json`, `static-nodes.json`): `make clean-mainnet-binary` (or `make clean-hoodi-binary`). + 3. Bootstrap and start `morph-reth` with its paired snapshot: `make quickstart-mainnet-reth-node` (or `make quickstart-hoodi-reth-node`). Note: `setup-snapshot-data-reth` also safely replaces any leftover `node-data/data/*` automatically. + 4. Once verified, you can reclaim disk space from `${MORPH_HOME}/geth-data/geth`. + +- **Option B — Side-by-side / shadow run before cutting over traffic**: + + Configure distinct paths, ports, and container names (either in a copy of `.env` or via environment overrides) so `morph-reth` runs alongside an existing `geth` node without collisions: + + ```bash + RETH_HOME=/data/morph-mainnet-reth \ + JWT_SECRET_FILE=/data/morph-mainnet-reth/jwt-secret.txt \ + RETH_RPC_PORT=18545 RETH_WS_PORT=18546 RETH_METRICS_PORT=16060 RETH_P2P_PORT=30304 \ + RETH_CONTAINER_NAME=morph-reth-shadow RETH_NODE_CONTAINER_NAME=morph-node-shadow \ + COMPOSE_PROJECT_NAME=morph-reth-shadow \ + docker compose -f docker-compose.reth.yml --env-file .env up -d node + ``` + +### Running as a validator (batch verification mode) + +There is no separate validator service anymore — every node self-verifies L1 batches. The mode is controlled by `DERIVATION_VERIFY_MODE` (`--derivation.verify-mode`) in the env file: + +- `local` (default): rebuild the blob from local L2 blocks and compare versioned hashes against L1. No beacon fetch on the happy path. +- `layer1`: pull the L1 beacon blob, decode it, and derive via the engine — equivalent to the former validator node. + +`L1_BEACON_CHAIN_RPC` is required in **both** modes — the node exits at startup without it, and it must point to an L1 **Beacon REST API** (`/eth/v1/beacon/...`), not an L1 execution JSON-RPC URL. + +Two ways to enable `layer1` mode: + +- **Validator commands** (reth and geth): + - **Reth (Docker)**: `make run-reth-validator` / `make run-hoodi-reth-validator` (stop/remove: `make stop-reth-validator` / `make rm-reth-validator`). + - **Reth (Binary)**: `make run-reth-validator-binary` / `make run-hoodi-reth-validator-binary`. + - **Geth (Docker / Binary)**: `make run-validator` / `make run-hoodi-validator` (or `-binary`; stop/remove: `make stop-validator` / `make rm-validator`). +- **Env var**: set `DERIVATION_VERIFY_MODE=layer1` in `.env` / `.env_hoodi`, then run `make run-reth-node` (or `make run-node`). + +> `L1_SEQUENCER_CONTRACT` and `CONSENSUS_SWITCH_HEIGHT` are hardcoded per-network defaults in the binary and must not be set as operator config. ## Snapshot Information -The table below provides the node snapshot data and corresponding download URLs. Ensure `DERIVATION_START_HEIGHT`, `L1_MSG_START_HEIGHT`, and `L2_BASE_HEIGHT` in `.env`/`.env_hoodi` match the selected snapshot. +The table below provides the node snapshot data and corresponding download URLs. Ensure the snapshot name and heights in `.env`/`.env_hoodi` match the selected snapshot. -> **geth vs reth snapshots:** rows whose name contains `reth` (e.g. `snapshot-archive-reth-*`) -> are for the **reth** execution client and must be used with the `*-reth-*` make targets; -> the other rows are **geth** snapshots. The two are not interchangeable. Set -> `MAINNET_SNAPSHOT_NAME`/`HOODI_SNAPSHOT_NAME` for geth and -> `MAINNET_RETH_SNAPSHOT_NAME`/`HOODI_RETH_SNAPSHOT_NAME` for reth in the env files. +> **geth vs reth snapshots:** rows whose name contains `reth` (e.g. `snapshot-archive-reth-*`) are for the **reth** execution client and must be used with the `*-reth-*` make targets; the other rows are **geth** snapshots. The two are not interchangeable. Set `MAINNET_SNAPSHOT_NAME`/`HOODI_SNAPSHOT_NAME` for geth and `MAINNET_RETH_SNAPSHOT_NAME`/`HOODI_RETH_SNAPSHOT_NAME` for reth in the env files. > -> Because the two clients use different snapshots, the height variables are also split: -> the geth path uses `DERIVATION_START_HEIGHT`/`L1_MSG_START_HEIGHT`/`L2_BASE_HEIGHT`, and -> the reth path uses `RETH_DERIVATION_START_HEIGHT`/`RETH_L1_MSG_START_HEIGHT`/`RETH_L2_BASE_HEIGHT`. -> Ensure each set matches the height row of its selected snapshot. +> Because the two clients use different snapshots, the height variables are also split: the geth path uses `DERIVATION_START_HEIGHT`/`L1_MSG_START_HEIGHT`/`L2_BASE_HEIGHT`, and the reth path uses `RETH_DERIVATION_START_HEIGHT`/`RETH_L1_MSG_START_HEIGHT`/`RETH_L2_BASE_HEIGHT`. Ensure each set matches the height row of its selected snapshot. -**For mainnet** (reth is currently in an internal testing phase and is not yet recommended for production use): +**For mainnet**: | Snapshot Name | Derivation Start Height | L1 Msg Start Height | L2 Base Height | |:--------------------------------------------------------------------------------------|:------------------------|:--------------------|:---------------| @@ -232,7 +270,7 @@ The table below provides the node snapshot data and corresponding download URLs. | [snapshot-20261017-1](https://snapshot.morph.network/mainnet/snapshot-20261017-1.tar.gz) | 26208397 | 26205946 | 28394410 | | [snapshot-archive-reth-20261017-1](https://snapshot.morph.network/mainnet/snapshot-archive-reth-20261017-1.tar.gz) | 26208397 | 26205946 | 28394410 | -**For hoodi testnet** (reth is currently in an internal testing phase and is not yet recommended for production use): +**For hoodi testnet**: | Snapshot Name | Derivation Start Height | L1 Msg Start Height | L2 Base Height | |:------------------------------------------------------------------------------------|:------------------------|:--------------------|:---------------| @@ -248,27 +286,18 @@ The table below provides the node snapshot data and corresponding download URLs. ## Verifying Snapshot Integrity -Each snapshot has a SHA-256 checksum file at the same URL with a `.sha256` -suffix. Compute the hash and compare it against the `.sha256` file — use -whichever command is available on your system: +The `Makefile` download and `quickstart-*` targets automatically fetch the `.sha256` checksum file alongside each snapshot and verify it before extraction (set `SKIP_SHA256_CHECK=1` to bypass). For manual downloads, compute the hash and compare it against the `.sha256` file: ```bash +sha256sum snapshot.tar.gz +# or shasum -a 256 snapshot.tar.gz # or openssl dgst -sha256 snapshot.tar.gz ``` ## Documentation -For detailed information on Morph and its ecosystem, refer to the official documentation: - -- [Morph Documentation](https://morphl2.io) - -By following these steps, you can set up and run a Morph node efficiently using Docker. For any questions or support, please refer to the official Morph community channels. - - - - - - +For detailed information on Morph and its ecosystem, refer to the official documentation: +- [Morph Documentation](https://docs.morph.network/) diff --git a/go-ethereum b/go-ethereum index 5744b8f..1c528b3 160000 --- a/go-ethereum +++ b/go-ethereum @@ -1 +1 @@ -Subproject commit 5744b8f66ec4070a535ed12200db48028df29d93 +Subproject commit 1c528b351da0c205eae0ea5e16f5053c2dd67eca diff --git a/hoodi/data.zip b/hoodi/data.zip index 7acd0e69d36ca0906a4e449d6a0a16d60c0a783e..742808f3097bba4820a45c2ecd8830913c79e0f4 100644 GIT binary patch delta 5955 zcmchbXHZn>wuU!3hXEw#)Z`#JiXb!~AW0Ajl3H?*oHvaU6%d;sNJbhE1d*H-L_nG> z!KTTnK{5g&>FU(IH8bbTocr(8u5VX;f8O=gyPmavyemqVY7B-q@$l&Y03ZhXWbRvg zjos`_qXz&}#15Xom8QTgR~SE~n|}})fP;_41Aw2u8WH>z0x)29?yl0qMA0sdI^d#! z;=p2R_rp7_WDN2W-n~P$JpEYUs^&_^`xV<6*PwQ>C*aY{ZV|QY-mawxT9x4%TQ1}# z^I6%2bjLtJm=Vgqf#s=_0DgAPYvx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!DZb1qTA@1rdX0M2s zAb?MpIw$aY%PV>+PI4wI5~%)hw2a;<^L&i<;X-FFnr*nF>F-@xY>!1`@f`8r1^ z+hp+1$J}sDWF>N)Ue8c99|hALi~6X1Kz&Qhq(sff;WU^@Eo-V_q}IDuwr7uLD?W^> z^xOufVwr}@f~DE)_zqU$S4am6ICSlWHa-6Msg_3tX1M;#>Y+ zdF#q`UQ2`v!qVQs$wEsN3!4e&-`o?;FAGHu+LXH-{%)f1{xDI0aXFVU{*MQM{wbn< z2j0B^{%Mr-^)7&yiT@o4`lplnofq~O-V+CvUyAC2d#REBBlk~1Wd%O*EyV_beDOgb zM$jMJ3$+Hy2^ayzS2MB8UdpTg!uX52k_BDt-tUahIG|WYX5ha?`C||M-ZHXZ7!c@k z531;XZ`rSp;{Wg4CA3M1k1HOVnF=o_;G7N=PeR84{kIqKE?NKr5nP;(7Y%t#fBE!3 D`Rg?P diff --git a/hoodi/geth-data/genesis.json b/hoodi/geth-data/genesis.json index c7827a8..302e448 100644 --- a/hoodi/geth-data/genesis.json +++ b/hoodi/geth-data/genesis.json @@ -21,9 +21,10 @@ "viridianTime": 1761544800, "emeraldTime": 1766988000, "jadeForkTime": 1774418400, + "celadonTime": 1793167200, "morph": { "useZktrie": false, - "maxTxPayloadBytesPerBlock": 122880, + "maxTxPayloadBytesPerBlock": 737280, "feeVaultAddress": "0x29107cb79ef8f69fe1587f77e283d47e84c5202f" }, "scroll": {} diff --git a/mainnet/data.zip b/mainnet/data.zip index 5ed17dcb3dfa6210f3728084d47040ef2048250e..e31ae2d057203bcce9c21df965a84b5c42dafcf8 100644 GIT binary patch literal 9730 zcmeHtbxs=tx`x_jnp6?vFfm;e9(0gxgGHV`|TCDX+N0H$OB0K#9hgQGc! z$=n2N!eZv=U}0_fe>TiuM|(RB_16HHeKdeAh#JM#%@YX#^=cmm0Qkr1SkK3GSt{uz zH`g?JjZdC8X-hnXc7B)MpXwqTRLQuzRiPiv1qi3qBn|8b6tpecoxry}x;)CB&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|5JB%-f7R*F;SIsJrAq6`(_IjgM(4v&mk#Zf_)D=(P;ul`GOk|{+6;2q zT@eThjdiB&r*K5wGcE2MH0iKFoj>-7;+nMw>3@*$j=|CJL2em!-A=Q!flb|gZzyv< z8EDNHB)lFh&gG`EU`$}mlWa9I;vvyJfWdNqOtKB10%WLO&GkU5$EDUeidWoS z9x_d!jj{W_k+5GIC<>O$*OX1rS!-U`1H4cYXNPs4-6x!070;V$L0gRAxgA$0Q{GkS zqg`zP$t)$hv$8Flg4GEZO~_7rLz`FejewmcBJ&MPS3BuiO-3yRY#19zESl44k|th( zCLvwLW?z&Wy7<1HPfq7E=qtI(&0{pF4+;RhE>{I<5Kwfm|5?QJ+8VERBKUg#txfsA zOPc}Ui=DkB3Snl=0BMpziaY3KmOd1uk+)V75d-*1@}LmCJNFJkgs5{ OFRzW4^7fIwe)>OG_Q+iT diff --git a/mainnet/geth-data/genesis.json b/mainnet/geth-data/genesis.json index 247f17d..2ae14aa 100644 --- a/mainnet/geth-data/genesis.json +++ b/mainnet/geth-data/genesis.json @@ -20,11 +20,12 @@ "viridianTime": 1762149600, "emeraldTime": 1767765600, "jadeForkTime": 1775628000, + "celadonTime": 1793772000, "terminalTotalDifficulty": 0, "morph": { "useZktrie": false, "maxTxPerBlock": 100, - "maxTxPayloadBytesPerBlock": 122880, + "maxTxPayloadBytesPerBlock": 737280, "feeVaultAddress": "0x530000000000000000000000000000000000000a" } }, diff --git a/morph b/morph index 5edbc69..c6f1e14 160000 --- a/morph +++ b/morph @@ -1 +1 @@ -Subproject commit 5edbc693d4edc72597b444a9b75424661fd536cf +Subproject commit c6f1e14f242b006996223d9b957a37493b995eab diff --git a/morph-node/.env b/morph-node/.env index 6032a50..abb7722 100644 --- a/morph-node/.env +++ b/morph-node/.env @@ -2,35 +2,70 @@ MORPH_HOME=../mainnet MORPH_FLAG=morph JWT_SECRET_FILE=${MORPH_HOME}/jwt-secret.txt GETH_ENTRYPOINT_FILE=./entrypoint-geth.sh -MAINNET_SNAPSHOT_NAME=snapshot-20260701-1 +MAINNET_SNAPSHOT_NAME=snapshot-20261117-1 -## Reth execution client (alternative to geth). Reth uses a SEPARATE snapshot +## Reth execution client (morph-reth). Reth uses a SEPARATE snapshot ## (reth-data/ tree) and a separate data directory (${RETH_HOME}/reth-data), -## but shares the same network home dir and node-data with the geth flow. +## but shares the same network home dir and node-data by default. Set a +## distinct RETH_HOME (plus port/container overrides below) to run side by side +## with geth during migration. RETH_HOME=${MORPH_HOME} RETH_CHAIN=mainnet RETH_ENTRYPOINT_FILE=./entrypoint-reth.sh -MAINNET_RETH_SNAPSHOT_NAME=snapshot-archive-reth-20260902-1 +MAINNET_RETH_SNAPSHOT_NAME=snapshot-archive-reth-20261117-1 # Reth uses a SEPARATE snapshot from geth, so it needs its own heights. These must # match MAINNET_RETH_SNAPSHOT_NAME above (see the README snapshot table). The reth # compose/binary paths use these instead of the shared DERIVATION_*/L1_MSG_*/L2_BASE_* # below (which track the geth snapshot). -RETH_DERIVATION_START_HEIGHT=25885664 -RETH_L1_MSG_START_HEIGHT=25880870 -RETH_L2_BASE_HEIGHT=26137782 +RETH_DERIVATION_START_HEIGHT=26430867 +RETH_L1_MSG_START_HEIGHT=26425693 +RETH_L2_BASE_HEIGHT=29942295 + +# Exposed HTTP/WS RPC namespaces for morph-reth. +# Note: in morph-reth v1.5.0 the morph_ namespace is registered unconditionally and +# "morph" is not accepted in --http.api/--ws.api. Starting with the next release +# containing morph-reth PR #241, append ",morph" here to keep morph_ RPC methods enabled. +RETH_HTTP_API=web3,debug,eth,txpool,net,trace +RETH_WS_API=web3,debug,eth,txpool,net,trace +RETH_LOG_FILTER=info + +# Optional historical proof index for prover-facing nodes (requires a post-Jade +# paired snapshot; runs `morph-reth proofs init` idempotently before startup). +RETH_PROOFS_HISTORY=false +RETH_PROOFS_WINDOW= +RETH_PROOF_PERMITS= + +# Extra CLI flags passed verbatim to `morph-reth node` (e.g. `--full`, `--txpool.*`). +# NOTE: Do NOT use `--minimal` or `--prune.bodies.*`; Morph's reference index requires +# canonical block bodies from Jade onward and morph-reth refuses to start otherwise. +RETH_EXTRA_FLAGS= + +# Host port bindings and container names for docker-compose.reth.yml. +# Override these (along with RETH_HOME) when running reth alongside geth. +RETH_RPC_PORT=8545 +RETH_WS_PORT=8546 +RETH_METRICS_PORT=6060 +RETH_P2P_PORT=30303 +RETH_CONTAINER_NAME=morph-reth +RETH_NODE_CONTAINER_NAME=morph-node +# Optional UID:GID for the morph-reth Docker container. Makefile sets these +# automatically from `id -u`/`id -g`; direct `docker compose` falls back to 0:0. +# RETH_UID=1000 +# RETH_GID=1000 ## Environment variables for the node L1_CHAIN_ID=1 L1_ETH_RPC=https://eth.drpc.org -# Required in both verify modes: the node exits at startup without it. Only fetched -# at runtime on the layer1 path (local skips the blob fetch on the happy path). -L1_BEACON_CHAIN_RPC=https://rpc.ankr.com/eth +# Required in both verify modes: the node exits at startup without it. Must be an +# L1 Beacon REST API endpoint (/eth/v1/beacon/...), NOT an execution JSON-RPC URL. +# Replace the public default with a dedicated endpoint for production / layer1 mode. +L1_BEACON_CHAIN_RPC=https://ethereum-beacon-api.publicnode.com L1MESSAGEQUEUE_CONTRACT=0x3931ade842f5bb8763164bdd81e5361dce6cc1ef ROLLUP_CONTRACT=0x759894ced0e6af42c26668076ffa84d02e3cef60 # Heights match MAINNET_SNAPSHOT_NAME above (see the README snapshot table). -DERIVATION_START_HEIGHT=25440822 -L1_MSG_START_HEIGHT=25439950 -L2_BASE_HEIGHT=24216219 +DERIVATION_START_HEIGHT=26430867 +L1_MSG_START_HEIGHT=26425693 +L2_BASE_HEIGHT=29942295 ## Extra flags for node NODE_EXTRA_FLAGS=--mainnet @@ -40,8 +75,9 @@ NODE_EXTRA_FLAGS=--mainnet ## hashes against L1 (no beacon fetch on the happy path). ## layer1: pull the L1 beacon blob, decode it, and derive via the engine — ## equivalent to the former validator node (needs L1_BEACON_CHAIN_RPC). -## Leave empty for the binary default (local). `make run-validator` / -## `run-validator-binary` set layer1 for you; or set it here and use `make run-node`. +## Leave empty for the binary default (local). `make run-reth-validator` / +## `make run-validator` (and `-binary` variants) set layer1 for you; or set it +## here and use `make run-reth-node` / `make run-node`. DERIVATION_VERIFY_MODE= ## NOTE: do NOT set L1_SEQUENCER_CONTRACT or CONSENSUS_SWITCH_HEIGHT here. These diff --git a/morph-node/.env_hoodi b/morph-node/.env_hoodi index e874bef..b16b3f7 100644 --- a/morph-node/.env_hoodi +++ b/morph-node/.env_hoodi @@ -2,35 +2,71 @@ MORPH_HOME=../hoodi MORPH_FLAG=morph-hoodi JWT_SECRET_FILE=${MORPH_HOME}/jwt-secret.txt GETH_ENTRYPOINT_FILE=./entrypoint-geth.sh -HOODI_SNAPSHOT_NAME=snapshot-20260630-1 +HOODI_SNAPSHOT_NAME=snapshot-20261115-1 -## Reth execution client (alternative to geth). Reth uses a SEPARATE snapshot +## Reth execution client (morph-reth). Reth uses a SEPARATE snapshot ## (reth-data/ tree) and a separate data directory (${RETH_HOME}/reth-data), -## but shares the same network home dir and node-data with the geth flow. +## but shares the same network home dir and node-data by default. Set a +## distinct RETH_HOME (plus port/container overrides below) to run side by side +## with geth during migration. RETH_HOME=${MORPH_HOME} RETH_CHAIN=hoodi RETH_ENTRYPOINT_FILE=./entrypoint-reth.sh -HOODI_RETH_SNAPSHOT_NAME=snapshot-archive-reth-20260901-1 +HOODI_RETH_SNAPSHOT_NAME=snapshot-archive-reth-20261115-1 # Reth uses a SEPARATE snapshot from geth, so it needs its own heights. These must # match HOODI_RETH_SNAPSHOT_NAME above (see the README snapshot table). The reth # compose/binary paths use these instead of the shared DERIVATION_*/L1_MSG_*/L2_BASE_* # below (which track the geth snapshot). -RETH_DERIVATION_START_HEIGHT=3533250 -RETH_L1_MSG_START_HEIGHT=3529538 -RETH_L2_BASE_HEIGHT=8346700 +RETH_DERIVATION_START_HEIGHT=4017123 +RETH_L1_MSG_START_HEIGHT=3931800 +RETH_L2_BASE_HEIGHT=11729740 + +# Exposed HTTP/WS RPC namespaces for morph-reth. +# Note: in morph-reth v1.5.0 the morph_ namespace is registered unconditionally and +# "morph" is not accepted in --http.api/--ws.api. Starting with the next release +# containing morph-reth PR #241, append ",morph" here to keep morph_ RPC methods enabled. +RETH_HTTP_API=web3,debug,eth,txpool,net,trace +RETH_WS_API=web3,debug,eth,txpool,net,trace +RETH_LOG_FILTER=info + +# Optional historical proof index for prover-facing nodes (requires a post-Jade +# paired snapshot; runs `morph-reth proofs init` idempotently before startup). +RETH_PROOFS_HISTORY=false +RETH_PROOFS_WINDOW= +RETH_PROOF_PERMITS= + +# Extra CLI flags passed verbatim to `morph-reth node` (e.g. `--full`, `--txpool.*`). +# NOTE: Do NOT use `--minimal` or `--prune.bodies.*`; Morph's reference index requires +# canonical block bodies from Jade onward and morph-reth refuses to start otherwise. +RETH_EXTRA_FLAGS= + +# Host port bindings and container names for docker-compose.reth.yml. +# Override these (along with RETH_HOME) when running reth alongside geth. +RETH_RPC_PORT=8545 +RETH_WS_PORT=8546 +RETH_METRICS_PORT=6060 +RETH_P2P_PORT=30303 +RETH_CONTAINER_NAME=morph-reth +RETH_NODE_CONTAINER_NAME=morph-node +# Optional UID:GID for the morph-reth Docker container. Makefile sets these +# automatically from `id -u`/`id -g`; direct `docker compose` falls back to 0:0. +# RETH_UID=1000 +# RETH_GID=1000 ## Environment variables for the node L1_CHAIN_ID=560048 -L1_ETH_RPC=${your_layer1_execution_client_rpc_url} -# Required in both verify modes: the node exits at startup without it. Only fetched -# at runtime on the layer1 path (local skips the blob fetch on the happy path). -L1_BEACON_CHAIN_RPC=${your_layer1_beacon_client_rpc_url} +# Public Hoodi defaults for quickstart; replace with your own dedicated L1 EL/CL +# endpoints for production or sustained validator operation. +L1_ETH_RPC=https://ethereum-hoodi-rpc.publicnode.com +# Required in both verify modes: the node exits at startup without it. Must be an +# L1 Beacon REST API endpoint (/eth/v1/beacon/...), NOT an execution JSON-RPC URL. +L1_BEACON_CHAIN_RPC=https://ethereum-hoodi-beacon-api.publicnode.com L1MESSAGEQUEUE_CONTRACT=0xd7f39d837f4790b215ba67e0ab63665912648dbe ROLLUP_CONTRACT=0x57e0e6dde89dc52c01fe785774271504b1e04664 # Heights match HOODI_SNAPSHOT_NAME above (see the README snapshot table). -DERIVATION_START_HEIGHT=3122685 -L1_MSG_START_HEIGHT=3106743 -L2_BASE_HEIGHT=6543334 +DERIVATION_START_HEIGHT=4017123 +L1_MSG_START_HEIGHT=3931800 +L2_BASE_HEIGHT=11729740 ## Extra flags for morphnode. --hoodi selects the Hoodi network so the node picks ## up the built-in Hoodi L1 sequencer contract address; without it the node @@ -42,8 +78,9 @@ NODE_EXTRA_FLAGS=--hoodi ## hashes against L1 (no beacon fetch on the happy path). ## layer1: pull the L1 beacon blob, decode it, and derive via the engine — ## equivalent to the former validator node (needs L1_BEACON_CHAIN_RPC). -## Leave empty for the binary default (local). `make run-hoodi-validator` / -## `run-hoodi-validator-binary` set layer1 for you; or set it here and use `make run-hoodi-node`. +## Leave empty for the binary default (local). `make run-hoodi-reth-validator` / +## `make run-hoodi-validator` (and `-binary` variants) set layer1 for you; or set it +## here and use `make run-hoodi-reth-node` / `make run-hoodi-node`. DERIVATION_VERIFY_MODE= ## NOTE: do NOT set L1_SEQUENCER_CONTRACT or CONSENSUS_SWITCH_HEIGHT here. These diff --git a/morph-node/Makefile b/morph-node/Makefile index 417b79f..c061089 100644 --- a/morph-node/Makefile +++ b/morph-node/Makefile @@ -1,59 +1,96 @@ include .env -# Capture mainnet JWT path before .env_hoodi overwrites MORPH_HOME (:= forces immediate expansion) +# Capture mainnet paths and snapshot names before .env_hoodi overwrites them (:= forces immediate expansion) +MORPH_HOME_MAINNET := $(MORPH_HOME) +RETH_HOME_MAINNET := $(RETH_HOME) JWT_SECRET_FILE_MAINNET := $(JWT_SECRET_FILE) -# Capture mainnet reth snapshot name for the same reason. +MAINNET_SNAPSHOT_NAME := $(MAINNET_SNAPSHOT_NAME) MAINNET_RETH_SNAPSHOT_NAME := $(MAINNET_RETH_SNAPSHOT_NAME) include .env_hoodi +MORPH_HOME_HOODI := $(MORPH_HOME) +RETH_HOME_HOODI := $(RETH_HOME) JWT_SECRET_FILE_HOODI := $(JWT_SECRET_FILE) -# morph-reth version to build/run. Keep this in sync with the image tag in -# docker-compose.reth.yml (v$(RETH_VERSION)). Override on the command line, e.g. -# `make build-reth RETH_VERSION=1.4.0`. `?=` lets an env var take precedence. +# Prefer Docker Compose v2 (`docker compose`) and fall back to legacy `docker-compose`. +COMPOSE ?= $(shell docker compose version >/dev/null 2>&1 && echo "docker compose" || echo "docker-compose") + +# morph-reth version to build/download/run. Keep this in sync with the image tag in +# docker-compose.reth.yml (v$(RETH_VERSION)) and the morph-reth git submodule. +# Override on the command line, e.g. `make build-reth RETH_VERSION=1.6.0`. RETH_VERSION ?= 1.5.0 +# Cargo build profile for `make build-reth` (matches morph-reth Dockerfile & GitHub Releases). +RETH_BUILD_PROFILE ?= profiling + +# Set SKIP_SHA256_CHECK=1 to bypass snapshot checksum verification if needed. +SKIP_SHA256_CHECK ?= 0 + +.PHONY: generate-jwt generate-jwt-hoodi \ + run-node run-hoodi-node stop-node rm-node \ + run-reth-node run-hoodi-reth-node stop-reth-node rm-reth-node \ + run-validator run-hoodi-validator stop-validator rm-validator \ + run-reth-validator run-hoodi-reth-validator stop-reth-validator rm-reth-validator \ + submodule-init set-versions \ + build-geth build-morphnode build-reth download-reth-binary build build-reth-all \ + run-node-binary run-hoodi-node-binary \ + run-validator-binary run-hoodi-validator-binary \ + run-reth-node-binary run-hoodi-reth-node-binary \ + run-reth-validator-binary run-hoodi-reth-validator-binary \ + stop-binary \ + clean-mainnet-binary clean-hoodi-binary clean-mainnet-reth clean-hoodi-reth \ + quickstart-hoodi-node quickstart-hoodi-node-binary \ + quickstart-mainnet-node quickstart-mainnet-node-binary \ + quickstart-hoodi-reth-node quickstart-hoodi-reth-node-binary \ + quickstart-mainnet-reth-node quickstart-mainnet-reth-node-binary \ + download-and-decompress-mainnet-snapshot download-and-decompress-hoodi-snapshot \ + download-and-decompress-mainnet-reth-snapshot download-and-decompress-hoodi-reth-snapshot \ + download-and-decompress-mainnet-mpt-snapshot download-and-decompress-hoodi-mpt-snapshot generate-jwt: - @[ -f $(JWT_SECRET_FILE_MAINNET) ] || (echo "Generating $(JWT_SECRET_FILE_MAINNET)..." && openssl rand -hex 32 > $(JWT_SECRET_FILE_MAINNET) && echo "$(JWT_SECRET_FILE_MAINNET) created.") + @mkdir -p "$$(dirname "$(JWT_SECRET_FILE_MAINNET)")" + @[ -f "$(JWT_SECRET_FILE_MAINNET)" ] || (echo "Generating $(JWT_SECRET_FILE_MAINNET)..." && openssl rand -hex 32 > "$(JWT_SECRET_FILE_MAINNET)" && echo "$(JWT_SECRET_FILE_MAINNET) created.") generate-jwt-hoodi: - @[ -f $(JWT_SECRET_FILE_HOODI) ] || (echo "Generating $(JWT_SECRET_FILE_HOODI)..." && openssl rand -hex 32 > $(JWT_SECRET_FILE_HOODI) && echo "$(JWT_SECRET_FILE_HOODI) created.") + @mkdir -p "$$(dirname "$(JWT_SECRET_FILE_HOODI)")" + @[ -f "$(JWT_SECRET_FILE_HOODI)" ] || (echo "Generating $(JWT_SECRET_FILE_HOODI)..." && openssl rand -hex 32 > "$(JWT_SECRET_FILE_HOODI)" && echo "$(JWT_SECRET_FILE_HOODI) created.") -## node management +## node management (geth) run-node: generate-jwt @echo "You are about to run a Mainnet node." @{ [ -t 0 ] || { echo "Error: interactive confirmation required (run in a TTY)."; exit 1; }; printf "Continue? [Y/n] "; read confirm; if [ "$$confirm" = "n" ] || [ "$$confirm" = "N" ]; then exit 1; fi; } - docker-compose --env-file .env up node & + $(COMPOSE) --env-file .env up -d node run-hoodi-node: generate-jwt-hoodi @echo "You are about to run a Hoodi node." @{ [ -t 0 ] || { echo "Error: interactive confirmation required (run in a TTY)."; exit 1; }; printf "Continue? [Y/n] "; read confirm; if [ "$$confirm" = "n" ] || [ "$$confirm" = "N" ]; then exit 1; fi; } - docker-compose --env-file .env_hoodi up node & + $(COMPOSE) --env-file .env_hoodi up -d node stop-node: - docker stop morph-node morph-geth + @docker stop morph-node 2>/dev/null || true + docker stop morph-geth rm-node: docker rm morph-node morph-geth -## reth node management (reth is an alternative execution client to geth; it uses -## a SEPARATE snapshot — see the README snapshot table — and its own reth-data dir). +## reth node management (morph-reth uses a SEPARATE snapshot — see the README +## snapshot table — and its own reth-data dir). run-reth-node: generate-jwt @echo "You are about to run a Mainnet node with the reth execution client." @{ [ -t 0 ] || { echo "Error: interactive confirmation required (run in a TTY)."; exit 1; }; printf "Continue? [Y/n] "; read confirm; if [ "$$confirm" = "n" ] || [ "$$confirm" = "N" ]; then exit 1; fi; } - docker-compose -f docker-compose.reth.yml --env-file .env up node & + RETH_UID=$$(id -u) RETH_GID=$$(id -g) $(COMPOSE) -f docker-compose.reth.yml --env-file .env up -d node run-hoodi-reth-node: generate-jwt-hoodi @echo "You are about to run a Hoodi node with the reth execution client." @{ [ -t 0 ] || { echo "Error: interactive confirmation required (run in a TTY)."; exit 1; }; printf "Continue? [Y/n] "; read confirm; if [ "$$confirm" = "n" ] || [ "$$confirm" = "N" ]; then exit 1; fi; } - docker-compose -f docker-compose.reth.yml --env-file .env_hoodi up node & + RETH_UID=$$(id -u) RETH_GID=$$(id -g) $(COMPOSE) -f docker-compose.reth.yml --env-file .env_hoodi up -d node stop-reth-node: - docker stop morph-node morph-reth + @docker stop $(RETH_NODE_CONTAINER_NAME) 2>/dev/null || true + docker stop $(RETH_CONTAINER_NAME) rm-reth-node: - docker rm morph-node morph-reth + docker rm $(RETH_NODE_CONTAINER_NAME) $(RETH_CONTAINER_NAME) ## Validator commands, kept for backward compatibility. A "validator" is now just ## the single node run in layer1 batch-verification mode (--derivation.verify-mode=layer1: @@ -63,41 +100,62 @@ rm-reth-node: run-validator: generate-jwt @echo "You are about to run a Mainnet node in validator mode (--derivation.verify-mode=layer1)." @{ [ -t 0 ] || { echo "Error: interactive confirmation required (run in a TTY)."; exit 1; }; printf "Continue? [Y/n] "; read confirm; if [ "$$confirm" = "n" ] || [ "$$confirm" = "N" ]; then exit 1; fi; } - DERIVATION_VERIFY_MODE=layer1 docker-compose --env-file .env up node & + DERIVATION_VERIFY_MODE=layer1 $(COMPOSE) --env-file .env up -d node run-hoodi-validator: generate-jwt-hoodi @echo "You are about to run a Hoodi node in validator mode (--derivation.verify-mode=layer1)." @{ [ -t 0 ] || { echo "Error: interactive confirmation required (run in a TTY)."; exit 1; }; printf "Continue? [Y/n] "; read confirm; if [ "$$confirm" = "n" ] || [ "$$confirm" = "N" ]; then exit 1; fi; } - DERIVATION_VERIFY_MODE=layer1 docker-compose --env-file .env_hoodi up node & + DERIVATION_VERIFY_MODE=layer1 $(COMPOSE) --env-file .env_hoodi up -d node -## Backward-compat aliases: the validator is now the same container as the node. stop-validator: stop-node rm-validator: rm-node -## build from source (requires Go) +## Validator commands for reth (--derivation.verify-mode=layer1 + morph-reth). +run-reth-validator: generate-jwt + @echo "You are about to run a Mainnet reth node in validator mode (--derivation.verify-mode=layer1)." + @{ [ -t 0 ] || { echo "Error: interactive confirmation required (run in a TTY)."; exit 1; }; printf "Continue? [Y/n] "; read confirm; if [ "$$confirm" = "n" ] || [ "$$confirm" = "N" ]; then exit 1; fi; } + RETH_UID=$$(id -u) RETH_GID=$$(id -g) DERIVATION_VERIFY_MODE=layer1 $(COMPOSE) -f docker-compose.reth.yml --env-file .env up -d node + +run-hoodi-reth-validator: generate-jwt-hoodi + @echo "You are about to run a Hoodi reth node in validator mode (--derivation.verify-mode=layer1)." + @{ [ -t 0 ] || { echo "Error: interactive confirmation required (run in a TTY)."; exit 1; }; printf "Continue? [Y/n] "; read confirm; if [ "$$confirm" = "n" ] || [ "$$confirm" = "N" ]; then exit 1; fi; } + RETH_UID=$$(id -u) RETH_GID=$$(id -g) DERIVATION_VERIFY_MODE=layer1 $(COMPOSE) -f docker-compose.reth.yml --env-file .env_hoodi up -d node + +stop-reth-validator: stop-reth-node + +rm-reth-validator: rm-reth-node + +## build from source (requires Go / Rust) submodule-init: @echo "Initializing git submodules..." cd .. && git submodule update --init --recursive @echo "Submodules ready." -# Update submodule versions and docker-compose.yml image tags in one shot. -# Usage: make set-versions GETH_VERSION=2.2.1 NODE_VERSION=0.5.3 [RETH_VERSION=1.4.0] -# RETH_VERSION also rewrites the morph-reth image tag in docker-compose.reth.yml so -# the Docker and binary reth paths stay on the same version (defaults to $(RETH_VERSION)). +# Update submodule versions, docker-compose image tags, Makefile RETH_VERSION, and README in one shot. +# Usage: make set-versions GETH_VERSION=2.2.8 NODE_VERSION=0.6.5 RETH_VERSION=1.5.0 set-versions: + @if [ -z "$(GETH_VERSION)" ] || [ -z "$(NODE_VERSION)" ] || [ -z "$(RETH_VERSION)" ]; then \ + echo "Usage: make set-versions GETH_VERSION= NODE_VERSION= RETH_VERSION="; \ + exit 1; \ + fi + cd .. && git submodule update --init go-ethereum morph morph-reth cd ../go-ethereum && git fetch --tags && git checkout morph-v$(GETH_VERSION) cd ../morph && git fetch --tags && git checkout v$(NODE_VERSION) - sed -i'' 's|go-ethereum:[0-9.]*|go-ethereum:$(GETH_VERSION)|g' docker-compose.yml - sed -i'' 's|morph-l2/node:[0-9.]*|morph-l2/node:$(NODE_VERSION)|g' docker-compose.yml - sed -i'' 's|morph-reth:v[0-9.]*|morph-reth:v$(RETH_VERSION)|g' docker-compose.reth.yml - cd .. && git add go-ethereum morph - @echo "Done. Commit with: git commit -m 'chore: bump geth=$(GETH_VERSION) node=$(NODE_VERSION) reth=$(RETH_VERSION)'" - -build-geth: submodule-init - @if [ -f ./bin/geth ]; then \ - echo "geth binary already exists at ./bin/geth, skipping build."; \ + cd ../morph-reth && git fetch --tags && git checkout v$(RETH_VERSION) + sed 's|go-ethereum:[0-9A-Za-z._-]*|go-ethereum:$(GETH_VERSION)|g; s|morph-l2/node:[0-9A-Za-z._-]*|morph-l2/node:$(NODE_VERSION)|g' docker-compose.yml > docker-compose.yml.tmp && mv docker-compose.yml.tmp docker-compose.yml + sed 's|morph-reth:v[0-9A-Za-z._-]*|morph-reth:v$(RETH_VERSION)|g; s|morph-l2/node:[0-9A-Za-z._-]*|morph-l2/node:$(NODE_VERSION)|g' docker-compose.reth.yml > docker-compose.reth.yml.tmp && mv docker-compose.reth.yml.tmp docker-compose.reth.yml + sed 's|^RETH_VERSION ?= .*|RETH_VERSION ?= $(RETH_VERSION)|' Makefile > Makefile.tmp && mv Makefile.tmp Makefile + sed 's|(default `[^`]*`, kept in sync with the image in|(default `$(RETH_VERSION)`, kept in sync with the image in|' ../README.md > ../README.md.tmp && mv ../README.md.tmp ../README.md + cd .. && git add go-ethereum morph morph-reth morph-node/docker-compose.yml morph-node/docker-compose.reth.yml morph-node/Makefile README.md + @echo "Done. Commit with: git commit -m 'chore: bump node=$(NODE_VERSION) geth=$(GETH_VERSION) reth=$(RETH_VERSION)'" + +build-geth: + @if [ -f ./bin/geth ] && [ "$${FORCE_BUILD:-0}" != "1" ]; then \ + echo "geth binary already exists at ./bin/geth, skipping build (set FORCE_BUILD=1 to rebuild)."; \ else \ + echo "Initializing go-ethereum submodule..."; \ + (cd .. && git submodule update --init --recursive go-ethereum) || { echo "Error: failed to init go-ethereum submodule."; exit 1; }; \ echo "Building geth from source..."; \ (cd ../go-ethereum && make geth) || { echo "Error: geth build failed."; exit 1; }; \ mkdir -p ./bin; \ @@ -105,10 +163,12 @@ build-geth: submodule-init echo "geth binary copied to morph-node/bin/geth"; \ fi -build-morphnode: submodule-init - @if [ -f ./bin/morphnode ]; then \ - echo "morphnode binary already exists at ./bin/morphnode, skipping build."; \ +build-morphnode: + @if [ -f ./bin/morphnode ] && [ "$${FORCE_BUILD:-0}" != "1" ]; then \ + echo "morphnode binary already exists at ./bin/morphnode, skipping build (set FORCE_BUILD=1 to rebuild)."; \ else \ + echo "Initializing morph submodule..."; \ + (cd .. && git submodule update --init --recursive morph) || { echo "Error: failed to init morph submodule."; exit 1; }; \ echo "Building morphnode from source..."; \ (cd ../morph/node && make morphnode) || { echo "Error: morphnode build failed."; exit 1; }; \ mkdir -p ./bin; \ @@ -116,24 +176,74 @@ build-morphnode: submodule-init echo "morphnode binary copied to morph-node/bin/morphnode"; \ fi -## Build morph-reth from source (requires the Rust toolchain / cargo). morph-reth -## lives in its own repo (https://github.com/morph-l2/morph-reth), not a submodule, -## so we clone it under ../morph-reth on first build. +## Build morph-reth from the pinned git submodule (requires Rust >= 1.95, libclang-dev, pkg-config). build-reth: - @if [ -f ./bin/morph-reth ]; then \ - echo "morph-reth binary already exists at ./bin/morph-reth, skipping build."; \ + @if [ -x ./bin/morph-reth ] && [ "$${FORCE_BUILD:-0}" != "1" ] && ./bin/morph-reth --version 2>/dev/null | head -n1 | grep -qE "Morph-Reth Version: $(RETH_VERSION)([^0-9.]|$$)"; then \ + echo "morph-reth v$(RETH_VERSION) already exists at ./bin/morph-reth, skipping build (set FORCE_BUILD=1 to rebuild)."; \ + else \ + echo "Building morph-reth v$(RETH_VERSION) (profile: $(RETH_BUILD_PROFILE)) from source..."; \ + (cd .. && git submodule update --init morph-reth) || { echo "Error: failed to init morph-reth submodule."; exit 1; }; \ + (cd ../morph-reth && \ + TARGET_SHA=$$(git rev-list -n 1 "v$(RETH_VERSION)" 2>/dev/null || true); \ + CUR_SHA=$$(git rev-parse HEAD); \ + if [ -z "$$TARGET_SHA" ] || [ "$$CUR_SHA" != "$$TARGET_SHA" ]; then \ + echo "Checking out v$(RETH_VERSION)..."; \ + git fetch --tags && git checkout "v$(RETH_VERSION)"; \ + fi) || { echo "Error: failed to checkout morph-reth v$(RETH_VERSION)."; exit 1; }; \ + (cd ../morph-reth && cargo build --profile "$(RETH_BUILD_PROFILE)" --locked --bin morph-reth) || { echo "Error: morph-reth build failed."; exit 1; }; \ + mkdir -p ./bin; \ + cp "../morph-reth/target/$(RETH_BUILD_PROFILE)/morph-reth" ./bin/morph-reth || { echo "Error: failed to copy morph-reth binary to morph-node/bin/morph-reth."; exit 1; }; \ + chmod +x ./bin/morph-reth; \ + echo "morph-reth v$(RETH_VERSION) binary copied to morph-node/bin/morph-reth"; \ + fi + +## Download pre-built morph-reth binary from GitHub Releases (Linux x86_64 / aarch64) with SHA-256 verification. +download-reth-binary: + @if [ -x ./bin/morph-reth ] && [ "$${FORCE_BUILD:-0}" != "1" ] && ./bin/morph-reth --version 2>/dev/null | head -n1 | grep -qE "Morph-Reth Version: $(RETH_VERSION)([^0-9.]|$$)"; then \ + echo "morph-reth v$(RETH_VERSION) already exists at ./bin/morph-reth, skipping download (set FORCE_BUILD=1 to re-download)."; \ else \ - echo "Building morph-reth v$(RETH_VERSION) from source..."; \ - if [ ! -d ../morph-reth ]; then \ - echo "Cloning morph-reth..."; \ - git clone https://github.com/morph-l2/morph-reth.git ../morph-reth || { echo "Error: failed to clone morph-reth."; exit 1; }; \ + OS=$$(uname -s); \ + if [ "$$OS" != "Linux" ]; then \ + echo "Error: pre-built morph-reth binaries are only published for Linux (got $$OS). Use 'make build-reth' instead."; \ + exit 1; \ fi; \ - echo "Checking out v$(RETH_VERSION) (pinned to match docker-compose.reth.yml)..."; \ - (cd ../morph-reth && git fetch --tags && git checkout v$(RETH_VERSION)) || { echo "Error: failed to checkout morph-reth v$(RETH_VERSION)."; exit 1; }; \ - (cd ../morph-reth && cargo build --release) || { echo "Error: morph-reth build failed."; exit 1; }; \ + RAW_ARCH=$$(uname -m); \ + case "$$RAW_ARCH" in \ + x86_64|amd64) ARCH="x86_64-linux" ;; \ + aarch64|arm64) ARCH="aarch64-linux" ;; \ + *) echo "Error: unsupported architecture $$RAW_ARCH. Use 'make build-reth' instead."; exit 1 ;; \ + esac; \ + ARCHIVE="morph-reth-$(RETH_VERSION)-$${ARCH}.tar.gz"; \ + BASE_URL="https://github.com/morph-l2/morph-reth/releases/download/v$(RETH_VERSION)"; \ + TMP_DIR=$$(mktemp -d); \ + trap 'rm -rf "$$TMP_DIR"' EXIT; \ + echo "Downloading $$ARCHIVE from $$BASE_URL..."; \ + if command -v curl >/dev/null 2>&1; then \ + curl -fsSL "$$BASE_URL/$$ARCHIVE" -o "$$TMP_DIR/$$ARCHIVE" || { echo "Error: failed to download $$ARCHIVE."; exit 1; }; \ + curl -fsSL "$$BASE_URL/$$ARCHIVE.sha256" -o "$$TMP_DIR/$$ARCHIVE.sha256" || { echo "Error: failed to download $$ARCHIVE.sha256."; exit 1; }; \ + elif command -v wget >/dev/null 2>&1; then \ + wget -O "$$TMP_DIR/$$ARCHIVE" "$$BASE_URL/$$ARCHIVE" || { echo "Error: failed to download $$ARCHIVE."; exit 1; }; \ + wget -O "$$TMP_DIR/$$ARCHIVE.sha256" "$$BASE_URL/$$ARCHIVE.sha256" || { echo "Error: failed to download $$ARCHIVE.sha256."; exit 1; }; \ + else \ + echo "Error: curl or wget is required."; exit 1; \ + fi; \ + EXPECTED=$$(awk '{print $$1}' "$$TMP_DIR/$$ARCHIVE.sha256"); \ + if command -v sha256sum >/dev/null 2>&1; then \ + ACTUAL=$$(sha256sum "$$TMP_DIR/$$ARCHIVE" | awk '{print $$1}'); \ + elif command -v shasum >/dev/null 2>&1; then \ + ACTUAL=$$(shasum -a 256 "$$TMP_DIR/$$ARCHIVE" | awk '{print $$1}'); \ + else \ + ACTUAL=$$(openssl dgst -sha256 "$$TMP_DIR/$$ARCHIVE" | awk '{print $$NF}'); \ + fi; \ + if [ "$$EXPECTED" != "$$ACTUAL" ]; then \ + echo "Error: SHA-256 mismatch for $$ARCHIVE (expected $$EXPECTED, got $$ACTUAL)."; \ + exit 1; \ + fi; \ + echo "SHA-256 verified ($$ACTUAL). Extracting..."; \ mkdir -p ./bin; \ - cp ../morph-reth/target/release/morph-reth ./bin/morph-reth || { echo "Error: failed to copy morph-reth binary to morph-node/bin/morph-reth."; exit 1; }; \ - echo "morph-reth binary copied to morph-node/bin/morph-reth"; \ + tar -xzf "$$TMP_DIR/$$ARCHIVE" -C ./bin morph-reth || { echo "Error: failed to extract morph-reth."; exit 1; }; \ + chmod +x ./bin/morph-reth; \ + echo "morph-reth v$(RETH_VERSION) installed to morph-node/bin/morph-reth"; \ fi build: build-geth build-morphnode @@ -143,7 +253,7 @@ build: build-geth build-morphnode build-reth-all: build-reth build-morphnode @echo "All reth binaries built successfully." -## binary mode +## binary mode (geth) run-node-binary: generate-jwt @echo "You are about to run a Mainnet node (binary mode)." @{ [ -t 0 ] || { echo "Error: interactive confirmation required (run in a TTY)."; exit 1; }; printf "Continue? [Y/n] "; read confirm; if [ "$$confirm" = "n" ] || [ "$$confirm" = "N" ]; then exit 1; fi; } @@ -179,101 +289,218 @@ run-hoodi-reth-node-binary: generate-jwt-hoodi @{ [ -t 0 ] || { echo "Error: interactive confirmation required (run in a TTY)."; exit 1; }; printf "Continue? [Y/n] "; read confirm; if [ "$$confirm" = "n" ] || [ "$$confirm" = "N" ]; then exit 1; fi; } sh ./run-binary-reth.sh .env_hoodi +run-reth-validator-binary: generate-jwt + @echo "You are about to run a Mainnet reth node in validator mode (--derivation.verify-mode=layer1, binary)." + @{ [ -t 0 ] || { echo "Error: interactive confirmation required (run in a TTY)."; exit 1; }; printf "Continue? [Y/n] "; read confirm; if [ "$$confirm" = "n" ] || [ "$$confirm" = "N" ]; then exit 1; fi; } + MORPH_NODE_DERIVATION_VERIFY_MODE=layer1 sh ./run-binary-reth.sh .env + +run-hoodi-reth-validator-binary: generate-jwt-hoodi + @echo "You are about to run a Hoodi reth node in validator mode (--derivation.verify-mode=layer1, binary)." + @{ [ -t 0 ] || { echo "Error: interactive confirmation required (run in a TTY)."; exit 1; }; printf "Continue? [Y/n] "; read confirm; if [ "$$confirm" = "n" ] || [ "$$confirm" = "N" ]; then exit 1; fi; } + MORPH_NODE_DERIVATION_VERIFY_MODE=layer1 sh ./run-binary-reth.sh .env_hoodi + +## Graceful binary shutdown: stop morphnode first, then the execution client, waiting for DB flush. stop-binary: - @if [ -f .geth.pid ]; then kill $$(cat .geth.pid) 2>/dev/null; rm -f .geth.pid; echo "geth stopped."; fi - @if [ -f .reth.pid ]; then kill $$(cat .reth.pid) 2>/dev/null; rm -f .reth.pid; echo "reth stopped."; fi - @if [ -f .node.pid ]; then kill $$(cat .node.pid) 2>/dev/null; rm -f .node.pid; echo "morphnode stopped."; fi + @stop_pid() { \ + pidfile="$$1"; name="$$2"; timeout="$$3"; \ + if [ -f "$$pidfile" ]; then \ + pid=$$(cat "$$pidfile"); \ + if kill -0 "$$pid" 2>/dev/null; then \ + echo "Stopping $$name (PID $$pid)..."; \ + kill -TERM "$$pid" 2>/dev/null || true; \ + elapsed=0; \ + while kill -0 "$$pid" 2>/dev/null && [ "$$elapsed" -lt "$$timeout" ]; do \ + sleep 1; \ + elapsed=$$((elapsed + 1)); \ + done; \ + if kill -0 "$$pid" 2>/dev/null; then \ + echo "Warning: $$name (PID $$pid) still running after $${timeout}s."; \ + else \ + echo "$$name stopped."; \ + fi; \ + else \ + echo "$$name was not running."; \ + fi; \ + rm -f "$$pidfile"; \ + fi; \ + }; \ + stop_pid .node.pid "morphnode" 60; \ + stop_pid .reth.pid "morph-reth" 120; \ + stop_pid .geth.pid "geth" 120 clean-mainnet-binary: - @echo "Cleaning mainnet snapshot data (keeping config)..." - rm -rf ../mainnet/geth-data/geth - rm -rf ../mainnet/node-data/data/* - @printf '{\n "height": "0",\n "round": 0,\n "step": 0\n}\n' > ../mainnet/node-data/data/priv_validator_state.json + @echo "Cleaning mainnet geth snapshot data at $(MORPH_HOME_MAINNET) (keeping config)..." + rm -rf "$(MORPH_HOME_MAINNET)/geth-data/geth" + rm -rf "$(MORPH_HOME_MAINNET)/node-data/data/"* + mkdir -p "$(MORPH_HOME_MAINNET)/node-data/data" + @printf '{\n "height": "0",\n "round": 0,\n "step": 0\n}\n' > "$(MORPH_HOME_MAINNET)/node-data/data/priv_validator_state.json" @echo "Mainnet snapshot data cleaned." clean-hoodi-binary: - @echo "Cleaning hoodi snapshot data (keeping config)..." - rm -rf ../hoodi/geth-data/geth - rm -rf ../hoodi/node-data/data/* - @printf '{\n "height": "0",\n "round": 0,\n "step": 0\n}\n' > ../hoodi/node-data/data/priv_validator_state.json + @echo "Cleaning hoodi geth snapshot data at $(MORPH_HOME_HOODI) (keeping config)..." + rm -rf "$(MORPH_HOME_HOODI)/geth-data/geth" + rm -rf "$(MORPH_HOME_HOODI)/node-data/data/"* + mkdir -p "$(MORPH_HOME_HOODI)/node-data/data" + @printf '{\n "height": "0",\n "round": 0,\n "step": 0\n}\n' > "$(MORPH_HOME_HOODI)/node-data/data/priv_validator_state.json" @echo "Hoodi snapshot data cleaned." clean-mainnet-reth: - @echo "Cleaning mainnet reth snapshot data (keeping config)..." - rm -rf ../mainnet/reth-data/db ../mainnet/reth-data/static_files ../mainnet/reth-data/rocksdb ../mainnet/reth-data/morph - rm -rf ../mainnet/node-data/data/* - @printf '{\n "height": "0",\n "round": 0,\n "step": 0\n}\n' > ../mainnet/node-data/data/priv_validator_state.json + @echo "Cleaning mainnet reth snapshot data at $(RETH_HOME_MAINNET) (keeping config and static-nodes.json)..." + rm -rf "$(RETH_HOME_MAINNET)/reth-data/db" \ + "$(RETH_HOME_MAINNET)/reth-data/static_files" \ + "$(RETH_HOME_MAINNET)/reth-data/rocksdb" \ + "$(RETH_HOME_MAINNET)/reth-data/morph" \ + "$(RETH_HOME_MAINNET)/reth-data/historical-proofs" \ + "$(RETH_HOME_MAINNET)/reth-data/exex" \ + "$(RETH_HOME_MAINNET)/reth-data/blobstore" \ + "$(RETH_HOME_MAINNET)/reth-data/txpool-transactions-backup.rlp" \ + "$(RETH_HOME_MAINNET)/reth-data/known-peers.json" \ + "$(RETH_HOME_MAINNET)/reth-data/invalid_block_hooks" \ + "$(RETH_HOME_MAINNET)/reth-data/logs" \ + "$(RETH_HOME_MAINNET)/reth-data/"reth.log* + rm -rf "$(RETH_HOME_MAINNET)/node-data/data/"* + mkdir -p "$(RETH_HOME_MAINNET)/node-data/data" + @printf '{\n "height": "0",\n "round": 0,\n "step": 0\n}\n' > "$(RETH_HOME_MAINNET)/node-data/data/priv_validator_state.json" @echo "Mainnet reth snapshot data cleaned." clean-hoodi-reth: - @echo "Cleaning hoodi reth snapshot data (keeping config)..." - rm -rf ../hoodi/reth-data/db ../hoodi/reth-data/static_files ../hoodi/reth-data/rocksdb ../hoodi/reth-data/morph - rm -rf ../hoodi/node-data/data/* - @printf '{\n "height": "0",\n "round": 0,\n "step": 0\n}\n' > ../hoodi/node-data/data/priv_validator_state.json + @echo "Cleaning hoodi reth snapshot data at $(RETH_HOME_HOODI) (keeping config and static-nodes.json)..." + rm -rf "$(RETH_HOME_HOODI)/reth-data/db" \ + "$(RETH_HOME_HOODI)/reth-data/static_files" \ + "$(RETH_HOME_HOODI)/reth-data/rocksdb" \ + "$(RETH_HOME_HOODI)/reth-data/morph" \ + "$(RETH_HOME_HOODI)/reth-data/historical-proofs" \ + "$(RETH_HOME_HOODI)/reth-data/exex" \ + "$(RETH_HOME_HOODI)/reth-data/blobstore" \ + "$(RETH_HOME_HOODI)/reth-data/txpool-transactions-backup.rlp" \ + "$(RETH_HOME_HOODI)/reth-data/known-peers.json" \ + "$(RETH_HOME_HOODI)/reth-data/invalid_block_hooks" \ + "$(RETH_HOME_HOODI)/reth-data/logs" \ + "$(RETH_HOME_HOODI)/reth-data/"reth.log* + rm -rf "$(RETH_HOME_HOODI)/node-data/data/"* + mkdir -p "$(RETH_HOME_HOODI)/node-data/data" + @printf '{\n "height": "0",\n "round": 0,\n "step": 0\n}\n' > "$(RETH_HOME_HOODI)/node-data/data/priv_validator_state.json" @echo "Hoodi reth snapshot data cleaned." -# Helper: download, extract, and move snapshot data into MORPH_HOME -# $(1) = snapshot name, $(2) = download URL base, $(3) = MORPH_HOME +# Helper: download tarball with resume and verify SHA-256 checksum against $(2)/$(1).tar.gz.sha256. +# $(1) = snapshot name, $(2) = download URL base, $(3) = target directory +define fetch-and-verify-snapshot + mkdir -p "$(3)"; \ + if [ ! -f "$(3)/$(1).tar.gz" ] || [ "$(SKIP_SHA256_CHECK)" != "1" ]; then \ + echo "Downloading $(1).tar.gz from $(2)..."; \ + wget -c -O "$(3)/$(1).tar.gz" "$(2)/$(1).tar.gz" || { echo "Error: download failed."; exit 1; }; \ + else \ + echo "Found existing $(3)/$(1).tar.gz, skipping download."; \ + fi; \ + if [ "$(SKIP_SHA256_CHECK)" != "1" ]; then \ + echo "Verifying SHA-256 checksum for $(1).tar.gz..."; \ + wget -q -O "$(3)/$(1).tar.gz.sha256" "$(2)/$(1).tar.gz.sha256" || { echo "Error: failed to download $(1).tar.gz.sha256 (set SKIP_SHA256_CHECK=1 to bypass)."; exit 1; }; \ + EXPECTED=$$(awk '{print $$1}' "$(3)/$(1).tar.gz.sha256"); \ + if command -v sha256sum >/dev/null 2>&1; then \ + ACTUAL=$$(sha256sum "$(3)/$(1).tar.gz" | awk '{print $$1}'); \ + elif command -v shasum >/dev/null 2>&1; then \ + ACTUAL=$$(shasum -a 256 "$(3)/$(1).tar.gz" | awk '{print $$1}'); \ + else \ + ACTUAL=$$(openssl dgst -sha256 "$(3)/$(1).tar.gz" | awk '{print $$NF}'); \ + fi; \ + rm -f "$(3)/$(1).tar.gz.sha256"; \ + if [ "$$EXPECTED" != "$$ACTUAL" ]; then \ + echo "Error: SHA-256 mismatch for $(3)/$(1).tar.gz (expected $$EXPECTED, got $$ACTUAL)."; \ + echo "Remove the corrupted tarball and retry."; \ + exit 1; \ + fi; \ + echo "SHA-256 verified ($$ACTUAL)."; \ + fi +endef + +# Helper: extract tarball (uses pigz when available for faster multi-core decompression). +# $(1) = tarball path, $(2) = destination directory +define extract-tar-gz + if command -v pigz >/dev/null 2>&1; then \ + pigz -dc "$(1)" | tar -xf - -C "$(2)" || { echo "Error: extraction failed."; exit 1; }; \ + else \ + tar -xzf "$(1)" -C "$(2)" || { echo "Error: extraction failed."; exit 1; }; \ + fi +endef + +# Helper: download, extract, and move geth snapshot data into MORPH_HOME. +# Cleans existing Tendermint DB members before moving so switching snapshots or +# clients never fails halfway with "Directory not empty". +# $(1) = snapshot name, $(2) = download URL base, $(3) = MORPH_HOME, $(4) = network (mainnet|hoodi) define setup-snapshot-data @if [ -d "$(3)/geth-data/geth/chaindata" ]; then \ echo "Snapshot data already in place at $(3), skipping setup."; \ else \ echo "Setting up snapshot data for $(3)..."; \ if [ ! -d "$(3)/$(1)" ]; then \ - if [ ! -f "$(3)/$(1).tar.gz" ]; then \ - echo "Downloading $(1).tar.gz from $(2)..."; \ - wget -O $(3)/$(1).tar.gz $(2)/$(1).tar.gz || { echo "Error: download failed."; exit 1; }; \ - else \ - echo "Found existing $(3)/$(1).tar.gz, skipping download."; \ - fi; \ + $(call fetch-and-verify-snapshot,$(1),$(2),$(3)); \ echo "Extracting $(1).tar.gz..."; \ - tar -xzf $(3)/$(1).tar.gz -C $(3) || { echo "Error: extraction failed."; exit 1; }; \ - rm -f $(3)/$(1).tar.gz; \ + $(call extract-tar-gz,$(3)/$(1).tar.gz,$(3)); \ + rm -f "$(3)/$(1).tar.gz"; \ else \ echo "Found existing $(3)/$(1)/ directory, skipping download."; \ fi; \ - mkdir -p $(3)/geth-data $(3)/node-data/data; \ + [ -d "$(3)/$(1)/geth/chaindata" ] || { echo "Error: expected $(3)/$(1)/geth/chaindata — is $(1) a geth snapshot?"; exit 1; }; \ + [ -d "$(3)/$(1)/data" ] || { echo "Error: expected $(3)/$(1)/data in snapshot $(1)."; exit 1; }; \ + mkdir -p "$(3)/geth-data" "$(3)/node-data/data" "$(3)/node-data/config"; \ + [ -f "$(3)/node-data/config/config.toml" ] || cp "../$(4)/node-data/config/config.toml" "$(3)/node-data/config/config.toml"; \ + [ -f "$(3)/node-data/config/genesis.json" ] || cp "../$(4)/node-data/config/genesis.json" "$(3)/node-data/config/genesis.json"; \ + [ -f "$(3)/geth-data/static-nodes.json" ] || cp "../$(4)/geth-data/static-nodes.json" "$(3)/geth-data/static-nodes.json"; \ echo "Moving geth data to $(3)/geth-data/..."; \ - mv $(3)/$(1)/geth $(3)/geth-data/ || { echo "Error: failed to move geth data (may already exist)."; exit 1; }; \ - echo "Moving node data to $(3)/node-data/data/..."; \ - mv $(3)/$(1)/data/* $(3)/node-data/data/ || { echo "Error: failed to move node data."; exit 1; }; \ - rm -rf $(3)/$(1); \ - [ -f "$(3)/node-data/data/priv_validator_state.json" ] || printf '{\n "height": "0",\n "round": 0,\n "step": 0\n}\n' > $(3)/node-data/data/priv_validator_state.json; \ + rm -rf "$(3)/geth-data/geth"; \ + mv "$(3)/$(1)/geth" "$(3)/geth-data/" || { echo "Error: failed to move geth data."; exit 1; }; \ + echo "Replacing node data in $(3)/node-data/data/..."; \ + rm -rf "$(3)/node-data/data/"*; \ + for item in "$(3)/$(1)/data/"*; do \ + [ -e "$$item" ] || continue; \ + mv "$$item" "$(3)/node-data/data/" || { echo "Error: failed to move $$item."; exit 1; }; \ + done; \ + rm -rf "$(3)/$(1)"; \ + [ -f "$(3)/node-data/data/priv_validator_state.json" ] || printf '{\n "height": "0",\n "round": 0,\n "step": 0\n}\n' > "$(3)/node-data/data/priv_validator_state.json"; \ echo "Snapshot data ready at $(3)."; \ fi endef # Helper: download, extract, and move a RETH snapshot into RETH_HOME. Reth snapshots # pack a different layout than geth: /reth-data/{db,static_files,rocksdb,morph} -# plus /data/* for the node. static-nodes.json is NOT in the snapshot, so we -# copy it from geth-data/ (already tracked in the repo) into reth-data/ for --trusted-peers. -# $(1) = snapshot name, $(2) = download URL base, $(3) = RETH_HOME +# plus /data/* for the node. Cleans existing node-data/data and stale +# reth-data members before moving so migrating from geth or switching snapshots is safe. +# $(1) = snapshot name, $(2) = download URL base, $(3) = RETH_HOME, $(4) = network (mainnet|hoodi) define setup-snapshot-data-reth @if [ -d "$(3)/reth-data/db" ]; then \ echo "Reth snapshot data already in place at $(3), skipping setup."; \ else \ echo "Setting up reth snapshot data for $(3)..."; \ if [ ! -d "$(3)/$(1)" ]; then \ - if [ ! -f "$(3)/$(1).tar.gz" ]; then \ - echo "Downloading $(1).tar.gz from $(2)..."; \ - wget -O $(3)/$(1).tar.gz $(2)/$(1).tar.gz || { echo "Error: download failed."; exit 1; }; \ - else \ - echo "Found existing $(3)/$(1).tar.gz, skipping download."; \ - fi; \ + $(call fetch-and-verify-snapshot,$(1),$(2),$(3)); \ echo "Extracting $(1).tar.gz..."; \ - tar -xzf $(3)/$(1).tar.gz -C $(3) || { echo "Error: extraction failed."; exit 1; }; \ - rm -f $(3)/$(1).tar.gz; \ + $(call extract-tar-gz,$(3)/$(1).tar.gz,$(3)); \ + rm -f "$(3)/$(1).tar.gz"; \ else \ echo "Found existing $(3)/$(1)/ directory, skipping download."; \ fi; \ - mkdir -p $(3)/reth-data $(3)/node-data/data; \ - echo "Moving reth data to $(3)/reth-data/..."; \ - mv $(3)/$(1)/reth-data/* $(3)/reth-data/ || { echo "Error: failed to move reth data (may already exist)."; exit 1; }; \ - echo "Moving node data to $(3)/node-data/data/..."; \ - mv $(3)/$(1)/data/* $(3)/node-data/data/ || { echo "Error: failed to move node data."; exit 1; }; \ - rm -rf $(3)/$(1); \ - [ -f "$(3)/reth-data/static-nodes.json" ] || cp $(3)/geth-data/static-nodes.json $(3)/reth-data/static-nodes.json 2>/dev/null || echo "Warning: no static-nodes.json found in $(3)/geth-data/; --trusted-peers will be empty."; \ - [ -f "$(3)/node-data/data/priv_validator_state.json" ] || printf '{\n "height": "0",\n "round": 0,\n "step": 0\n}\n' > $(3)/node-data/data/priv_validator_state.json; \ + [ -d "$(3)/$(1)/reth-data/db" ] || { echo "Error: expected $(3)/$(1)/reth-data/db — is $(1) a reth snapshot?"; exit 1; }; \ + [ -d "$(3)/$(1)/data" ] || { echo "Error: expected $(3)/$(1)/data in snapshot $(1)."; exit 1; }; \ + mkdir -p "$(3)/reth-data/logs" "$(3)/node-data/data" "$(3)/node-data/config"; \ + [ -f "$(3)/node-data/config/config.toml" ] || cp "../$(4)/node-data/config/config.toml" "$(3)/node-data/config/config.toml"; \ + [ -f "$(3)/node-data/config/genesis.json" ] || cp "../$(4)/node-data/config/genesis.json" "$(3)/node-data/config/genesis.json"; \ + echo "Replacing reth data in $(3)/reth-data/..."; \ + rm -rf "$(3)/reth-data/historical-proofs"; \ + for item in "$(3)/$(1)/reth-data/"*; do \ + [ -e "$$item" ] || continue; \ + base=$$(basename "$$item"); \ + rm -rf "$(3)/reth-data/$$base"; \ + mv "$$item" "$(3)/reth-data/" || { echo "Error: failed to move $$item."; exit 1; }; \ + done; \ + echo "Replacing node data in $(3)/node-data/data/..."; \ + rm -rf "$(3)/node-data/data/"*; \ + for item in "$(3)/$(1)/data/"*; do \ + [ -e "$$item" ] || continue; \ + mv "$$item" "$(3)/node-data/data/" || { echo "Error: failed to move $$item."; exit 1; }; \ + done; \ + rm -rf "$(3)/$(1)"; \ + [ -f "$(3)/reth-data/static-nodes.json" ] || cp "../$(4)/reth-data/static-nodes.json" "$(3)/reth-data/static-nodes.json" 2>/dev/null || echo "Warning: no static-nodes.json found in ../$(4)/reth-data/; --trusted-peers will be empty."; \ + [ -f "$(3)/node-data/data/priv_validator_state.json" ] || printf '{\n "height": "0",\n "round": 0,\n "step": 0\n}\n' > "$(3)/node-data/data/priv_validator_state.json"; \ echo "Reth snapshot data ready at $(3)."; \ fi endef @@ -282,47 +509,47 @@ endef quickstart-hoodi-node: generate-jwt-hoodi @echo "=== Quickstart: Hoodi Node (Docker) ===" - $(call setup-snapshot-data,$(HOODI_SNAPSHOT_NAME),https://snapshot.morph.network/hoodi,../hoodi) - docker-compose --env-file .env_hoodi up node + $(call setup-snapshot-data,$(HOODI_SNAPSHOT_NAME),https://snapshot.morph.network/hoodi,$(MORPH_HOME_HOODI),hoodi) + $(COMPOSE) --env-file .env_hoodi up node quickstart-hoodi-node-binary: generate-jwt-hoodi build @echo "=== Quickstart: Hoodi Node (Binary) ===" - $(call setup-snapshot-data,$(HOODI_SNAPSHOT_NAME),https://snapshot.morph.network/hoodi,../hoodi) + $(call setup-snapshot-data,$(HOODI_SNAPSHOT_NAME),https://snapshot.morph.network/hoodi,$(MORPH_HOME_HOODI),hoodi) sh ./run-binary.sh .env_hoodi quickstart-mainnet-node: generate-jwt @echo "=== Quickstart: Mainnet Node (Docker) ===" - $(call setup-snapshot-data,$(MAINNET_SNAPSHOT_NAME),https://snapshot.morph.network/mainnet,../mainnet) - docker-compose --env-file .env up node + $(call setup-snapshot-data,$(MAINNET_SNAPSHOT_NAME),https://snapshot.morph.network/mainnet,$(MORPH_HOME_MAINNET),mainnet) + $(COMPOSE) --env-file .env up node quickstart-mainnet-node-binary: generate-jwt build @echo "=== Quickstart: Mainnet Node (Binary) ===" - $(call setup-snapshot-data,$(MAINNET_SNAPSHOT_NAME),https://snapshot.morph.network/mainnet,../mainnet) + $(call setup-snapshot-data,$(MAINNET_SNAPSHOT_NAME),https://snapshot.morph.network/mainnet,$(MORPH_HOME_MAINNET),mainnet) sh ./run-binary.sh .env -## reth quickstart targets (use the reth snapshot + reth execution client) +## reth quickstart targets (use the reth snapshot + morph-reth execution client) quickstart-hoodi-reth-node: generate-jwt-hoodi @echo "=== Quickstart: Hoodi Node with reth (Docker) ===" - $(call setup-snapshot-data-reth,$(HOODI_RETH_SNAPSHOT_NAME),https://snapshot.morph.network/hoodi,../hoodi) - docker-compose -f docker-compose.reth.yml --env-file .env_hoodi up node + $(call setup-snapshot-data-reth,$(HOODI_RETH_SNAPSHOT_NAME),https://snapshot.morph.network/hoodi,$(RETH_HOME_HOODI),hoodi) + RETH_UID=$$(id -u) RETH_GID=$$(id -g) $(COMPOSE) -f docker-compose.reth.yml --env-file .env_hoodi up node quickstart-hoodi-reth-node-binary: generate-jwt-hoodi build-reth-all @echo "=== Quickstart: Hoodi Node with reth (Binary) ===" - $(call setup-snapshot-data-reth,$(HOODI_RETH_SNAPSHOT_NAME),https://snapshot.morph.network/hoodi,../hoodi) + $(call setup-snapshot-data-reth,$(HOODI_RETH_SNAPSHOT_NAME),https://snapshot.morph.network/hoodi,$(RETH_HOME_HOODI),hoodi) sh ./run-binary-reth.sh .env_hoodi quickstart-mainnet-reth-node: generate-jwt @echo "=== Quickstart: Mainnet Node with reth (Docker) ===" - $(call setup-snapshot-data-reth,$(MAINNET_RETH_SNAPSHOT_NAME),https://snapshot.morph.network/mainnet,../mainnet) - docker-compose -f docker-compose.reth.yml --env-file .env up node + $(call setup-snapshot-data-reth,$(MAINNET_RETH_SNAPSHOT_NAME),https://snapshot.morph.network/mainnet,$(RETH_HOME_MAINNET),mainnet) + RETH_UID=$$(id -u) RETH_GID=$$(id -g) $(COMPOSE) -f docker-compose.reth.yml --env-file .env up node quickstart-mainnet-reth-node-binary: generate-jwt build-reth-all @echo "=== Quickstart: Mainnet Node with reth (Binary) ===" - $(call setup-snapshot-data-reth,$(MAINNET_RETH_SNAPSHOT_NAME),https://snapshot.morph.network/mainnet,../mainnet) + $(call setup-snapshot-data-reth,$(MAINNET_RETH_SNAPSHOT_NAME),https://snapshot.morph.network/mainnet,$(RETH_HOME_MAINNET),mainnet) sh ./run-binary-reth.sh .env -# Common function for download and decompress +# Common function for download, SHA-256 verification, and decompression # $(1) = snapshot name, $(2) = download URL base, $(3) = target directory define download-and-decompress @echo "Checking for required tools (wget, tar)..."; \ @@ -335,43 +562,29 @@ define download-and-decompress exit 1; \ fi; \ echo "Tools are available."; \ - mkdir -p $(3); \ - echo "Downloading $(1).tar.gz from $(2)..."; \ - if wget -O $(3)/$(1).tar.gz $(2)/$(1).tar.gz; then \ - echo "$(1).tar.gz downloaded successfully."; \ - else \ - echo "Error downloading $(1).tar.gz."; \ - exit 1; \ - fi; \ + $(call fetch-and-verify-snapshot,$(1),$(2),$(3)); \ echo "Decompressing $(1).tar.gz..."; \ - if tar -xzvf $(3)/$(1).tar.gz -C $(3); then \ - echo "$(1).tar.gz decompressed successfully."; \ - else \ - echo "Error decompressing $(1).tar.gz."; \ - exit 1; \ - fi; \ - rm -rf $(3)/$(1).tar.gz; + $(call extract-tar-gz,$(3)/$(1).tar.gz,$(3)); \ + echo "$(1).tar.gz decompressed successfully."; \ + rm -f "$(3)/$(1).tar.gz"; endef # Targets download-and-decompress-mainnet-snapshot: - $(call download-and-decompress,$(MAINNET_SNAPSHOT_NAME),https://snapshot.morph.network/mainnet,../mainnet) + $(call download-and-decompress,$(MAINNET_SNAPSHOT_NAME),https://snapshot.morph.network/mainnet,$(MORPH_HOME_MAINNET)) download-and-decompress-hoodi-snapshot: - $(call download-and-decompress,$(HOODI_SNAPSHOT_NAME),https://snapshot.morph.network/hoodi,../hoodi) + $(call download-and-decompress,$(HOODI_SNAPSHOT_NAME),https://snapshot.morph.network/hoodi,$(MORPH_HOME_HOODI)) ## reth snapshots (separate from the geth snapshots above) download-and-decompress-mainnet-reth-snapshot: - $(call download-and-decompress,$(MAINNET_RETH_SNAPSHOT_NAME),https://snapshot.morph.network/mainnet,../mainnet) + $(call download-and-decompress,$(MAINNET_RETH_SNAPSHOT_NAME),https://snapshot.morph.network/mainnet,$(RETH_HOME_MAINNET)) download-and-decompress-hoodi-reth-snapshot: - $(call download-and-decompress,$(HOODI_RETH_SNAPSHOT_NAME),https://snapshot.morph.network/hoodi,../hoodi) + $(call download-and-decompress,$(HOODI_RETH_SNAPSHOT_NAME),https://snapshot.morph.network/hoodi,$(RETH_HOME_HOODI)) # Backward-compatible aliases used in older PR/test plans download-and-decompress-mainnet-mpt-snapshot: download-and-decompress-mainnet-snapshot download-and-decompress-hoodi-mpt-snapshot: download-and-decompress-hoodi-snapshot - - - diff --git a/morph-node/docker-compose.reth.yml b/morph-node/docker-compose.reth.yml index b7a2e3a..bda5d54 100644 --- a/morph-node/docker-compose.reth.yml +++ b/morph-node/docker-compose.reth.yml @@ -1,25 +1,49 @@ services: reth: - container_name: morph-reth + container_name: ${RETH_CONTAINER_NAME:-morph-reth} image: ghcr.io/morph-l2/morph-reth:v1.5.0 + # The published morph-reth image drops privileges to USER morph-reth (~UID 999), + # which cannot write to host bind mounts owned by the host user or root on Linux. + # Makefile passes RETH_UID=$(id -u) RETH_GID=$(id -g) so the container runs as the + # host user; direct `docker compose` falls back to 0:0 (matching docker-compose.yml). + user: "${RETH_UID:-0}:${RETH_GID:-0}" restart: unless-stopped # give the process time to shut down cleanly on docker stop before it is SIGKILLed (default 10s) stop_grace_period: 2m + # MDBX + RocksDB + static_files + P2P easily exceed the legacy 1024 FD soft limit + ulimits: + nofile: + soft: 65535 + hard: 65535 + # Pure bash TCP probe (ubuntu:24.04 runtime image has no curl/wget/nc) + healthcheck: + test: ["CMD-SHELL", "bash -c 'exec 3<>/dev/tcp/127.0.0.1/8551'"] + interval: 15s + timeout: 5s + retries: 5 + start_period: 60s ports: - - "8545:8545" - - "8546:8546" + - "${RETH_RPC_PORT:-8545}:8545" + - "${RETH_WS_PORT:-8546}:8546" - "8551" - - "6060" - - "30303" + - "${RETH_METRICS_PORT:-6060}:6060" + - "${RETH_P2P_PORT:-30303}:30303" volumes: - "${RETH_HOME}/reth-data:/db" - - "${JWT_SECRET_FILE}:/jwt-secret.txt" - - "${RETH_ENTRYPOINT_FILE}:/entrypoint.sh" + - "${JWT_SECRET_FILE}:/jwt-secret.txt:ro" + - "${RETH_ENTRYPOINT_FILE}:/entrypoint.sh:ro" environment: # Chain spec: "mainnet" or "hoodi". - RETH_CHAIN=${RETH_CHAIN} - RETH_DATADIR=/db - - LOG_DIR=/db + - LOG_DIR=/db/logs + - RETH_LOG_FILTER=${RETH_LOG_FILTER:-info} + - RETH_HTTP_API=${RETH_HTTP_API:-web3,debug,eth,txpool,net,trace} + - RETH_WS_API=${RETH_WS_API:-web3,debug,eth,txpool,net,trace} + - RETH_PROOFS_HISTORY=${RETH_PROOFS_HISTORY:-false} + - RETH_PROOFS_WINDOW=${RETH_PROOFS_WINDOW:-} + - RETH_PROOF_PERMITS=${RETH_PROOF_PERMITS:-} + - RETH_EXTRA_FLAGS=${RETH_EXTRA_FLAGS:-} # static-nodes.json lives inside the reth-data volume (mounted at /db) and is # parsed into --trusted-peers by the entrypoint. If absent, --trusted-peers is # omitted rather than failing. @@ -34,7 +58,7 @@ services: # DERIVATION_VERIFY_MODE=layer1 (in .env/.env_hoodi) for the former validator # behavior. L1_BEACON_CHAIN_RPC is required in both modes. node: - container_name: morph-node + container_name: ${RETH_NODE_CONTAINER_NAME:-morph-node} depends_on: reth: condition: service_started @@ -48,8 +72,9 @@ services: - "26658" - "26660" environment: - - MORPH_NODE_L2_ETH_RPC=http://morph-reth:8545 - - MORPH_NODE_L2_ENGINE_RPC=http://morph-reth:8551 + # Use the compose service name `reth` so DNS works even when RETH_CONTAINER_NAME is overridden. + - MORPH_NODE_L2_ETH_RPC=http://reth:8545 + - MORPH_NODE_L2_ENGINE_RPC=http://reth:8551 - MORPH_NODE_L2_ENGINE_AUTH=/jwt-secret.txt - MORPH_NODE_L1_ETH_RPC=${L1_ETH_RPC} - MORPH_NODE_L1_ETH_BEACON_RPC=${L1_BEACON_CHAIN_RPC} @@ -65,8 +90,8 @@ services: - NODE_EXTRA_FLAGS=${NODE_EXTRA_FLAGS:-} volumes: - "${RETH_HOME}/node-data:/db" - - "${JWT_SECRET_FILE}:/jwt-secret.txt" - - "./entrypoint-node.sh:/entrypoint-node.sh" + - "${JWT_SECRET_FILE}:/jwt-secret.txt:ro" + - "./entrypoint-node.sh:/entrypoint-node.sh:ro" entrypoint: - "/bin/sh" - "/entrypoint-node.sh" diff --git a/morph-node/entrypoint-reth.sh b/morph-node/entrypoint-reth.sh index 3ce13cb..0183375 100755 --- a/morph-node/entrypoint-reth.sh +++ b/morph-node/entrypoint-reth.sh @@ -1,4 +1,5 @@ #!/bin/sh +set -eu # Reth execution-client entrypoint. Mirrors entrypoint-geth.sh but launches # morph-reth instead of geth. The two clients use DIFFERENT snapshots (see the @@ -10,42 +11,70 @@ RETH_DATADIR=${RETH_DATADIR:-./db} JWT_PATH=${JWT_SECRET_PATH:-/jwt-secret.txt} # mainnet | hoodi (selects the built-in chain spec). RETH_CHAIN=${RETH_CHAIN:-mainnet} -# Directory reth writes its rotating log file into. -LOG_DIR=${LOG_DIR:-${RETH_DATADIR}} +# Directory reth writes its rotating log files into. +LOG_DIR=${LOG_DIR:-${RETH_DATADIR}/logs} +RETH_LOG_FILTER=${RETH_LOG_FILTER:-info} +# Exposed RPC namespaces. Note: morph-reth v1.5.0 exposes morph_ unconditionally +# and rejects "morph" in --http.api/--ws.api; once upgrading past v1.5.0 (PR #241), +# append ",morph" via RETH_HTTP_API / RETH_WS_API in .env/.env_hoodi. +RETH_HTTP_API=${RETH_HTTP_API:-web3,debug,eth,txpool,net,trace} +RETH_WS_API=${RETH_WS_API:-web3,debug,eth,txpool,net,trace} +# Optional historical proof index for prover-facing nodes. +RETH_PROOFS_HISTORY=${RETH_PROOFS_HISTORY:-false} +RETH_PROOFS_WINDOW=${RETH_PROOFS_WINDOW:-} +RETH_PROOF_PERMITS=${RETH_PROOF_PERMITS:-} +# Optional extra flags passed verbatim to `morph-reth node`. +RETH_EXTRA_FLAGS=${RETH_EXTRA_FLAGS:-} # static-nodes.json (JSON array of enode URLs). Its entries are joined with commas # and passed to --trusted-peers so reth dials the Morph boot nodes directly # (discovery is disabled below). STATIC_NODES_FILE=${STATIC_NODES_FILE:-} if [ ! -f "${JWT_PATH}" ]; then - echo "Error: jwt-secret.txt not found at ${JWT_PATH}." - echo "Please create it before starting the service." + echo "Error: jwt-secret.txt not found at ${JWT_PATH}." >&2 + echo "Please create it before starting the service." >&2 exit 1 fi mkdir -p "${LOG_DIR}" +# Optional historical proofs initialization (idempotent). Mainnet and Hoodi +# genesis blocks predate the Jade (ZK-trie -> MPT) fork, so proof history must +# only be anchored on a restored post-Jade paired snapshot, never an empty DB. +if [ "${RETH_PROOFS_HISTORY}" = "true" ]; then + if [ ! -d "${RETH_DATADIR}/db" ]; then + echo "Error: RETH_PROOFS_HISTORY=true requires an existing post-Jade DB at ${RETH_DATADIR}/db." >&2 + echo "Restore a paired reth snapshot before enabling historical proofs." >&2 + exit 1 + fi + "${RETH_BIN}" proofs init \ + --chain "${RETH_CHAIN}" \ + --datadir "${RETH_DATADIR}" \ + --log.file.directory "${LOG_DIR}" +fi + # Parse static-nodes.json (a JSON array of "enode://..." strings) into a single # comma-separated list for --trusted-peers. No jq dependency: strip everything # that isn't part of an enode URL, then squeeze the newlines into commas. TRUSTED_PEERS="" if [ -n "${STATIC_NODES_FILE}" ] && [ -f "${STATIC_NODES_FILE}" ]; then - TRUSTED_PEERS=$(grep -o 'enode://[^"]*' "${STATIC_NODES_FILE}" | paste -sd, -) + TRUSTED_PEERS=$(grep -o 'enode://[^"]*' "${STATIC_NODES_FILE}" 2>/dev/null | paste -sd, - || true) fi set -- "${RETH_BIN}" node \ --chain "${RETH_CHAIN}" \ --datadir "${RETH_DATADIR}" \ + --ipcdisable \ --http \ --http.addr 0.0.0.0 \ --http.port 8545 \ --http.corsdomain '*' \ - --http.api web3,eth,txpool,net,trace \ + --http.api "${RETH_HTTP_API}" \ --ws \ --ws.addr 0.0.0.0 \ --ws.port 8546 \ --ws.origins '*' \ - --ws.api web3,eth,txpool,net,trace \ + --ws.api "${RETH_WS_API}" \ --authrpc.addr 0.0.0.0 \ --authrpc.port 8551 \ --authrpc.jwtsecret "${JWT_PATH}" \ @@ -53,7 +82,17 @@ set -- "${RETH_BIN}" node \ --nat none \ --metrics 0.0.0.0:6060 \ --log.file.directory "${LOG_DIR}" \ - --log.file.filter info + --log.file.filter "${RETH_LOG_FILTER}" + +if [ "${RETH_PROOFS_HISTORY}" = "true" ]; then + set -- "$@" --proofs-history + if [ -n "${RETH_PROOFS_WINDOW}" ]; then + set -- "$@" --proofs-history.window "${RETH_PROOFS_WINDOW}" + fi + if [ -n "${RETH_PROOF_PERMITS}" ]; then + set -- "$@" --rpc.proof-permits "${RETH_PROOF_PERMITS}" + fi +fi # Only append --trusted-peers when we actually resolved some, so an empty/missing # static-nodes.json doesn't hand reth a bare flag with no value. @@ -61,4 +100,12 @@ if [ -n "${TRUSTED_PEERS}" ]; then set -- "$@" --trusted-peers "${TRUSTED_PEERS}" fi +# Append operator-provided extra flags without pathname globbing. +if [ -n "${RETH_EXTRA_FLAGS}" ]; then + set -f + # shellcheck disable=SC2086 + set -- "$@" ${RETH_EXTRA_FLAGS} + set +f +fi + exec "$@" diff --git a/morph-node/run-binary-reth.sh b/morph-node/run-binary-reth.sh index acfe191..0ec2ad8 100755 --- a/morph-node/run-binary-reth.sh +++ b/morph-node/run-binary-reth.sh @@ -1,4 +1,5 @@ #!/bin/sh +set -eu # Usage: run-binary-reth.sh [override-env-file] # env-file: .env | .env_hoodi @@ -6,90 +7,180 @@ # # Binary-mode launcher for the reth execution client + morphnode. Mirrors # run-binary.sh but starts morph-reth instead of geth. Reth uses a separate -# snapshot and data dir (${RETH_HOME}/reth-data); node-data is shared. +# snapshot and data dir (${RETH_HOME}/reth-data); node-data is shared by default. ENV_FILE=${1:-.env} OVERRIDE_ENV_FILE=${2:-} -# Source environment +# Source environment (supports relative and absolute paths) +source_env_file() { + case "$1" in + /*|./*|../*) + # shellcheck source=/dev/null + . "$1" + ;; + *) + # shellcheck source=/dev/null + . "./$1" + ;; + esac +} + set -a -. ./${ENV_FILE} +source_env_file "${ENV_FILE}" if [ -n "${OVERRIDE_ENV_FILE}" ]; then - . ./${OVERRIDE_ENV_FILE} + source_env_file "${OVERRIDE_ENV_FILE}" fi set +a RETH_BINARY=${RETH_BINARY:-./bin/morph-reth} NODE_BINARY=${NODE_BINARY:-./bin/morphnode} +RETH_READY_TIMEOUT=${RETH_READY_TIMEOUT:-120} # Check binaries -if [ ! -f "${RETH_BINARY}" ]; then - echo "Error: morph-reth binary not found at ${RETH_BINARY}" - echo "Please build it (make build-reth) or place it in the bin/ directory." +if [ ! -x "${RETH_BINARY}" ]; then + echo "Error: morph-reth binary not found or not executable at ${RETH_BINARY}" >&2 + echo "Run 'make download-reth-binary' (Linux) or 'make build-reth' to obtain it." >&2 + exit 1 +fi + +if [ ! -x "${NODE_BINARY}" ]; then + echo "Error: morphnode binary not found or not executable at ${NODE_BINARY}" >&2 + echo "Run 'make build-morphnode' or place the binary in ./bin/." >&2 + exit 1 +fi + +# Validate required node settings early +if [ -z "${L1_ETH_RPC:-}" ]; then + echo "Error: L1_ETH_RPC is empty in ${ENV_FILE}. Set a valid L1 execution RPC URL." >&2 + exit 1 +fi + +if [ -z "${L1_BEACON_CHAIN_RPC:-}" ]; then + echo "Error: L1_BEACON_CHAIN_RPC is empty in ${ENV_FILE}. Set a valid L1 Beacon REST API URL." >&2 exit 1 fi -if [ ! -f "${NODE_BINARY}" ]; then - echo "Error: morphnode binary not found at ${NODE_BINARY}" - echo "Please download and place it in the bin/ directory." +if [ -z "${RETH_DERIVATION_START_HEIGHT:-}" ] || [ -z "${RETH_L1_MSG_START_HEIGHT:-}" ] || [ -z "${RETH_L2_BASE_HEIGHT:-}" ]; then + echo "Error: RETH_DERIVATION_START_HEIGHT, RETH_L1_MSG_START_HEIGHT, and RETH_L2_BASE_HEIGHT must be set in ${ENV_FILE}." >&2 exit 1 fi -# Ensure data directories exist -mkdir -p "${RETH_HOME}/reth-data" +# Ensure data and log directories exist +mkdir -p "${RETH_HOME}/reth-data/logs" mkdir -p "${RETH_HOME}/node-data" -# Cleanup on exit +# Portable TCP readiness check (does not require netcat on minimal hosts) +is_port_open() { + port=$1 + if command -v nc >/dev/null 2>&1; then + nc -z localhost "${port}" 2>/dev/null + return $? + elif command -v bash >/dev/null 2>&1; then + bash -c "exec 3<>/dev/tcp/127.0.0.1/${port}" 2>/dev/null + return $? + elif command -v curl >/dev/null 2>&1; then + curl -s --connect-timeout 1 "http://127.0.0.1:${port}" >/dev/null 2>&1 + rc=$? + # HTTP 401/403/405 still returns 0; exit code 7 means connection refused + [ "${rc}" -ne 7 ] && [ "${rc}" -ne 28 ] + return $? + elif command -v python3 >/dev/null 2>&1; then + python3 -c "import socket, sys; s = socket.create_connection(('127.0.0.1', int(sys.argv[1])), 1); s.close()" "${port}" 2>/dev/null + return $? + else + echo "Error: none of nc, bash, curl, or python3 is available to probe port ${port}." >&2 + return 1 + fi +} + +wait_for_pid_exit() { + pid=$1 + timeout=$2 + elapsed=0 + while kill -0 "${pid}" 2>/dev/null; do + if [ "${elapsed}" -ge "${timeout}" ]; then + echo "Warning: PID ${pid} did not exit within ${timeout}s." >&2 + return 1 + fi + sleep 1 + elapsed=$((elapsed + 1)) + done + return 0 +} + +CLEANED_UP=0 +# Graceful shutdown: stop morphnode first so Engine API calls cease, then stop +# morph-reth and wait for MDBX/static files to flush cleanly. cleanup() { + exit_code=${1:-0} + if [ "${CLEANED_UP}" -eq 1 ]; then + return + fi + CLEANED_UP=1 echo "" - echo "Stopping..." - [ -n "${RETH_PID:-}" ] && kill ${RETH_PID} 2>/dev/null - [ -n "${NODE_PID:-}" ] && kill ${NODE_PID} 2>/dev/null + echo "Stopping morphnode and morph-reth gracefully..." + if [ -n "${NODE_PID:-}" ] && kill -0 "${NODE_PID}" 2>/dev/null; then + kill -TERM "${NODE_PID}" 2>/dev/null || true + wait_for_pid_exit "${NODE_PID}" 60 || true + fi + if [ -n "${RETH_PID:-}" ] && kill -0 "${RETH_PID}" 2>/dev/null; then + kill -TERM "${RETH_PID}" 2>/dev/null || true + wait_for_pid_exit "${RETH_PID}" 120 || true + fi rm -f .reth.pid .node.pid - exit + exit "${exit_code}" } -trap cleanup INT TERM +trap 'cleanup 0' INT TERM # Validate entrypoint file case "${RETH_ENTRYPOINT_FILE}" in ./entrypoint-reth.sh) ;; *) - echo "Error: invalid RETH_ENTRYPOINT_FILE: ${RETH_ENTRYPOINT_FILE}" + echo "Error: invalid RETH_ENTRYPOINT_FILE: ${RETH_ENTRYPOINT_FILE}" >&2 exit 1 ;; esac # Start reth echo "Starting morph-reth..." -RETH_BINARY=${RETH_BINARY} \ -RETH_DATADIR=${RETH_HOME}/reth-data \ -LOG_DIR=${RETH_HOME}/reth-data \ -JWT_SECRET_PATH=${JWT_SECRET_FILE} \ -RETH_CHAIN=${RETH_CHAIN} \ -STATIC_NODES_FILE=${RETH_HOME}/reth-data/static-nodes.json \ -sh ${RETH_ENTRYPOINT_FILE} & +RETH_BINARY="${RETH_BINARY}" \ +RETH_DATADIR="${RETH_HOME}/reth-data" \ +LOG_DIR="${RETH_HOME}/reth-data/logs" \ +RETH_LOG_FILTER="${RETH_LOG_FILTER:-info}" \ +RETH_HTTP_API="${RETH_HTTP_API:-web3,debug,eth,txpool,net,trace}" \ +RETH_WS_API="${RETH_WS_API:-web3,debug,eth,txpool,net,trace}" \ +RETH_PROOFS_HISTORY="${RETH_PROOFS_HISTORY:-false}" \ +RETH_PROOFS_WINDOW="${RETH_PROOFS_WINDOW:-}" \ +RETH_PROOF_PERMITS="${RETH_PROOF_PERMITS:-}" \ +RETH_EXTRA_FLAGS="${RETH_EXTRA_FLAGS:-}" \ +JWT_SECRET_PATH="${JWT_SECRET_FILE}" \ +RETH_CHAIN="${RETH_CHAIN}" \ +STATIC_NODES_FILE="${RETH_HOME}/reth-data/static-nodes.json" \ +sh "${RETH_ENTRYPOINT_FILE}" & RETH_PID=$! echo "${RETH_PID}" > .reth.pid # Wait for reth engine RPC (port 8551) -echo "Waiting for reth to be ready..." -for i in $(seq 1 30); do - if nc -z localhost 8551 2>/dev/null; then +echo "Waiting for reth engine RPC (port 8551, timeout ${RETH_READY_TIMEOUT}s)..." +elapsed=0 +while [ "${elapsed}" -lt "${RETH_READY_TIMEOUT}" ]; do + if is_port_open 8551; then echo "Reth is ready." break fi - if ! kill -0 ${RETH_PID} 2>/dev/null; then - echo "Error: reth process exited unexpectedly." + if ! kill -0 "${RETH_PID}" 2>/dev/null; then + echo "Error: reth process exited unexpectedly." >&2 rm -f .reth.pid exit 1 fi sleep 1 + elapsed=$((elapsed + 1)) done -if ! nc -z localhost 8551 2>/dev/null; then - echo "Error: reth did not become ready within 30 seconds." - cleanup - exit 1 +if ! is_port_open 8551; then + echo "Error: reth did not become ready within ${RETH_READY_TIMEOUT} seconds." >&2 + cleanup 1 fi # Start morphnode. @@ -97,12 +188,12 @@ fi # prefers MORPH_NODE_* over the shared DERIVATION_*/L1_MSG_*/L2_BASE_* vars, so pass the # reth heights explicitly as MORPH_NODE_* to override the (geth) shared values. echo "Starting morphnode..." -NODE_BINARY=${NODE_BINARY} \ -NODE_HOME=${RETH_HOME}/node-data \ -JWT_SECRET_PATH=${JWT_SECRET_FILE} \ -MORPH_NODE_DERIVATION_START_HEIGHT=${RETH_DERIVATION_START_HEIGHT} \ -MORPH_NODE_DERIVATION_BASE_HEIGHT=${RETH_L2_BASE_HEIGHT} \ -MORPH_NODE_SYNC_START_HEIGHT=${RETH_L1_MSG_START_HEIGHT} \ +NODE_BINARY="${NODE_BINARY}" \ +NODE_HOME="${RETH_HOME}/node-data" \ +JWT_SECRET_PATH="${JWT_SECRET_FILE}" \ +MORPH_NODE_DERIVATION_START_HEIGHT="${RETH_DERIVATION_START_HEIGHT}" \ +MORPH_NODE_DERIVATION_BASE_HEIGHT="${RETH_L2_BASE_HEIGHT}" \ +MORPH_NODE_SYNC_START_HEIGHT="${RETH_L1_MSG_START_HEIGHT}" \ NODE_EXTRA_FLAGS="${NODE_EXTRA_FLAGS:-}" \ sh ./entrypoint-node.sh & NODE_PID=$! @@ -112,7 +203,7 @@ echo "" echo "=========================================" echo " reth PID: ${RETH_PID}" echo " morphnode PID: ${NODE_PID}" -echo " reth log: ${RETH_HOME}/reth-data/reth.log" +echo " reth logs: ${RETH_HOME}/reth-data/logs/reth.log" echo " node log: ${RETH_HOME}/node-data/node.log" echo "=========================================" echo "Press Ctrl+C to stop both processes." diff --git a/morph-node/run-binary.sh b/morph-node/run-binary.sh index 40d402e..da5c2f1 100755 --- a/morph-node/run-binary.sh +++ b/morph-node/run-binary.sh @@ -13,9 +13,11 @@ OVERRIDE_ENV_FILE=${2:-} # Source environment set -a -. ./${ENV_FILE} +# shellcheck source=/dev/null +. "./${ENV_FILE}" if [ -n "${OVERRIDE_ENV_FILE}" ]; then - . ./${OVERRIDE_ENV_FILE} + # shellcheck source=/dev/null + . "./${OVERRIDE_ENV_FILE}" fi set +a @@ -71,7 +73,7 @@ echo "${GETH_PID}" > .geth.pid # Wait for geth engine RPC (port 8551) echo "Waiting for geth to be ready..." -for i in $(seq 1 30); do +for _ in $(seq 1 30); do if nc -z localhost 8551 2>/dev/null; then echo "Geth is ready." break diff --git a/morph-reth b/morph-reth new file mode 160000 index 0000000..c25b9a3 --- /dev/null +++ b/morph-reth @@ -0,0 +1 @@ +Subproject commit c25b9a37daaba8eb8d9e6705607e4d32dad46b13 From c7ae77da9c8165d35838c9732aa2dd9b0f6e5012 Mon Sep 17 00:00:00 2001 From: panos-xyz Date: Tue, 1 Dec 2026 12:59:47 +0800 Subject: [PATCH 2/3] fix(node): harden Linux permissions, binary launchers, snapshot cleanup, 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//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. --- .github/workflows/ci.yml | 1 + README.md | 70 +++++++-- morph-node/.env | 7 +- morph-node/.env_hoodi | 7 +- morph-node/Makefile | 85 +++++++---- morph-node/docker-compose.reth.yml | 3 + morph-node/docker-compose.yml | 13 +- morph-node/run-binary-reth.sh | 113 ++++++++++++--- morph-node/run-binary.sh | 224 ++++++++++++++++++++++++----- 9 files changed, 423 insertions(+), 100 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c70bacc..8d5f47f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,6 +39,7 @@ jobs: download-and-decompress-mainnet-snapshot download-and-decompress-hoodi-snapshot \ download-and-decompress-mainnet-reth-snapshot download-and-decompress-hoodi-reth-snapshot \ clean-mainnet-binary clean-hoodi-binary clean-mainnet-reth clean-hoodi-reth \ + stop-reth-node rm-reth-node stop-hoodi-reth-node rm-hoodi-reth-node \ stop-binary >/dev/null - name: Verify JSON, versions, snapshots, and data.zip consistency diff --git a/README.md b/README.md index d49d9c8..806c157 100644 --- a/README.md +++ b/README.md @@ -68,13 +68,13 @@ make download-and-decompress-hoodi-snapshot ``` - - **Reth snapshot layout** (`*-reth-*` rows in the snapshot table): its tarball contains a `reth-data/` tree plus `data/` for `morph-node`. `static-nodes.json` is already tracked in `mainnet/reth-data/` and `hoodi/reth-data/` and parsed into `--trusted-peers`. When placing manually, clear any previous `node-data/data/` contents first so `mv` does not collide with stale directories: + - **Reth snapshot layout** (`*-reth-*` rows in the snapshot table): its tarball contains a `reth-data/` tree plus `data/` for `morph-node`. `static-nodes.json` is already tracked in `mainnet/reth-data/` and `hoodi/reth-data/` and parsed into `--trusted-peers`. When placing manually (first `set -a; source .env; set +a` or `.env_hoodi`), clear any previous `node-data/data/` and `node-data/node-data/` contents first so `mv` does not collide with stale directories and `morphnode` starts from the snapshot's L1 heights: ```bash rm -rf ${RETH_HOME}/reth-data/db ${RETH_HOME}/reth-data/static_files \ ${RETH_HOME}/reth-data/rocksdb ${RETH_HOME}/reth-data/morph \ - ${RETH_HOME}/reth-data/historical-proofs - rm -rf ${RETH_HOME}/node-data/data/* + ${RETH_HOME}/reth-data/historical-proofs ${RETH_HOME}/reth-data/reth.toml + rm -rf ${RETH_HOME}/node-data/data/* ${RETH_HOME}/node-data/node-data mv ${RETH_HOME}/snapshot-archive-reth-20261117-1/reth-data/* ${RETH_HOME}/reth-data/ mv ${RETH_HOME}/snapshot-archive-reth-20261117-1/data/* ${RETH_HOME}/node-data/data/ ``` @@ -88,7 +88,7 @@ │ ├── static_files // from snapshot/reth-data │ ├── rocksdb // from snapshot/reth-data │ ├── morph // from snapshot/reth-data (reference index) - │ ├── logs // rotating reth.log files + │ ├── logs // rotating reth.log files under logs// │ └── static-nodes.json // tracked in repo, parsed into --trusted-peers └── node-data // data directory for morph-node ├── config @@ -100,7 +100,7 @@ - **Geth snapshot layout**: ```bash - rm -rf ${MORPH_HOME}/geth-data/geth ${MORPH_HOME}/node-data/data/* + rm -rf ${MORPH_HOME}/geth-data/geth ${MORPH_HOME}/node-data/data/* ${MORPH_HOME}/node-data/node-data mv ${MORPH_HOME}/snapshot-20261117-1/geth ${MORPH_HOME}/geth-data/ mv ${MORPH_HOME}/snapshot-20261117-1/data/* ${MORPH_HOME}/node-data/data/ ``` @@ -137,13 +137,17 @@ - **Docker Compose**: ```bash - make run-reth-node # mainnet (detached, sets RETH_UID/RETH_GID to host user) - make run-hoodi-reth-node # hoodi - make stop-reth-node # stops morph-node first, then morph-reth cleanly + make run-reth-node # mainnet (detached, sets RETH_UID/RETH_GID to host user) + make run-hoodi-reth-node # hoodi + make stop-reth-node # stops mainnet morph-node first, then morph-reth cleanly make rm-reth-node + make stop-hoodi-reth-node # stops hoodi stack (when RETH_CONTAINER_NAME differs in .env_hoodi) + make rm-hoodi-reth-node + make clean-mainnet-reth # clean mainnet reth + node DBs (keeps config & static-nodes.json) + make clean-hoodi-reth # clean hoodi reth + node DBs ``` - > **Bind-mount permissions on Linux**: the published `ghcr.io/morph-l2/morph-reth` image sets `USER morph-reth` (non-root system UID). The Makefile targets automatically pass `RETH_UID=$(id -u) RETH_GID=$(id -g)` so `morph-reth` runs as your host user and can write to `${RETH_HOME}/reth-data`. Direct `docker compose -f docker-compose.reth.yml ...` invocations default `RETH_UID`/`RETH_GID` to `0:0` unless overridden in the shell or env file. + > **Bind-mount permissions on Linux**: the published `ghcr.io/morph-l2/morph-reth` image sets `USER morph-reth` (non-root system UID), while `ghcr.io/morph-l2/node` and `ghcr.io/morph-l2/go-ethereum` default to `root`. All Makefile targets automatically pass host UID/GID (`RETH_UID`/`RETH_GID` for `docker-compose.reth.yml`, `MORPH_UID`/`MORPH_GID` for `docker-compose.yml`) to both the execution client and `morph-node` containers so host bind mounts stay owned by your host user (ensuring `make clean-*`, snapshot updates, and switching between Docker and binary modes work without `Permission denied`). Direct `docker compose` invocations fall back to `0:0` unless overridden. - **Binary mode** (pre-built Linux binary or build from the pinned `morph-reth` git submodule): @@ -194,7 +198,7 @@ Configurable environment variables in `.env` / `.env_hoodi`: - `RETH_HTTP_API` / `RETH_WS_API`: default `web3,debug,eth,txpool,net,trace`. Note: in `morph-reth v1.5.0` the `morph_` RPC namespace (`morph_getTransactionHashesByReference`) is registered unconditionally and `"morph"` is rejected by `--http.api`/`--ws.api`. When upgrading to a release containing `morph-reth` PR #241 (`>v1.5.0`), append `,morph` to `RETH_HTTP_API` / `RETH_WS_API` to keep `morph_` methods enabled. - `RETH_EXTRA_FLAGS`: extra CLI flags appended verbatim to `morph-reth node` (e.g. `--full`, `--txpool.*`, `--engine.persistence-threshold`). - - `RETH_LOG_FILTER`: rotating log file filter (default `info`, written under `reth-data/logs/`). + - `RETH_LOG_FILTER`: rotating log file filter (default `info`, written under `reth-data/logs//reth.log`). - `RETH_METRICS_PORT` / `RETH_P2P_PORT` / `RETH_RPC_PORT` / `RETH_WS_PORT`: host port bindings for Docker Compose (Prometheus metrics on `6060` work with the unified Grafana dashboard shipped in `morph-reth/etc/`). - **Storage & pruning constraint**: @@ -205,6 +209,32 @@ Set `RETH_PROOFS_HISTORY=true` (and optionally `RETH_PROOFS_WINDOW`, `RETH_PROOF_PERMITS`) in `.env` / `.env_hoodi` **only on a restored post-Jade paired snapshot** (never an empty DB). `entrypoint-reth.sh` verifies `${RETH_DATADIR}/db` exists, idempotently runs `morph-reth proofs init`, and launches `morph-reth node --proofs-history`. +### Running with `go-ethereum` (`geth`) + +- **Docker Compose**: + + ```bash + make run-node # mainnet (detached, sets MORPH_UID/MORPH_GID to host user) + make run-hoodi-node # hoodi + make stop-node # stops morph-node first, then morph-geth cleanly + make rm-node + make clean-mainnet-binary # clean mainnet geth + node DBs (keeps config & static-nodes.json) + make clean-hoodi-binary # clean hoodi geth + node DBs + ``` + +- **Binary mode** (build `geth` + `morphnode` from the pinned git submodules): + + ```bash + make build # builds ./bin/geth and ./bin/morphnode + make run-node-binary # mainnet + make run-hoodi-node-binary # hoodi + make stop-binary # stops morphnode first, then waits for geth DB flush + + # Or one-command quickstart (builds + downloads geth snapshot + runs) + make quickstart-mainnet-node-binary + make quickstart-hoodi-node-binary + ``` + ### Migrating from `geth` to `morph-reth` Because `morph-reth` and `geth` use different snapshot formats and their EL state must stay locked to `morph-node`'s `node-data/data` at the exact same block height, do **not** point `morph-reth` at a `geth` datadir or reuse `node-data/data` from a running `geth` node. @@ -213,20 +243,36 @@ Because `morph-reth` and `geth` use different snapshot formats and their EL stat 1. Stop and remove the `geth` stack: `make stop-node && make rm-node` (or `make stop-binary`). 2. Clean old snapshot data (keeps `config.toml`, `genesis.json`, `static-nodes.json`): `make clean-mainnet-binary` (or `make clean-hoodi-binary`). - 3. Bootstrap and start `morph-reth` with its paired snapshot: `make quickstart-mainnet-reth-node` (or `make quickstart-hoodi-reth-node`). Note: `setup-snapshot-data-reth` also safely replaces any leftover `node-data/data/*` automatically. + 3. Bootstrap and start `morph-reth` with its paired snapshot: `make quickstart-mainnet-reth-node` (or `make quickstart-hoodi-reth-node`). Note: `setup-snapshot-data-reth` also safely replaces any leftover `node-data/data/*` and `node-data/node-data` automatically. 4. Once verified, you can reclaim disk space from `${MORPH_HOME}/geth-data/geth`. - **Option B — Side-by-side / shadow run before cutting over traffic**: - Configure distinct paths, ports, and container names (either in a copy of `.env` or via environment overrides) so `morph-reth` runs alongside an existing `geth` node without collisions: + Use distinct `RETH_HOME`, `JWT_SECRET_FILE`, ports, container names, and `COMPOSE_PROJECT_NAME` so `morph-reth` runs alongside an existing `geth` node without collisions: ```bash + # 1. One-command bootstrap + foreground shadow run (creates jwt-secret.txt, + # copies config/static-nodes.json, restores the reth snapshot, and starts both containers): + make quickstart-mainnet-reth-node \ + RETH_HOME=/data/morph-mainnet-reth \ + JWT_SECRET_FILE=/data/morph-mainnet-reth/jwt-secret.txt \ + RETH_RPC_PORT=18545 RETH_WS_PORT=18546 RETH_METRICS_PORT=16060 RETH_P2P_PORT=30304 \ + RETH_CONTAINER_NAME=morph-reth-shadow RETH_NODE_CONTAINER_NAME=morph-node-shadow \ + COMPOSE_PROJECT_NAME=morph-reth-shadow + + # 2. Or, after bootstrapping RETH_HOME and jwt-secret.txt, run detached: + RETH_UID=$(id -u) RETH_GID=$(id -g) \ RETH_HOME=/data/morph-mainnet-reth \ JWT_SECRET_FILE=/data/morph-mainnet-reth/jwt-secret.txt \ RETH_RPC_PORT=18545 RETH_WS_PORT=18546 RETH_METRICS_PORT=16060 RETH_P2P_PORT=30304 \ RETH_CONTAINER_NAME=morph-reth-shadow RETH_NODE_CONTAINER_NAME=morph-node-shadow \ COMPOSE_PROJECT_NAME=morph-reth-shadow \ docker compose -f docker-compose.reth.yml --env-file .env up -d node + + # 3. Stop and remove only the shadow stack (do NOT run plain `make stop-reth-node`, + # which targets the default `morph-node`/`morph-reth` container names): + make stop-reth-node rm-reth-node \ + RETH_CONTAINER_NAME=morph-reth-shadow RETH_NODE_CONTAINER_NAME=morph-node-shadow ``` ### Running as a validator (batch verification mode) diff --git a/morph-node/.env b/morph-node/.env index abb7722..3c9e3ac 100644 --- a/morph-node/.env +++ b/morph-node/.env @@ -48,10 +48,13 @@ RETH_METRICS_PORT=6060 RETH_P2P_PORT=30303 RETH_CONTAINER_NAME=morph-reth RETH_NODE_CONTAINER_NAME=morph-node -# Optional UID:GID for the morph-reth Docker container. Makefile sets these -# automatically from `id -u`/`id -g`; direct `docker compose` falls back to 0:0. +# Optional UID:GID for the Docker containers (`reth`/`node` in docker-compose.reth.yml, +# and `MORPH_UID`/`MORPH_GID` for `geth`/`node` in docker-compose.yml). Makefile sets +# these automatically from `id -u`/`id -g`; direct `docker compose` falls back to 0:0. # RETH_UID=1000 # RETH_GID=1000 +# MORPH_UID=1000 +# MORPH_GID=1000 ## Environment variables for the node L1_CHAIN_ID=1 diff --git a/morph-node/.env_hoodi b/morph-node/.env_hoodi index b16b3f7..1bcfa04 100644 --- a/morph-node/.env_hoodi +++ b/morph-node/.env_hoodi @@ -48,10 +48,13 @@ RETH_METRICS_PORT=6060 RETH_P2P_PORT=30303 RETH_CONTAINER_NAME=morph-reth RETH_NODE_CONTAINER_NAME=morph-node -# Optional UID:GID for the morph-reth Docker container. Makefile sets these -# automatically from `id -u`/`id -g`; direct `docker compose` falls back to 0:0. +# Optional UID:GID for the Docker containers (`reth`/`node` in docker-compose.reth.yml, +# and `MORPH_UID`/`MORPH_GID` for `geth`/`node` in docker-compose.yml). Makefile sets +# these automatically from `id -u`/`id -g`; direct `docker compose` falls back to 0:0. # RETH_UID=1000 # RETH_GID=1000 +# MORPH_UID=1000 +# MORPH_GID=1000 ## Environment variables for the node L1_CHAIN_ID=560048 diff --git a/morph-node/Makefile b/morph-node/Makefile index c061089..5f2a6a0 100644 --- a/morph-node/Makefile +++ b/morph-node/Makefile @@ -1,17 +1,21 @@ include .env -# Capture mainnet paths and snapshot names before .env_hoodi overwrites them (:= forces immediate expansion) +# Capture mainnet paths, container names, and snapshot names before .env_hoodi overwrites them (:= forces immediate expansion) MORPH_HOME_MAINNET := $(MORPH_HOME) RETH_HOME_MAINNET := $(RETH_HOME) JWT_SECRET_FILE_MAINNET := $(JWT_SECRET_FILE) MAINNET_SNAPSHOT_NAME := $(MAINNET_SNAPSHOT_NAME) MAINNET_RETH_SNAPSHOT_NAME := $(MAINNET_RETH_SNAPSHOT_NAME) +RETH_CONTAINER_NAME_MAINNET := $(RETH_CONTAINER_NAME) +RETH_NODE_CONTAINER_NAME_MAINNET := $(RETH_NODE_CONTAINER_NAME) include .env_hoodi MORPH_HOME_HOODI := $(MORPH_HOME) RETH_HOME_HOODI := $(RETH_HOME) JWT_SECRET_FILE_HOODI := $(JWT_SECRET_FILE) +RETH_CONTAINER_NAME_HOODI := $(RETH_CONTAINER_NAME) +RETH_NODE_CONTAINER_NAME_HOODI := $(RETH_NODE_CONTAINER_NAME) # Prefer Docker Compose v2 (`docker compose`) and fall back to legacy `docker-compose`. COMPOSE ?= $(shell docker compose version >/dev/null 2>&1 && echo "docker compose" || echo "docker-compose") @@ -29,8 +33,10 @@ SKIP_SHA256_CHECK ?= 0 .PHONY: generate-jwt generate-jwt-hoodi \ run-node run-hoodi-node stop-node rm-node \ run-reth-node run-hoodi-reth-node stop-reth-node rm-reth-node \ + stop-hoodi-reth-node rm-hoodi-reth-node \ run-validator run-hoodi-validator stop-validator rm-validator \ run-reth-validator run-hoodi-reth-validator stop-reth-validator rm-reth-validator \ + stop-hoodi-reth-validator rm-hoodi-reth-validator \ submodule-init set-versions \ build-geth build-morphnode build-reth download-reth-binary build build-reth-all \ run-node-binary run-hoodi-node-binary \ @@ -59,12 +65,14 @@ generate-jwt-hoodi: run-node: generate-jwt @echo "You are about to run a Mainnet node." @{ [ -t 0 ] || { echo "Error: interactive confirmation required (run in a TTY)."; exit 1; }; printf "Continue? [Y/n] "; read confirm; if [ "$$confirm" = "n" ] || [ "$$confirm" = "N" ]; then exit 1; fi; } - $(COMPOSE) --env-file .env up -d node + @mkdir -p "$(MORPH_HOME_MAINNET)/geth-data" "$(MORPH_HOME_MAINNET)/node-data/data" + MORPH_UID=$$(id -u) MORPH_GID=$$(id -g) $(COMPOSE) --env-file .env up -d node run-hoodi-node: generate-jwt-hoodi @echo "You are about to run a Hoodi node." @{ [ -t 0 ] || { echo "Error: interactive confirmation required (run in a TTY)."; exit 1; }; printf "Continue? [Y/n] "; read confirm; if [ "$$confirm" = "n" ] || [ "$$confirm" = "N" ]; then exit 1; fi; } - $(COMPOSE) --env-file .env_hoodi up -d node + @mkdir -p "$(MORPH_HOME_HOODI)/geth-data" "$(MORPH_HOME_HOODI)/node-data/data" + MORPH_UID=$$(id -u) MORPH_GID=$$(id -g) $(COMPOSE) --env-file .env_hoodi up -d node stop-node: @docker stop morph-node 2>/dev/null || true @@ -78,19 +86,28 @@ rm-node: run-reth-node: generate-jwt @echo "You are about to run a Mainnet node with the reth execution client." @{ [ -t 0 ] || { echo "Error: interactive confirmation required (run in a TTY)."; exit 1; }; printf "Continue? [Y/n] "; read confirm; if [ "$$confirm" = "n" ] || [ "$$confirm" = "N" ]; then exit 1; fi; } + @mkdir -p "$(RETH_HOME_MAINNET)/reth-data/logs" "$(RETH_HOME_MAINNET)/node-data/data" RETH_UID=$$(id -u) RETH_GID=$$(id -g) $(COMPOSE) -f docker-compose.reth.yml --env-file .env up -d node run-hoodi-reth-node: generate-jwt-hoodi @echo "You are about to run a Hoodi node with the reth execution client." @{ [ -t 0 ] || { echo "Error: interactive confirmation required (run in a TTY)."; exit 1; }; printf "Continue? [Y/n] "; read confirm; if [ "$$confirm" = "n" ] || [ "$$confirm" = "N" ]; then exit 1; fi; } + @mkdir -p "$(RETH_HOME_HOODI)/reth-data/logs" "$(RETH_HOME_HOODI)/node-data/data" RETH_UID=$$(id -u) RETH_GID=$$(id -g) $(COMPOSE) -f docker-compose.reth.yml --env-file .env_hoodi up -d node stop-reth-node: - @docker stop $(RETH_NODE_CONTAINER_NAME) 2>/dev/null || true - docker stop $(RETH_CONTAINER_NAME) + @docker stop $(RETH_NODE_CONTAINER_NAME_MAINNET) 2>/dev/null || true + docker stop $(RETH_CONTAINER_NAME_MAINNET) rm-reth-node: - docker rm $(RETH_NODE_CONTAINER_NAME) $(RETH_CONTAINER_NAME) + docker rm $(RETH_NODE_CONTAINER_NAME_MAINNET) $(RETH_CONTAINER_NAME_MAINNET) + +stop-hoodi-reth-node: + @docker stop $(RETH_NODE_CONTAINER_NAME_HOODI) 2>/dev/null || true + docker stop $(RETH_CONTAINER_NAME_HOODI) + +rm-hoodi-reth-node: + docker rm $(RETH_NODE_CONTAINER_NAME_HOODI) $(RETH_CONTAINER_NAME_HOODI) ## Validator commands, kept for backward compatibility. A "validator" is now just ## the single node run in layer1 batch-verification mode (--derivation.verify-mode=layer1: @@ -100,12 +117,14 @@ rm-reth-node: run-validator: generate-jwt @echo "You are about to run a Mainnet node in validator mode (--derivation.verify-mode=layer1)." @{ [ -t 0 ] || { echo "Error: interactive confirmation required (run in a TTY)."; exit 1; }; printf "Continue? [Y/n] "; read confirm; if [ "$$confirm" = "n" ] || [ "$$confirm" = "N" ]; then exit 1; fi; } - DERIVATION_VERIFY_MODE=layer1 $(COMPOSE) --env-file .env up -d node + @mkdir -p "$(MORPH_HOME_MAINNET)/geth-data" "$(MORPH_HOME_MAINNET)/node-data/data" + MORPH_UID=$$(id -u) MORPH_GID=$$(id -g) DERIVATION_VERIFY_MODE=layer1 $(COMPOSE) --env-file .env up -d node run-hoodi-validator: generate-jwt-hoodi @echo "You are about to run a Hoodi node in validator mode (--derivation.verify-mode=layer1)." @{ [ -t 0 ] || { echo "Error: interactive confirmation required (run in a TTY)."; exit 1; }; printf "Continue? [Y/n] "; read confirm; if [ "$$confirm" = "n" ] || [ "$$confirm" = "N" ]; then exit 1; fi; } - DERIVATION_VERIFY_MODE=layer1 $(COMPOSE) --env-file .env_hoodi up -d node + @mkdir -p "$(MORPH_HOME_HOODI)/geth-data" "$(MORPH_HOME_HOODI)/node-data/data" + MORPH_UID=$$(id -u) MORPH_GID=$$(id -g) DERIVATION_VERIFY_MODE=layer1 $(COMPOSE) --env-file .env_hoodi up -d node stop-validator: stop-node @@ -115,17 +134,23 @@ rm-validator: rm-node run-reth-validator: generate-jwt @echo "You are about to run a Mainnet reth node in validator mode (--derivation.verify-mode=layer1)." @{ [ -t 0 ] || { echo "Error: interactive confirmation required (run in a TTY)."; exit 1; }; printf "Continue? [Y/n] "; read confirm; if [ "$$confirm" = "n" ] || [ "$$confirm" = "N" ]; then exit 1; fi; } + @mkdir -p "$(RETH_HOME_MAINNET)/reth-data/logs" "$(RETH_HOME_MAINNET)/node-data/data" RETH_UID=$$(id -u) RETH_GID=$$(id -g) DERIVATION_VERIFY_MODE=layer1 $(COMPOSE) -f docker-compose.reth.yml --env-file .env up -d node run-hoodi-reth-validator: generate-jwt-hoodi @echo "You are about to run a Hoodi reth node in validator mode (--derivation.verify-mode=layer1)." @{ [ -t 0 ] || { echo "Error: interactive confirmation required (run in a TTY)."; exit 1; }; printf "Continue? [Y/n] "; read confirm; if [ "$$confirm" = "n" ] || [ "$$confirm" = "N" ]; then exit 1; fi; } + @mkdir -p "$(RETH_HOME_HOODI)/reth-data/logs" "$(RETH_HOME_HOODI)/node-data/data" RETH_UID=$$(id -u) RETH_GID=$$(id -g) DERIVATION_VERIFY_MODE=layer1 $(COMPOSE) -f docker-compose.reth.yml --env-file .env_hoodi up -d node stop-reth-validator: stop-reth-node rm-reth-validator: rm-reth-node +stop-hoodi-reth-validator: stop-hoodi-reth-node + +rm-hoodi-reth-validator: rm-hoodi-reth-node + ## build from source (requires Go / Rust) submodule-init: @echo "Initializing git submodules..." @@ -135,7 +160,7 @@ submodule-init: # Update submodule versions, docker-compose image tags, Makefile RETH_VERSION, and README in one shot. # Usage: make set-versions GETH_VERSION=2.2.8 NODE_VERSION=0.6.5 RETH_VERSION=1.5.0 set-versions: - @if [ -z "$(GETH_VERSION)" ] || [ -z "$(NODE_VERSION)" ] || [ -z "$(RETH_VERSION)" ]; then \ + @if [ -z "$(GETH_VERSION)" ] || [ -z "$(NODE_VERSION)" ] || [ -z "$(RETH_VERSION)" ] || [ "$(origin RETH_VERSION)" = "file" ]; then \ echo "Usage: make set-versions GETH_VERSION= NODE_VERSION= RETH_VERSION="; \ exit 1; \ fi @@ -330,16 +355,22 @@ stop-binary: clean-mainnet-binary: @echo "Cleaning mainnet geth snapshot data at $(MORPH_HOME_MAINNET) (keeping config)..." - rm -rf "$(MORPH_HOME_MAINNET)/geth-data/geth" - rm -rf "$(MORPH_HOME_MAINNET)/node-data/data/"* + rm -rf "$(MORPH_HOME_MAINNET)/geth-data/geth" \ + "$(MORPH_HOME_MAINNET)/geth-data/geth.log" + rm -rf "$(MORPH_HOME_MAINNET)/node-data/data/"* \ + "$(MORPH_HOME_MAINNET)/node-data/node-data" \ + "$(MORPH_HOME_MAINNET)/node-data/node.log" mkdir -p "$(MORPH_HOME_MAINNET)/node-data/data" @printf '{\n "height": "0",\n "round": 0,\n "step": 0\n}\n' > "$(MORPH_HOME_MAINNET)/node-data/data/priv_validator_state.json" @echo "Mainnet snapshot data cleaned." clean-hoodi-binary: @echo "Cleaning hoodi geth snapshot data at $(MORPH_HOME_HOODI) (keeping config)..." - rm -rf "$(MORPH_HOME_HOODI)/geth-data/geth" - rm -rf "$(MORPH_HOME_HOODI)/node-data/data/"* + rm -rf "$(MORPH_HOME_HOODI)/geth-data/geth" \ + "$(MORPH_HOME_HOODI)/geth-data/geth.log" + rm -rf "$(MORPH_HOME_HOODI)/node-data/data/"* \ + "$(MORPH_HOME_HOODI)/node-data/node-data" \ + "$(MORPH_HOME_HOODI)/node-data/node.log" mkdir -p "$(MORPH_HOME_HOODI)/node-data/data" @printf '{\n "height": "0",\n "round": 0,\n "step": 0\n}\n' > "$(MORPH_HOME_HOODI)/node-data/data/priv_validator_state.json" @echo "Hoodi snapshot data cleaned." @@ -356,9 +387,12 @@ clean-mainnet-reth: "$(RETH_HOME_MAINNET)/reth-data/txpool-transactions-backup.rlp" \ "$(RETH_HOME_MAINNET)/reth-data/known-peers.json" \ "$(RETH_HOME_MAINNET)/reth-data/invalid_block_hooks" \ + "$(RETH_HOME_MAINNET)/reth-data/reth.toml" \ "$(RETH_HOME_MAINNET)/reth-data/logs" \ "$(RETH_HOME_MAINNET)/reth-data/"reth.log* - rm -rf "$(RETH_HOME_MAINNET)/node-data/data/"* + rm -rf "$(RETH_HOME_MAINNET)/node-data/data/"* \ + "$(RETH_HOME_MAINNET)/node-data/node-data" \ + "$(RETH_HOME_MAINNET)/node-data/node.log" mkdir -p "$(RETH_HOME_MAINNET)/node-data/data" @printf '{\n "height": "0",\n "round": 0,\n "step": 0\n}\n' > "$(RETH_HOME_MAINNET)/node-data/data/priv_validator_state.json" @echo "Mainnet reth snapshot data cleaned." @@ -375,9 +409,12 @@ clean-hoodi-reth: "$(RETH_HOME_HOODI)/reth-data/txpool-transactions-backup.rlp" \ "$(RETH_HOME_HOODI)/reth-data/known-peers.json" \ "$(RETH_HOME_HOODI)/reth-data/invalid_block_hooks" \ + "$(RETH_HOME_HOODI)/reth-data/reth.toml" \ "$(RETH_HOME_HOODI)/reth-data/logs" \ "$(RETH_HOME_HOODI)/reth-data/"reth.log* - rm -rf "$(RETH_HOME_HOODI)/node-data/data/"* + rm -rf "$(RETH_HOME_HOODI)/node-data/data/"* \ + "$(RETH_HOME_HOODI)/node-data/node-data" \ + "$(RETH_HOME_HOODI)/node-data/node.log" mkdir -p "$(RETH_HOME_HOODI)/node-data/data" @printf '{\n "height": "0",\n "round": 0,\n "step": 0\n}\n' > "$(RETH_HOME_HOODI)/node-data/data/priv_validator_state.json" @echo "Hoodi reth snapshot data cleaned." @@ -450,7 +487,7 @@ define setup-snapshot-data rm -rf "$(3)/geth-data/geth"; \ mv "$(3)/$(1)/geth" "$(3)/geth-data/" || { echo "Error: failed to move geth data."; exit 1; }; \ echo "Replacing node data in $(3)/node-data/data/..."; \ - rm -rf "$(3)/node-data/data/"*; \ + rm -rf "$(3)/node-data/data/"* "$(3)/node-data/node-data"; \ for item in "$(3)/$(1)/data/"*; do \ [ -e "$$item" ] || continue; \ mv "$$item" "$(3)/node-data/data/" || { echo "Error: failed to move $$item."; exit 1; }; \ @@ -463,8 +500,8 @@ endef # Helper: download, extract, and move a RETH snapshot into RETH_HOME. Reth snapshots # pack a different layout than geth: /reth-data/{db,static_files,rocksdb,morph} -# plus /data/* for the node. Cleans existing node-data/data and stale -# reth-data members before moving so migrating from geth or switching snapshots is safe. +# plus /data/* for the node. Cleans existing node-data/data, node-data/node-data, +# and stale reth-data members before moving so migrating from geth or switching snapshots is safe. # $(1) = snapshot name, $(2) = download URL base, $(3) = RETH_HOME, $(4) = network (mainnet|hoodi) define setup-snapshot-data-reth @if [ -d "$(3)/reth-data/db" ]; then \ @@ -485,7 +522,7 @@ define setup-snapshot-data-reth [ -f "$(3)/node-data/config/config.toml" ] || cp "../$(4)/node-data/config/config.toml" "$(3)/node-data/config/config.toml"; \ [ -f "$(3)/node-data/config/genesis.json" ] || cp "../$(4)/node-data/config/genesis.json" "$(3)/node-data/config/genesis.json"; \ echo "Replacing reth data in $(3)/reth-data/..."; \ - rm -rf "$(3)/reth-data/historical-proofs"; \ + rm -rf "$(3)/reth-data/historical-proofs" "$(3)/reth-data/reth.toml"; \ for item in "$(3)/$(1)/reth-data/"*; do \ [ -e "$$item" ] || continue; \ base=$$(basename "$$item"); \ @@ -493,7 +530,7 @@ define setup-snapshot-data-reth mv "$$item" "$(3)/reth-data/" || { echo "Error: failed to move $$item."; exit 1; }; \ done; \ echo "Replacing node data in $(3)/node-data/data/..."; \ - rm -rf "$(3)/node-data/data/"*; \ + rm -rf "$(3)/node-data/data/"* "$(3)/node-data/node-data"; \ for item in "$(3)/$(1)/data/"*; do \ [ -e "$$item" ] || continue; \ mv "$$item" "$(3)/node-data/data/" || { echo "Error: failed to move $$item."; exit 1; }; \ @@ -510,7 +547,7 @@ endef quickstart-hoodi-node: generate-jwt-hoodi @echo "=== Quickstart: Hoodi Node (Docker) ===" $(call setup-snapshot-data,$(HOODI_SNAPSHOT_NAME),https://snapshot.morph.network/hoodi,$(MORPH_HOME_HOODI),hoodi) - $(COMPOSE) --env-file .env_hoodi up node + MORPH_UID=$$(id -u) MORPH_GID=$$(id -g) $(COMPOSE) --env-file .env_hoodi up quickstart-hoodi-node-binary: generate-jwt-hoodi build @echo "=== Quickstart: Hoodi Node (Binary) ===" @@ -520,7 +557,7 @@ quickstart-hoodi-node-binary: generate-jwt-hoodi build quickstart-mainnet-node: generate-jwt @echo "=== Quickstart: Mainnet Node (Docker) ===" $(call setup-snapshot-data,$(MAINNET_SNAPSHOT_NAME),https://snapshot.morph.network/mainnet,$(MORPH_HOME_MAINNET),mainnet) - $(COMPOSE) --env-file .env up node + MORPH_UID=$$(id -u) MORPH_GID=$$(id -g) $(COMPOSE) --env-file .env up quickstart-mainnet-node-binary: generate-jwt build @echo "=== Quickstart: Mainnet Node (Binary) ===" @@ -531,7 +568,7 @@ quickstart-mainnet-node-binary: generate-jwt build quickstart-hoodi-reth-node: generate-jwt-hoodi @echo "=== Quickstart: Hoodi Node with reth (Docker) ===" $(call setup-snapshot-data-reth,$(HOODI_RETH_SNAPSHOT_NAME),https://snapshot.morph.network/hoodi,$(RETH_HOME_HOODI),hoodi) - RETH_UID=$$(id -u) RETH_GID=$$(id -g) $(COMPOSE) -f docker-compose.reth.yml --env-file .env_hoodi up node + RETH_UID=$$(id -u) RETH_GID=$$(id -g) $(COMPOSE) -f docker-compose.reth.yml --env-file .env_hoodi up quickstart-hoodi-reth-node-binary: generate-jwt-hoodi build-reth-all @echo "=== Quickstart: Hoodi Node with reth (Binary) ===" @@ -541,7 +578,7 @@ quickstart-hoodi-reth-node-binary: generate-jwt-hoodi build-reth-all quickstart-mainnet-reth-node: generate-jwt @echo "=== Quickstart: Mainnet Node with reth (Docker) ===" $(call setup-snapshot-data-reth,$(MAINNET_RETH_SNAPSHOT_NAME),https://snapshot.morph.network/mainnet,$(RETH_HOME_MAINNET),mainnet) - RETH_UID=$$(id -u) RETH_GID=$$(id -g) $(COMPOSE) -f docker-compose.reth.yml --env-file .env up node + RETH_UID=$$(id -u) RETH_GID=$$(id -g) $(COMPOSE) -f docker-compose.reth.yml --env-file .env up quickstart-mainnet-reth-node-binary: generate-jwt build-reth-all @echo "=== Quickstart: Mainnet Node with reth (Binary) ===" diff --git a/morph-node/docker-compose.reth.yml b/morph-node/docker-compose.reth.yml index bda5d54..0ce9978 100644 --- a/morph-node/docker-compose.reth.yml +++ b/morph-node/docker-compose.reth.yml @@ -63,6 +63,9 @@ services: reth: condition: service_started image: ghcr.io/morph-l2/node:0.6.5 + # Run with the same host UID:GID as reth so node-data/ stays writable by the + # host user on Linux (for `make clean-*`, snapshot updates, and binary mode). + user: "${RETH_UID:-0}:${RETH_GID:-0}" restart: unless-stopped # give the process time to shut down cleanly on docker stop before it is SIGKILLed (default 10s) stop_grace_period: 1m diff --git a/morph-node/docker-compose.yml b/morph-node/docker-compose.yml index 61b486d..babaf5a 100644 --- a/morph-node/docker-compose.yml +++ b/morph-node/docker-compose.yml @@ -2,6 +2,10 @@ services: geth: container_name: morph-geth image: ghcr.io/morph-l2/go-ethereum:2.2.8 + # Makefile passes MORPH_UID=$(id -u) MORPH_GID=$(id -g) so host bind mounts stay + # owned by the host user on Linux (avoiding root-owned files when cleaning or + # switching to binary mode / reth); direct `docker compose` falls back to 0:0. + user: "${MORPH_UID:-0}:${MORPH_GID:-0}" restart: unless-stopped # give the process time to shut down cleanly on docker stop before it is SIGKILLed (default 10s) stop_grace_period: 2m @@ -13,8 +17,8 @@ services: - "30303" volumes: - "${MORPH_HOME}/geth-data:/db" - - "${JWT_SECRET_FILE}:/jwt-secret.txt" - - "${GETH_ENTRYPOINT_FILE}:/entrypoint.sh" + - "${JWT_SECRET_FILE}:/jwt-secret.txt:ro" + - "${GETH_ENTRYPOINT_FILE}:/entrypoint.sh:ro" environment: - MORPH_FLAG=${MORPH_FLAG} entrypoint: @@ -34,6 +38,7 @@ services: condition: service_started # morph main build with single-sequencer + --derivation.verify-mode support. image: ghcr.io/morph-l2/node:0.6.5 + user: "${MORPH_UID:-0}:${MORPH_GID:-0}" restart: unless-stopped # give the process time to shut down cleanly on docker stop before it is SIGKILLed (default 10s) stop_grace_period: 1m @@ -63,8 +68,8 @@ services: - NODE_EXTRA_FLAGS=${NODE_EXTRA_FLAGS:-} volumes: - "${MORPH_HOME}/node-data:/db" - - "${JWT_SECRET_FILE}:/jwt-secret.txt" - - "./entrypoint-node.sh:/entrypoint-node.sh" + - "${JWT_SECRET_FILE}:/jwt-secret.txt:ro" + - "./entrypoint-node.sh:/entrypoint-node.sh:ro" entrypoint: - "/bin/sh" - "/entrypoint-node.sh" diff --git a/morph-node/run-binary-reth.sh b/morph-node/run-binary-reth.sh index 0ec2ad8..b8963a9 100755 --- a/morph-node/run-binary-reth.sh +++ b/morph-node/run-binary-reth.sh @@ -12,26 +12,68 @@ set -eu ENV_FILE=${1:-.env} OVERRIDE_ENV_FILE=${2:-} -# Source environment (supports relative and absolute paths) -source_env_file() { - case "$1" in - /*|./*|../*) - # shellcheck source=/dev/null - . "$1" - ;; - *) - # shellcheck source=/dev/null - . "./$1" - ;; +# Load env files (supports relative and absolute paths). +# Base env-file respects pre-existing caller environment variables (matching +# `docker compose --env-file` precedence); an explicit override-env-file layers on top. +load_env_file() { + file=$1 + override=$2 + case "${file}" in + /*|./*|../*) env_path="${file}" ;; + *) env_path="./${file}" ;; esac + if [ ! -f "${env_path}" ]; then + echo "Error: env file not found: ${env_path}" >&2 + exit 1 + fi + if [ "${override}" = "1" ]; then + set -a + # shellcheck source=/dev/null + . "${env_path}" + set +a + return + fi + while IFS= read -r line || [ -n "${line}" ]; do + line=$(printf '%s' "${line}" | tr -d '\r') + trimmed=$(printf '%s' "${line}" | sed 's/^[[:space:]]*//') + case "${trimmed}" in + ""|\#*) continue ;; + esac + case "${trimmed}" in + *=*) + key=${trimmed%%=*} + val=${trimmed#*=} + case "${key}" in + *[!A-Za-z0-9_]*|[0-9]*|"") continue ;; + esac + if eval "[ \"\${${key}+set}\" = set ]"; then + continue + fi + case "${val}" in + \'*\') + val=${val#\'} + val=${val%\'} + eval "${key}=\${val}" + ;; + \"*\") + eval "${key}=${val}" + ;; + *) + set -f + eval "${key}=\"${val}\"" + set +f + ;; + esac + eval "export ${key}" + ;; + esac + done < "${env_path}" } -set -a -source_env_file "${ENV_FILE}" +load_env_file "${ENV_FILE}" 0 if [ -n "${OVERRIDE_ENV_FILE}" ]; then - source_env_file "${OVERRIDE_ENV_FILE}" + load_env_file "${OVERRIDE_ENV_FILE}" 1 fi -set +a RETH_BINARY=${RETH_BINARY:-./bin/morph-reth} NODE_BINARY=${NODE_BINARY:-./bin/morphnode} @@ -70,6 +112,12 @@ fi mkdir -p "${RETH_HOME}/reth-data/logs" mkdir -p "${RETH_HOME}/node-data" +case "${RETH_CHAIN:-mainnet}" in + mainnet) RETH_LOG_SUBDIR="2818/" ;; + hoodi) RETH_LOG_SUBDIR="2910/" ;; + *) RETH_LOG_SUBDIR="" ;; +esac + # Portable TCP readiness check (does not require netcat on minimal hosts) is_port_open() { port=$1 @@ -170,7 +218,7 @@ while [ "${elapsed}" -lt "${RETH_READY_TIMEOUT}" ]; do break fi if ! kill -0 "${RETH_PID}" 2>/dev/null; then - echo "Error: reth process exited unexpectedly." >&2 + echo "Error: reth process exited unexpectedly. Check ${RETH_HOME}/reth-data/logs/${RETH_LOG_SUBDIR}reth.log." >&2 rm -f .reth.pid exit 1 fi @@ -199,14 +247,43 @@ sh ./entrypoint-node.sh & NODE_PID=$! echo "${NODE_PID}" > .node.pid +# Catch immediate startup errors (bad config, missing RPC, permission errors) +sleep 2 +if ! kill -0 "${NODE_PID}" 2>/dev/null; then + echo "Error: morphnode exited immediately after startup. Check ${RETH_HOME}/node-data/node.log." >&2 + cleanup 1 +fi + echo "" echo "=========================================" echo " reth PID: ${RETH_PID}" echo " morphnode PID: ${NODE_PID}" -echo " reth logs: ${RETH_HOME}/reth-data/logs/reth.log" +echo " reth logs: ${RETH_HOME}/reth-data/logs/${RETH_LOG_SUBDIR}reth.log" echo " node log: ${RETH_HOME}/node-data/node.log" echo "=========================================" echo "Press Ctrl+C to stop both processes." echo "" -wait +while kill -0 "${RETH_PID}" 2>/dev/null && kill -0 "${NODE_PID}" 2>/dev/null; do + sleep 2 +done + +# Give `make stop-binary` a moment to clear PID files during a deliberate shutdown +sleep 1 +if ! kill -0 "${NODE_PID}" 2>/dev/null; then + if [ ! -f .node.pid ]; then + wait "${RETH_PID}" 2>/dev/null || true + exit 0 + fi + echo "Error: morphnode (PID ${NODE_PID}) exited unexpectedly. Check ${RETH_HOME}/node-data/node.log." >&2 + cleanup 1 +fi + +if ! kill -0 "${RETH_PID}" 2>/dev/null; then + if [ ! -f .reth.pid ]; then + wait "${NODE_PID}" 2>/dev/null || true + exit 0 + fi + echo "Error: morph-reth (PID ${RETH_PID}) exited unexpectedly. Check ${RETH_HOME}/reth-data/logs/${RETH_LOG_SUBDIR}reth.log." >&2 + cleanup 1 +fi diff --git a/morph-node/run-binary.sh b/morph-node/run-binary.sh index da5c2f1..2ef6733 100755 --- a/morph-node/run-binary.sh +++ b/morph-node/run-binary.sh @@ -1,4 +1,5 @@ #!/bin/sh +set -eu # Usage: run-binary.sh [override-env-file] # env-file: .env | .env_hoodi @@ -11,29 +12,94 @@ ENV_FILE=${1:-.env} OVERRIDE_ENV_FILE=${2:-} -# Source environment -set -a -# shellcheck source=/dev/null -. "./${ENV_FILE}" +# Load env files (supports relative and absolute paths). +# Base env-file respects pre-existing caller environment variables (matching +# `docker compose --env-file` precedence); an explicit override-env-file layers on top. +load_env_file() { + file=$1 + override=$2 + case "${file}" in + /*|./*|../*) env_path="${file}" ;; + *) env_path="./${file}" ;; + esac + if [ ! -f "${env_path}" ]; then + echo "Error: env file not found: ${env_path}" >&2 + exit 1 + fi + if [ "${override}" = "1" ]; then + set -a + # shellcheck source=/dev/null + . "${env_path}" + set +a + return + fi + while IFS= read -r line || [ -n "${line}" ]; do + line=$(printf '%s' "${line}" | tr -d '\r') + trimmed=$(printf '%s' "${line}" | sed 's/^[[:space:]]*//') + case "${trimmed}" in + ""|\#*) continue ;; + esac + case "${trimmed}" in + *=*) + key=${trimmed%%=*} + val=${trimmed#*=} + case "${key}" in + *[!A-Za-z0-9_]*|[0-9]*|"") continue ;; + esac + if eval "[ \"\${${key}+set}\" = set ]"; then + continue + fi + case "${val}" in + \'*\') + val=${val#\'} + val=${val%\'} + eval "${key}=\${val}" + ;; + \"*\") + eval "${key}=${val}" + ;; + *) + set -f + eval "${key}=\"${val}\"" + set +f + ;; + esac + eval "export ${key}" + ;; + esac + done < "${env_path}" +} + +load_env_file "${ENV_FILE}" 0 if [ -n "${OVERRIDE_ENV_FILE}" ]; then - # shellcheck source=/dev/null - . "./${OVERRIDE_ENV_FILE}" + load_env_file "${OVERRIDE_ENV_FILE}" 1 fi -set +a GETH_BINARY=${GETH_BINARY:-./bin/geth} NODE_BINARY=${NODE_BINARY:-./bin/morphnode} +GETH_READY_TIMEOUT=${GETH_READY_TIMEOUT:-120} # Check binaries -if [ ! -f "${GETH_BINARY}" ]; then - echo "Error: geth binary not found at ${GETH_BINARY}" - echo "Please download and place it in the bin/ directory." +if [ ! -x "${GETH_BINARY}" ]; then + echo "Error: geth binary not found or not executable at ${GETH_BINARY}" >&2 + echo "Run 'make build-geth' or place the binary in ./bin/." >&2 + exit 1 +fi + +if [ ! -x "${NODE_BINARY}" ]; then + echo "Error: morphnode binary not found or not executable at ${NODE_BINARY}" >&2 + echo "Run 'make build-morphnode' or place the binary in ./bin/." >&2 exit 1 fi -if [ ! -f "${NODE_BINARY}" ]; then - echo "Error: morphnode binary not found at ${NODE_BINARY}" - echo "Please download and place it in the bin/ directory." +# Validate required node settings early +if [ -z "${L1_ETH_RPC:-}" ]; then + echo "Error: L1_ETH_RPC is empty in ${ENV_FILE}. Set a valid L1 execution RPC URL." >&2 + exit 1 +fi + +if [ -z "${L1_BEACON_CHAIN_RPC:-}" ]; then + echo "Error: L1_BEACON_CHAIN_RPC is empty in ${ENV_FILE}. Set a valid L1 Beacon REST API URL." >&2 exit 1 fi @@ -41,67 +107,127 @@ fi mkdir -p "${MORPH_HOME}/geth-data" mkdir -p "${MORPH_HOME}/node-data" -# Cleanup on exit +# Portable TCP readiness check (does not require netcat on minimal hosts) +is_port_open() { + port=$1 + if command -v nc >/dev/null 2>&1; then + nc -z localhost "${port}" 2>/dev/null + return $? + elif command -v bash >/dev/null 2>&1; then + bash -c "exec 3<>/dev/tcp/127.0.0.1/${port}" 2>/dev/null + return $? + elif command -v curl >/dev/null 2>&1; then + curl -s --connect-timeout 1 "http://127.0.0.1:${port}" >/dev/null 2>&1 + rc=$? + # HTTP 401/403/405 still returns 0; exit code 7 means connection refused + [ "${rc}" -ne 7 ] && [ "${rc}" -ne 28 ] + return $? + elif command -v python3 >/dev/null 2>&1; then + python3 -c "import socket, sys; s = socket.create_connection(('127.0.0.1', int(sys.argv[1])), 1); s.close()" "${port}" 2>/dev/null + return $? + else + echo "Error: none of nc, bash, curl, or python3 is available to probe port ${port}." >&2 + return 1 + fi +} + +wait_for_pid_exit() { + pid=$1 + timeout=$2 + elapsed=0 + while kill -0 "${pid}" 2>/dev/null; do + if [ "${elapsed}" -ge "${timeout}" ]; then + echo "Warning: PID ${pid} did not exit within ${timeout}s." >&2 + return 1 + fi + sleep 1 + elapsed=$((elapsed + 1)) + done + return 0 +} + +CLEANED_UP=0 +# Graceful shutdown: stop morphnode first so Engine API calls cease, then stop +# geth and wait for DB/trie cache flush. cleanup() { + exit_code=${1:-0} + if [ "${CLEANED_UP}" -eq 1 ]; then + return + fi + CLEANED_UP=1 echo "" - echo "Stopping..." - [ -n "${GETH_PID:-}" ] && kill ${GETH_PID} 2>/dev/null - [ -n "${NODE_PID:-}" ] && kill ${NODE_PID} 2>/dev/null + echo "Stopping morphnode and geth gracefully..." + if [ -n "${NODE_PID:-}" ] && kill -0 "${NODE_PID}" 2>/dev/null; then + kill -TERM "${NODE_PID}" 2>/dev/null || true + wait_for_pid_exit "${NODE_PID}" 60 || true + fi + if [ -n "${GETH_PID:-}" ] && kill -0 "${GETH_PID}" 2>/dev/null; then + kill -TERM "${GETH_PID}" 2>/dev/null || true + wait_for_pid_exit "${GETH_PID}" 120 || true + fi rm -f .geth.pid .node.pid - exit + exit "${exit_code}" } -trap cleanup INT TERM +trap 'cleanup 0' INT TERM # Validate entrypoint file case "${GETH_ENTRYPOINT_FILE}" in ./entrypoint-geth.sh) ;; *) - echo "Error: invalid GETH_ENTRYPOINT_FILE: ${GETH_ENTRYPOINT_FILE}" + echo "Error: invalid GETH_ENTRYPOINT_FILE: ${GETH_ENTRYPOINT_FILE}" >&2 exit 1 ;; esac # Start geth echo "Starting geth..." -GETH_BINARY=${GETH_BINARY} \ -GETH_DATADIR=${MORPH_HOME}/geth-data \ -JWT_SECRET_PATH=${JWT_SECRET_FILE} \ -MORPH_FLAG=${MORPH_FLAG} \ -sh ${GETH_ENTRYPOINT_FILE} & +GETH_BINARY="${GETH_BINARY}" \ +GETH_DATADIR="${MORPH_HOME}/geth-data" \ +JWT_SECRET_PATH="${JWT_SECRET_FILE}" \ +MORPH_FLAG="${MORPH_FLAG}" \ +sh "${GETH_ENTRYPOINT_FILE}" & GETH_PID=$! echo "${GETH_PID}" > .geth.pid # Wait for geth engine RPC (port 8551) -echo "Waiting for geth to be ready..." -for _ in $(seq 1 30); do - if nc -z localhost 8551 2>/dev/null; then +echo "Waiting for geth engine RPC (port 8551, timeout ${GETH_READY_TIMEOUT}s)..." +elapsed=0 +while [ "${elapsed}" -lt "${GETH_READY_TIMEOUT}" ]; do + if is_port_open 8551; then echo "Geth is ready." break fi - if ! kill -0 ${GETH_PID} 2>/dev/null; then - echo "Error: geth process exited unexpectedly." + if ! kill -0 "${GETH_PID}" 2>/dev/null; then + echo "Error: geth process exited unexpectedly. Check ${MORPH_HOME}/geth-data/geth.log." >&2 rm -f .geth.pid exit 1 fi sleep 1 + elapsed=$((elapsed + 1)) done -if ! nc -z localhost 8551 2>/dev/null; then - echo "Error: geth did not become ready within 30 seconds." - cleanup - exit 1 +if ! is_port_open 8551; then + echo "Error: geth did not become ready within ${GETH_READY_TIMEOUT} seconds." >&2 + cleanup 1 fi # Start morphnode echo "Starting morphnode..." -NODE_BINARY=${NODE_BINARY} \ -NODE_HOME=${MORPH_HOME}/node-data \ -JWT_SECRET_PATH=${JWT_SECRET_FILE} \ +NODE_BINARY="${NODE_BINARY}" \ +NODE_HOME="${MORPH_HOME}/node-data" \ +JWT_SECRET_PATH="${JWT_SECRET_FILE}" \ NODE_EXTRA_FLAGS="${NODE_EXTRA_FLAGS:-}" \ sh ./entrypoint-node.sh & NODE_PID=$! echo "${NODE_PID}" > .node.pid +# Catch immediate startup errors (bad config, missing RPC, permission errors) +sleep 2 +if ! kill -0 "${NODE_PID}" 2>/dev/null; then + echo "Error: morphnode exited immediately after startup. Check ${MORPH_HOME}/node-data/node.log." >&2 + cleanup 1 +fi + echo "" echo "=========================================" echo " geth PID: ${GETH_PID}" @@ -112,4 +238,26 @@ echo "=========================================" echo "Press Ctrl+C to stop both processes." echo "" -wait +while kill -0 "${GETH_PID}" 2>/dev/null && kill -0 "${NODE_PID}" 2>/dev/null; do + sleep 2 +done + +# Give `make stop-binary` a moment to clear PID files during a deliberate shutdown +sleep 1 +if ! kill -0 "${NODE_PID}" 2>/dev/null; then + if [ ! -f .node.pid ]; then + wait "${GETH_PID}" 2>/dev/null || true + exit 0 + fi + echo "Error: morphnode (PID ${NODE_PID}) exited unexpectedly. Check ${MORPH_HOME}/node-data/node.log." >&2 + cleanup 1 +fi + +if ! kill -0 "${GETH_PID}" 2>/dev/null; then + if [ ! -f .geth.pid ]; then + wait "${NODE_PID}" 2>/dev/null || true + exit 0 + fi + echo "Error: geth (PID ${GETH_PID}) exited unexpectedly. Check ${MORPH_HOME}/geth-data/geth.log." >&2 + cleanup 1 +fi From be897b12a418185ffce56139bd41503f595b0234 Mon Sep 17 00:00:00 2001 From: panos Date: Tue, 1 Dec 2026 05:30:04 +0000 Subject: [PATCH 3/3] fix(reth): let proofs init run long and stop cleanly `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. --- README.md | 2 ++ morph-node/.env | 3 +++ morph-node/.env_hoodi | 3 +++ morph-node/entrypoint-reth.sh | 33 ++++++++++++++++++++++++++++++++- morph-node/run-binary-reth.sh | 30 +++++++++++++++++++++++++++--- 5 files changed, 67 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 806c157..ce4eca8 100644 --- a/README.md +++ b/README.md @@ -209,6 +209,8 @@ Set `RETH_PROOFS_HISTORY=true` (and optionally `RETH_PROOFS_WINDOW`, `RETH_PROOF_PERMITS`) in `.env` / `.env_hoodi` **only on a restored post-Jade paired snapshot** (never an empty DB). `entrypoint-reth.sh` verifies `${RETH_DATADIR}/db` exists, idempotently runs `morph-reth proofs init`, and launches `morph-reth node --proofs-history`. + On first start, `proofs init` copies the full state at the current tip into `reth-data/historical-proofs`; on mainnet this can take a long time (progress and ETA are logged as `Processed entries`). The engine RPC only opens after it finishes, so binary mode (`run-binary-reth.sh`) waits without a timeout when `RETH_PROOFS_HISTORY=true` (set `RETH_READY_TIMEOUT=` to bound it), and in Docker the healthcheck reports `unhealthy` until then (the container is not restarted). Init is resumable: stopping during init (Ctrl+C, `make stop-binary`, `docker stop`) interrupts it cleanly and the next start continues from the last committed batch, as long as the chain tip has not moved in between. If the node was run without `RETH_PROOFS_HISTORY` after an interrupted init, delete `reth-data/historical-proofs` before enabling it again. + ### Running with `go-ethereum` (`geth`) - **Docker Compose**: diff --git a/morph-node/.env b/morph-node/.env index 3c9e3ac..86e004a 100644 --- a/morph-node/.env +++ b/morph-node/.env @@ -31,6 +31,9 @@ RETH_LOG_FILTER=info # Optional historical proof index for prover-facing nodes (requires a post-Jade # paired snapshot; runs `morph-reth proofs init` idempotently before startup). +# The first init can take a long time on mainnet (resumable, progress logged as +# "Processed entries"); binary mode then waits for the engine RPC without a +# timeout unless RETH_READY_TIMEOUT is set. RETH_PROOFS_HISTORY=false RETH_PROOFS_WINDOW= RETH_PROOF_PERMITS= diff --git a/morph-node/.env_hoodi b/morph-node/.env_hoodi index 1bcfa04..ef2d235 100644 --- a/morph-node/.env_hoodi +++ b/morph-node/.env_hoodi @@ -31,6 +31,9 @@ RETH_LOG_FILTER=info # Optional historical proof index for prover-facing nodes (requires a post-Jade # paired snapshot; runs `morph-reth proofs init` idempotently before startup). +# The first init can take a long time on mainnet (resumable, progress logged as +# "Processed entries"); binary mode then waits for the engine RPC without a +# timeout unless RETH_READY_TIMEOUT is set. RETH_PROOFS_HISTORY=false RETH_PROOFS_WINDOW= RETH_PROOF_PERMITS= diff --git a/morph-node/entrypoint-reth.sh b/morph-node/entrypoint-reth.sh index 0183375..30ecf24 100755 --- a/morph-node/entrypoint-reth.sh +++ b/morph-node/entrypoint-reth.sh @@ -41,16 +41,47 @@ mkdir -p "${LOG_DIR}" # Optional historical proofs initialization (idempotent). Mainnet and Hoodi # genesis blocks predate the Jade (ZK-trie -> MPT) fork, so proof history must # only be anchored on a restored post-Jade paired snapshot, never an empty DB. +# +# The first `proofs init` copies the full state at the current tip into the proof +# DB and can take a long time on mainnet (progress/ETA logged as "Processed +# entries"). It commits in batches, resumes after an interruption as long as the +# chain tip has not moved, and exits promptly on SIGTERM/SIGINT. Run it in the +# background and forward stop signals: as PID 1 in Docker this shell would +# otherwise ignore SIGTERM until SIGKILL, and in binary mode a stop signal would +# kill only this shell and leave the init process running as an orphan. if [ "${RETH_PROOFS_HISTORY}" = "true" ]; then if [ ! -d "${RETH_DATADIR}/db" ]; then echo "Error: RETH_PROOFS_HISTORY=true requires an existing post-Jade DB at ${RETH_DATADIR}/db." >&2 echo "Restore a paired reth snapshot before enabling historical proofs." >&2 exit 1 fi + INIT_PID="" + STOP_SIGNAL="" + trap 'STOP_SIGNAL=TERM; [ -z "${INIT_PID}" ] || kill -TERM "${INIT_PID}" 2>/dev/null || true' TERM + trap 'STOP_SIGNAL=INT; [ -z "${INIT_PID}" ] || kill -INT "${INIT_PID}" 2>/dev/null || true' INT + echo "Running morph-reth proofs init (no-op if already initialized)..." "${RETH_BIN}" proofs init \ --chain "${RETH_CHAIN}" \ --datadir "${RETH_DATADIR}" \ - --log.file.directory "${LOG_DIR}" + --log.file.directory "${LOG_DIR}" & + INIT_PID=$! + # Forward a stop signal that arrived before INIT_PID was known. + [ -z "${STOP_SIGNAL}" ] || kill -"${STOP_SIGNAL}" "${INIT_PID}" 2>/dev/null || true + INIT_RC=0 + while kill -0 "${INIT_PID}" 2>/dev/null; do + # wait returns early (>128) when a trapped signal arrives; keep waiting for init to exit. + wait "${INIT_PID}" && INIT_RC=0 || INIT_RC=$? + done + trap - TERM INT + if [ -n "${STOP_SIGNAL}" ]; then + echo "morph-reth proofs init interrupted by SIG${STOP_SIGNAL}; it resumes on the next start." >&2 + if [ "${STOP_SIGNAL}" = "INT" ]; then exit 130; fi + exit 143 + fi + if [ "${INIT_RC}" -ne 0 ]; then + echo "Error: morph-reth proofs init failed (exit ${INIT_RC})." >&2 + exit "${INIT_RC}" + fi fi # Parse static-nodes.json (a JSON array of "enode://..." strings) into a single diff --git a/morph-node/run-binary-reth.sh b/morph-node/run-binary-reth.sh index b8963a9..c9a7a60 100755 --- a/morph-node/run-binary-reth.sh +++ b/morph-node/run-binary-reth.sh @@ -77,7 +77,21 @@ fi RETH_BINARY=${RETH_BINARY:-./bin/morph-reth} NODE_BINARY=${NODE_BINARY:-./bin/morphnode} -RETH_READY_TIMEOUT=${RETH_READY_TIMEOUT:-120} +# Seconds to wait for the engine RPC (port 8551); 0 waits indefinitely. A crashed +# process is detected within a second either way. With RETH_PROOFS_HISTORY=true the +# first start runs `morph-reth proofs init` before the port opens, which can take far +# longer than a normal startup on mainnet, so the default there is no limit. +if [ "${RETH_PROOFS_HISTORY:-false}" = "true" ]; then + RETH_READY_TIMEOUT=${RETH_READY_TIMEOUT:-0} +else + RETH_READY_TIMEOUT=${RETH_READY_TIMEOUT:-120} +fi +case "${RETH_READY_TIMEOUT}" in + ''|*[!0-9]*) + echo "Error: RETH_READY_TIMEOUT must be a non-negative integer (got '${RETH_READY_TIMEOUT}')." >&2 + exit 1 + ;; +esac # Check binaries if [ ! -x "${RETH_BINARY}" ]; then @@ -210,9 +224,16 @@ RETH_PID=$! echo "${RETH_PID}" > .reth.pid # Wait for reth engine RPC (port 8551) -echo "Waiting for reth engine RPC (port 8551, timeout ${RETH_READY_TIMEOUT}s)..." +if [ "${RETH_READY_TIMEOUT}" -gt 0 ]; then + echo "Waiting for reth engine RPC (port 8551, timeout ${RETH_READY_TIMEOUT}s)..." +else + echo "Waiting for reth engine RPC (port 8551, no timeout)..." +fi +if [ "${RETH_PROOFS_HISTORY:-false}" = "true" ]; then + echo "RETH_PROOFS_HISTORY=true: 'morph-reth proofs init' runs before the port opens and can take a long time on first start (progress is logged as 'Processed entries')." +fi elapsed=0 -while [ "${elapsed}" -lt "${RETH_READY_TIMEOUT}" ]; do +while [ "${RETH_READY_TIMEOUT}" -eq 0 ] || [ "${elapsed}" -lt "${RETH_READY_TIMEOUT}" ]; do if is_port_open 8551; then echo "Reth is ready." break @@ -224,6 +245,9 @@ while [ "${elapsed}" -lt "${RETH_READY_TIMEOUT}" ]; do fi sleep 1 elapsed=$((elapsed + 1)) + if [ $((elapsed % 60)) -eq 0 ]; then + echo "Still waiting for reth engine RPC (${elapsed}s elapsed)..." + fi done if ! is_port_open 8551; then