Skip to content

replace snapshot fetchers with bash - #451

Merged
camembera merged 7 commits into
mainfrom
guides/snapshot-shell
Sep 4, 2026
Merged

replace snapshot fetchers with bash#451
camembera merged 7 commits into
mainfrom
guides/snapshot-shell

Conversation

@camembera

@camembera camembera commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Description

Replace fetch-berachain-snapshot.js and fetch-berachain-snapshot-v2.js with bash restore scripts. After Quickstart setup, . ./env.sh && ./fetch-berachain-snapshot.sh downloads the latest official pruned snapshots and extracts them into $BEACOND_DATA / $RETH_DATA. Consensus keys and jwt.hex stay in place. A fresh setup-reth.sh datadir is replaced without a hand rm.

env.sh looks up beacond only and defaults RPC to 26657 / 8545 when PORT_BASE is unset.

Storage v2 is the same env and datadirs: ./fetch-berachain-snapshot-v2.sh. Missing catalog is a generic HTTP or parse error, not a v1 fallback. EL restore uses bera-reth download --manifest-url and fails closed if that flag is absent.

Companion: berachain/docs#107

Type of Change

  • New guide/example
  • Update to existing guide/example
  • Bug fix in a guide/example
  • Style/formatting update
  • Refactor (no functional changes)
  • Other (please describe):

Guide Details

  • Guide Name: node-scripts snapshot restore
  • Category: Infrastructure
  • Dependencies Added: none (curl, lz4, tar already required)
  • Network(s) Used: Bepolia, Mainnet
  • Entry Point: apps/node-scripts/fetch-berachain-snapshot.sh (v2: fetch-berachain-snapshot-v2.sh)

Checklist

  • The guide/example is clear and easy to follow
  • All steps are reproducible (instructions/scripts work as described)
  • All new/changed code is commented where necessary
  • Documentation is updated (README, inline docs, etc.)
  • No sensitive information or secrets are included
  • Example runs without errors or warnings
  • (If applicable) Screenshots or output are included for clarity

Additional Notes

Playground on an isolated tree: Bepolia v1 pruned, Mainnet v1 pruned, then Bepolia v2 pruned. After each restore both clients started, imported blocks, and local height was within snapshot lag of public tip and advancing. Shell tests in-repo cover extract, key preservation, --force, and v2 fail-closed behavior.

Operators restore pruned Beacon Kit and Bera-Reth into the Quickstart datadirs with one command, without node, and without overwriting consensus keys.
Comment thread apps/node-scripts/lib-snapshot.sh Outdated
The install step is optional and unused by this job's only check. Run Prettier first, and let Foundry fail without failing the build.
Comment thread apps/node-scripts/fetch-berachain-snapshot.sh Outdated
Comment thread apps/node-scripts/fetch-berachain-snapshot.sh Outdated
Comment thread apps/node-scripts/fetch-berachain-snapshot.sh Outdated
Comment thread apps/node-scripts/fetch-berachain-snapshot.sh
The fetchers used NETWORK="${CHAIN:-mainnet}" before any env file parse, so a Quickstart tree with CHAIN=bepolia in env.sh restored mainnet.
- Delete tests/test-snapshot-urls.js (orphan Node health check, not in bash suite).
- Stop advertising fetch-berachain-snapshot-v2.sh in README; keep the file.
- Reject invalid CHAIN instead of silently falling back to mainnet.
- README step 5 no longer says source env.sh first.
@camembera camembera changed the title Restore snapshots with bash into Quickstart datadirs replace snapshot fetchers with bash Sep 3, 2026
Comment thread .github/workflows/ci.yml Outdated

- name: Prettier check
run: bunx prettier@3.6.2 --check "**/*.{ts,tsx,md}" --ignore-path .prettierignore

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drop this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dropped this workflow change. Foundry and Prettier are back to the order on main.

@camembera
camembera requested a review from chuck-bear September 3, 2026 18:53
The snapshot restore does not need a workflow tweak, and Foundry flakes stay a separate problem.
@camembera
camembera merged commit 1d5e389 into main Sep 4, 2026
3 of 5 checks passed
@camembera
camembera deleted the guides/snapshot-shell branch September 4, 2026 16:10
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