Skip to content

Prune block_hashes at every checkpoint#6599

Open
afck wants to merge 1 commit into
linera-io:mainfrom
afck:prune-block-hashes-at-checkpoint
Open

Prune block_hashes at every checkpoint#6599
afck wants to merge 1 commit into
linera-io:mainfrom
afck:prune-block-hashes-at-checkpoint

Conversation

@afck

@afck afck commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Motivation

A checkpoint only guarantees the availability of the blocks it vouches for in its outbox_block_hashes, so a node that bootstraps from it never learns the other pre-checkpoint blocks.

However, a node that just executes a block with a checkpoint, without bootstrapping from it, has its block_hashes collection growing indefinitely.

Proposal

Drop those from block_hashes when executing a checkpoint. Retained below the checkpoint are the vouched-for blocks, which still carry unacknowledged messages, and any block still queued in an outbox.

For the vouched-for set to cover every previous_message_blocks anchor, the checkpoint also drops the anchor of each recipient that has acknowledged everything we sent it. Such an anchor would otherwise dangle even without any pruning, breaking a bootstrapped node on its next block to that recipient.

Finally, process_outgoing_messages now treats a missing block_hashes entry for the outbox's previous height as "no predecessor" instead of a corrupted chain state -- the same state a bootstrapped node's rebuilt outbox is in.

Test Plan

Tests were extended.

Release Plan

  • Nothing to do / These changes follow the usual release cycle.

Links

A checkpoint only guarantees the availability of the blocks it vouches for in
its `outbox_block_hashes`, so a node that bootstraps from it never learns the
other pre-checkpoint blocks. Drop those from `block_hashes` when executing a
checkpoint, so a node that has been following the chain all along converges on
the same set.

Retained below the checkpoint are the vouched-for blocks, which still carry
unacknowledged messages, and any block still queued in an outbox: a queue is
drained by a delivery confirmation from the recipient's validators, which is a
separate path from the acknowledgement that empties `unfinalized_message_blocks`,
so it can outlive the checkpoint's guarantee.

For the vouched-for set to cover every `previous_message_blocks` anchor, the
checkpoint also drops the anchor of each recipient that has acknowledged
everything we sent it. Such an anchor would otherwise dangle even without any
pruning, breaking a bootstrapped node on its next block to that recipient.

Finally, `process_outgoing_messages` now treats a missing `block_hashes` entry
for the outbox's previous height as "no predecessor" instead of a corrupted
chain state -- the same state a bootstrapped node's rebuilt outbox is in.
@afck afck requested review from deuszx, ma2bd and ndr-ds July 13, 2026 09:41
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