Gloas range sync (#9362)

N/A


  Implement range sync in gloas.
Basically requests blocks and payloads post gloas from the same peer, couples them and sends it for processing.
Does not change sync much at all other than adding the machinery for payloads by range requests.

Main changes are:
`RangeSyncBlock` which used to be a struct is an enum to account for the Gloas case. This allows a clear separation between gloas and pre-gloas code.
`AvailableBlockData` now has a `BlockInEnvelope` variant. This is to clearly indicate the post gloas case. I feel this is simpler to follow compared to `NoData` variant.


Tries to extract post gloas logic into its own functions so that there is minimal logic change in mainnet range sync behaviour.

This is meant as a stable base on which we can iterate further to make range sync cleaner and for unblocking range sync support on devnet. Some ideas for later is removing the retry mechanism in favour of delegating column fetching to lookup sync which can be done post #9155 and batch signature verifying envelopes.


Co-Authored-By: Pawan Dhananjay <pawandhananjay@gmail.com>

Co-Authored-By: dapplion <35266934+dapplion@users.noreply.github.com>

Co-Authored-By: Eitan Seri-Levi <eserilev@ucsc.edu>
This commit is contained in:
Pawan Dhananjay
2026-06-10 16:00:57 +05:30
committed by GitHub
parent 844c6dd4a0
commit db3192e001
24 changed files with 1311 additions and 232 deletions

View File

@@ -3108,6 +3108,15 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
let mut blocks = filtered_chain_segment.split_off(last_index);
std::mem::swap(&mut blocks, &mut filtered_chain_segment);
// Extract envelopes before passing blocks to signature verification.
let envelopes: Vec<_> = blocks
.iter()
.map(|(_, block)| match block {
RangeSyncBlock::Gloas { envelope, .. } => envelope.clone(),
RangeSyncBlock::Base(_) => None,
})
.collect();
let chain = self.clone();
let signature_verification_future = self.spawn_blocking_handle(
move || signature_verify_chain_segment(blocks, &chain),
@@ -3132,11 +3141,15 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
};
// Import the blocks into the chain.
for signature_verified_block in signature_verified_blocks {
for (signature_verified_block, maybe_envelope) in
signature_verified_blocks.into_iter().zip(envelopes)
{
let block_slot = signature_verified_block.slot();
let block_root = signature_verified_block.block_root();
let block = signature_verified_block.block_cloned();
match self
.process_block(
signature_verified_block.block_root(),
block_root,
signature_verified_block,
notify_execution_layer,
BlockImportSource::RangeSync,
@@ -3166,11 +3179,8 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
}
}
Err(BlockError::DuplicateFullyImported(block_root)) => {
debug!(
?block_root,
"Ignoring already known blocks while processing chain segment"
);
continue;
// Block was already imported, envelope might need re-import
imported_blocks.push((block_root, block_slot));
}
Err(error) => {
return ChainSegmentResult::Failed {
@@ -3179,6 +3189,18 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
};
}
}
// Process the envelope after the block has been imported.
if let Some(envelope) = maybe_envelope
&& let Err(e) = self
.process_range_sync_envelope(envelope, block_root, block)
.await
{
return ChainSegmentResult::Failed {
imported_blocks,
error: BlockError::EnvelopeError(Box::new(e)),
};
}
}
}