fix checkpoint block potentially not getting backfilled into DB #5863
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.
When using checkpoint sync, only checkpoint state is available, block is not downloaded and backfilled later.
dag.backfill
tracks latest filledslot
, and latestparent_root
for which no block has been synced yet.In checkpoint sync, this assumption is broken, because there, the start
dag.backfill.slot
is set based on checkpoint state slot, and the block is also not available.However, sync manager in backward mode also requests
dag.backfill.slot
andblock_clearance
then backfills the checkpoint block once it is synced. But, there is no guarantee that a peer ever sends us that block. They could send us all parent blocks and solely omit the checkpoint block itself. In that situation, we would accept the parent blocks and advancedag.backfill
, and subsequently never request the checkpoint block again, resulting in gap inside blocks DB that is never filled.To mitigate that, the assumption is restored that
dag.backfill.slot
is the latest filledslot
, anddag.backfill.parent_root
is the next block that needs to be synced. By settingslot
totail.slot + 1
andparent_root
totail.root
, we put a fake summary intodag.backfill
so thatblock_clearance
only proceeds once checkpoint block exists.