Skip to content

Fully-pruned mode: prune headers and uncles alongside blocks #271

Open

Description

@SDL-A1

Migrated from SergioDemianLerner/rustock#271 (issue by @SDL-A1, 2026-10-05).
Original: SergioDemianLerner/rustock#271

The second of the two coherent storage modes. Normal keeps headers and uncles (#270). Fully pruned keeps neither, nor bodies — a recent window only, as block pruning already does (MIN_KEEP_DEPTH, 8,000).

Most of this already exists

pruner.rs:311-313 already deletes headers, total difficulties and canonical index entries alongside bodies, receipts and the transaction index. There is a test called removes_headers_bodies_receipts_and_the_transaction_index. What is missing is the configuration to ask for it, and the freezer getting out of the way.

A pruned node does not want the freezer

The freezer freezes below head - FREEZE_DEPTH (20,000); pruning keeps the last 8,000. Everything a pruned node would freeze is already below its own keep floor — it would freeze and immediately prune.

The freezer exists to move settled history out of the LSM. A node that discards history has no settled history to move. So fully-pruned mode is --no-freezer (which exists) plus letting the sweep reach headers and uncles.

This matters: teaching the freezer to drop from the bottom would be awkward. It has truncate_head for reorgs and no floor, and its segments are 2 GiB — about 1.8M headers each — so the coarsest it could prune is ~1.8M blocks against a wanted floor of 8,000. Avoiding that entirely is the point.

Flags

--prune-headers and --prune-uncles beside the existing --prune-blocks, plus a convenience that sets all three. They will be used together in practice; keeping them separate makes the invalid combinations reachable only deliberately, and each testable alone.

One guard needs rethinking

pruner.rs:199 refuses to delete a body whose uncle headers the freezer has not taken a copy of. With the freezer off that guard either blocks forever or lets uncles vanish before they are counted. It needs a different answer in this mode — probably "the uncles were verified and counted when the block arrived, and nothing will ask again".

The honest cost

A pruned node cannot re-derive its own chain's work, and cannot serve history. It trusts its own earlier verification, which it did perform. That is the trade.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions