-
Notifications
You must be signed in to change notification settings - Fork 745
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix off-by-one in backfill sig verification #5120
Fix off-by-one in backfill sig verification #5120
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice one!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solid regression test, LGTM
|
||
// If we've reached genesis, add the genesis block root to the batch for all slots | ||
// between 0 and the first block slot, and set the anchor slot to 0 to indicate | ||
// completion. | ||
if expected_block_root == self.genesis_block_root { | ||
let genesis_slot = self.spec.genesis_slot; | ||
for slot in genesis_slot.as_usize()..block.slot().as_usize() { | ||
for slot in genesis_slot.as_usize()..prev_block_slot.as_usize() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, prev_block_slot
case is already covered in the previous iteration in lines
lighthouse/beacon_node/beacon_chain/src/historical_blocks.rs
Lines 131 to 134 in 0aa5ed2
// Store block roots, including at all skip slots in the freezer DB. | |
for slot in (block.slot().as_usize()..prev_block_slot.as_usize()).rev() { | |
chunk_writer.set(slot, block_root, &mut cold_batch)?; | |
} |
@Mergifyio queue |
✅ The pull request has been merged automaticallyThe pull request has been merged automatically at 6f3af67 |
* Fix off-by-one in backfill sig verification * Add self-referential PR link
Issue Addressed
Fix a bug whereby the signature of the very first block in the chain (e.g. slot 1) would not be verified while backfilling. This was due to the
break
that occurs upon reaching the anchor bypassing thesigned_blocks.push(signed_block)
.Proposed Changes
push
before thebreak
so that all blocks are added tosigned_blocks
and subsequently checked.Additional Info
This bug was introduced in Deneb and does not impact v4.5.0. It does impact v4.6.0-rc.0.