Skip to content

feat: add snapshot prune-block for offline ancient block pruning#138

Closed
viaweb3 wants to merge 2 commits into
kccfrom
claude/add-data-pruning-vgbsY
Closed

feat: add snapshot prune-block for offline ancient block pruning#138
viaweb3 wants to merge 2 commits into
kccfrom
claude/add-data-pruning-vgbsY

Conversation

@viaweb3
Copy link
Copy Markdown

@viaweb3 viaweb3 commented Apr 10, 2026

Introduce a new geth snapshot prune-block subcommand that advances the freezer tail in place via the existing ethdb.AncientWriter.TruncateTail primitive, releasing historical block data (headers, bodies, receipts, TDs, canonical hashes) while keeping only the most recent --block-amount-reserved blocks.

The feature is targeted at validator nodes and other non-RPC-serving full nodes that do not need to answer historical queries and want to reclaim the tens of gigabytes typically held by the ancient/ directory.

BlockPruner enforces a hard minimum of params.FullImmutabilityThreshold

  • 10000 = 100000 blocks to safely cover the POSA snapshot reconstruction walk-back distance (see consensus/posa/posa.go snapshot()). After truncation it also advances TxIndexTail so the background transaction indexer does not walk into the freshly pruned range on next startup, and runs a full-range LevelDB compaction to defragment the LSM tree.

The operation is idempotent and requires geth to be stopped while it runs.

https://claude.ai/code/session_01GfSEZQsF89ksKKEtyGP6gC

claude added 2 commits April 10, 2026 15:19
Introduce a new `geth snapshot prune-block` subcommand that advances the
freezer tail in place via the existing ethdb.AncientWriter.TruncateTail
primitive, releasing historical block data (headers, bodies, receipts,
TDs, canonical hashes) while keeping only the most recent
--block-amount-reserved blocks.

The feature is targeted at validator nodes and other non-RPC-serving full
nodes that do not need to answer historical queries and want to reclaim
the tens of gigabytes typically held by the ancient/ directory.

BlockPruner enforces a hard minimum of params.FullImmutabilityThreshold
+ 10000 = 100000 blocks to safely cover the POSA snapshot reconstruction
walk-back distance (see consensus/posa/posa.go snapshot()). After
truncation it also advances TxIndexTail so the background transaction
indexer does not walk into the freshly pruned range on next startup, and
runs a full-range LevelDB compaction to defragment the LSM tree.

The operation is idempotent and requires geth to be stopped while it
runs.

https://claude.ai/code/session_01GfSEZQsF89ksKKEtyGP6gC
Delve's latest release (v1.26.0+) raised its minimum Go toolchain
requirement to 1.24, which breaks the Dockerfile's `go install
.../dlv@latest` step since the builder stage uses golang:1.21-alpine.
The failure is unrelated to any user code and blocks every PR's CI.

Pin dlv to v1.22.1, the last release line that still supports Go 1.21.
When the golang base image is eventually bumped, this pin can be
relaxed as noted in the accompanying comment.

https://claude.ai/code/session_01GfSEZQsF89ksKKEtyGP6gC
@viaweb3 viaweb3 closed this Apr 20, 2026
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.

2 participants