Hack for checkpoint sync

This commit is contained in:
Eitan Seri-Levi
2026-05-04 15:46:48 +03:00
parent 3d23f9be0d
commit 75d4333776
3 changed files with 38 additions and 5 deletions

View File

@@ -3041,7 +3041,29 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
// In the case of (2), skipping the block is valid since we should never import it. // In the case of (2), skipping the block is valid since we should never import it.
// However, we will potentially get a `ParentUnknown` on a later block. The sync // However, we will potentially get a `ParentUnknown` on a later block. The sync
// protocol will need to ensure this is handled gracefully. // protocol will need to ensure this is handled gracefully.
Err(BlockError::WouldRevertFinalizedSlot { .. }) => continue, Err(BlockError::WouldRevertFinalizedSlot { .. }) => {
// For Gloas blocks, persist the envelope even though we're skipping
// the block. This is needed after checkpoint sync: the checkpoint
// block's envelope must be in the store so that `load_parent` can
// verify it when importing the first post-checkpoint block.
if let RangeSyncBlock::Gloas {
envelope: Some(ref available_envelope),
..
} = block
{
let (signed_envelope, _columns) = available_envelope.clone().deconstruct();
if let Err(e) = self
.store
.put_payload_envelope(&block_root, &signed_envelope)
{
return Err(Box::new(ChainSegmentResult::Failed {
imported_blocks,
error: BlockError::BeaconChainError(Box::new(e.into())),
}));
}
}
continue;
}
// The block has a known parent that does not descend from the finalized block. // The block has a known parent that does not descend from the finalized block.
// There is no need to process this block or any children. // There is no need to process this block or any children.
Err(BlockError::NotFinalizedDescendant { block_parent_root }) => { Err(BlockError::NotFinalizedDescendant { block_parent_root }) => {

View File

@@ -2017,10 +2017,11 @@ fn load_parent<T: BeaconChainTypes, B: AsBlock<T::EthSpec>>(
// If the parent's execution payload envelope hasn't arrived yet, // If the parent's execution payload envelope hasn't arrived yet,
// return an unknown parent error so the block gets sent to the // return an unknown parent error so the block gets sent to the
// reprocess queue. // reprocess queue.
if chain if parent_block.slot() != 0
.spec && chain
.fork_name_at_slot::<T::EthSpec>(parent_block.slot()) .spec
.gloas_enabled() .fork_name_at_slot::<T::EthSpec>(parent_block.slot())
.gloas_enabled()
{ {
let _envelope = chain let _envelope = chain
.store .store

View File

@@ -864,6 +864,16 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
peer_action: Some(PeerAction::LowToleranceError), peer_action: Some(PeerAction::LowToleranceError),
}) })
} }
BlockError::ParentEnvelopeUnknown { parent_root } => {
Err(ChainSegmentFailed {
message: format!(
"Block's parent envelope has not been received: {}",
parent_root
),
// Don't penalize the peer, the envelope may arrive later.
peer_action: None,
})
}
BlockError::DuplicateFullyImported(_) BlockError::DuplicateFullyImported(_)
| BlockError::DuplicateImportStatusUnknown(..) => { | BlockError::DuplicateImportStatusUnknown(..) => {
// This can happen for many reasons. Head sync's can download multiples and parent // This can happen for many reasons. Head sync's can download multiples and parent