Skip to content

Add mkberanode-v2.sh: system installer restoring from storage v2 snapshots - #439

Draft
camembera wants to merge 2 commits into
mainfrom
feat/mkberanode-v2
Draft

camembera wants to merge 2 commits into
mainfrom
feat/mkberanode-v2

Conversation

@camembera

Copy link
Copy Markdown
Contributor

Summary

Same installer as mkberanode.sh (binaries, systemd units, storage provisioning) but the snapshot step restores from Berachain's storage v2 catalog instead of the v1 index.csv. Both chains are treated identically — mainnet's v2 catalog is assumed to be bepolia-shaped, matching every other v2 consumer in this campaign (fetch-berachain-snapshot-v2.js, berabox, bera-reth's own download command).

Mode mapping, worth flagging explicitly: --mode archive here means "keep everything on both layers" (this script already sets CL pruning = "nothing" for it), which is the v2 catalog's full_archive pairing (EL --archive, CL cl-archive) — not the v2 archive storage_mode, which pairs EL --archive with the still-pruned cl-pruned. --mode pruned runs the EL node with --full (not --minimal), so it restores with the --full preset to match. Copying fetch-berachain-snapshot-v2.js's pruned → --minimal mapping here would have silently under-provisioned the running node relative to its own pruning policy.

EL restore shells out to the already-installed bera-reth download binary (storage v2 EL objects are a modular manifest, not a tarball, so the old curl|lz4|tar path doesn't apply); CL restore keeps the existing disk-then-extract mechanism unchanged, only the URL source changed. init_el's bera-reth init is skipped when the snapshot download succeeds, since bera-reth download already initializes and configures the datadir.

mkberanode.sh (v1) is untouched.

Test plan

  • bash -n apps/node-scripts/mkberanode-v2.sh — clean.
  • Catalog-parsing helpers smoke-tested in isolation against the live bepolia catalog: el-manifest, cl-pruned, cl-archive all resolve to the correct real object URLs; an unrecognized role fails closed (exit 1).
  • Full end-to-end run (root, provisions a real host) not exercised here — no existing test harness for mkberanode.sh either; same as that script, this ships without one.

…shots.

Same installer as mkberanode.sh (binaries, systemd units, storage
provisioning) but the snapshot step restores from Berachain's v2 catalog
instead of the v1 index.csv. Both chains are treated identically; mainnet's
v2 catalog is assumed to be bepolia-shaped, matching every other v2 consumer
in this campaign.

--mode archive here means "keep everything on both layers" (this script
sets CL pruning = "nothing" for it), which is the v2 catalog's full_archive
pairing (EL --archive, CL cl-archive) -- not the v2 "archive" storage_mode,
which pairs EL --archive with the still-pruned cl-pruned. --mode pruned
runs the EL node with --full (not --minimal), so it restores with the
--full preset to match. Getting this mapping wrong would silently
under-provision the running node relative to its own pruning policy.

EL restore shells out to the already-installed bera-reth download binary
(storage v2 EL objects are a modular manifest, not a tarball); CL restore
keeps the existing disk-then-extract lz4/tar mechanism, only the URL
source changed.
…store.

Self-review caught two bugs the prior commit's own message claimed were
handled but weren't:

- init_el() ran bera-reth init unconditionally, even right after
  bera-reth download successfully restored and configured the EL datadir.
  Every other restore command in this campaign refuses a non-empty
  --datadir; running init again on top of a just-restored one risked
  aborting the whole installer on its happy path. Now gated on whether
  the download actually succeeded.

- --mode pruned restored with the EL --minimal preset, but the systemd
  unit for --mode pruned runs bera-reth with --full (see
  install_systemd_units), not --minimal. Restoring --minimal data under
  a --full-pruning-policy node was exactly the under-provisioning bug
  the surrounding comment warned against.

Also restored the catalog header shape check in select_v2_role() that a
malformed catalog should fail on, not silently misparse.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant