Prune block_hashes at every checkpoint#6599
Open
afck wants to merge 1 commit into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_hashescollection growing indefinitely.Proposal
Drop those from
block_hasheswhen 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_blocksanchor, 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_messagesnow treats a missingblock_hashesentry 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
Links