Expand description
The truncation contract: two pure decision rules, applied where the data lives.
plan_truncation routes the wallet-level decision, from the
wallet state (WalletTruncationState: birthday and highest
scanned height) and the truncation target, it returns whether the
truncation is a no-op, a full clear, or a rollback to the target.
plan_pool_truncation is the per-tree rule: from one tree’s
checkpoint facts (TreeTruncationFacts) it returns that tree’s
outcome, and the shard-tree applier derives each tree’s outcome
through it at the point of application. Both rules are pure. All
mutation stays with the appliers.
Every per-pool outcome carries the evidence that justifies it: a rollback carries the checkpoint it found, and a rescan sentence carries the newest checkpoint that condemned the tree. The applier derives its actions and its error messages from that evidence instead of re-deriving or asserting it.
The contract the plan guarantees, per store:
- Wallet blocks, transactions, nullifiers, and outpoints retain exactly the data at or below the plan’s height.
- A shard tree holding a checkpoint at the height rolls back to it.
- A shard tree recording no chain state above the height is left untouched: it has nothing to remove, so it cannot be “broken” with respect to this truncation. This is the state of the empty ironwood tree a pre-ironwood (v0) wallet blob migrates to, whose only checkpoint is the height-zero initialization checkpoint.
- A shard tree holding state above the height with no checkpoint at it cannot roll back. Only the clear-and-rescan recovery restores integrity, and the plan says so explicitly.
Decisions live here and nowhere else: the applying code performs no judgement of its own beyond reporting a planned rollback that the tree store unexpectedly refuses.
Structs§
- Tree
Truncation Facts - What the planner reads of one shard tree, gathered at the truncation target.
- Wallet
Truncation State - The wallet state a truncation decision reads: where scanning began and how far it has reached.
Enums§
- Pool
Truncation - The correct truncation outcome for one shard tree, carrying the evidence that justifies it.
- Truncation
Plan - The correct post-truncation state of every store, decided purely.
Functions§
- plan_
truncation - Decides the correct truncation of the wallet, purely.