mirror of
https://github.com/sigp/lighthouse.git
synced 2026-06-16 02:08:29 +00:00
Gloas payload cache (#9209)
In Gloas, beacon blocks are imported into fork choice immediately - the payload envelope and data columns arrive separately. KZG commitments moved from the column sidecar into the execution payload bid, so the existing `DataAvailabilityChecker` (which assumes block and data are coupled) can't be used for Gloas. * Introduced `PendingPayloadCache` to keep track of payload and data columns per block root. * Added gossip column verification * Added support for Gloas data column reconstruction * Payload envelope verification simplified: removed `MaybeAvailableEnvelope`, `ExecutedEnvelope`, `EnvelopeImportData` Not yet implemented (tracked with TODOs): - Proper lookup sync for Gloas columns arriving before blocks - Partial column merging for Gloas - Moving `load_gloas_payload_bid` disk reads off the async runtime - Backfill/range sync for Gloas Based on @eserilev's PR and work in progress. See also #9202 for verification. Co-Authored-By: Eitan Seri-Levi <eserilev@ucsc.edu> Co-Authored-By: Eitan Seri- Levi <eserilev@gmail.com> Co-Authored-By: Daniel Knopik <daniel@dknopik.de> Co-Authored-By: Daniel Knopik <107140945+dknopik@users.noreply.github.com> Co-Authored-By: dapplion <35266934+dapplion@users.noreply.github.com> Co-Authored-By: Jimmy Chen <jchen.tc@gmail.com>
This commit is contained in:
@@ -548,13 +548,19 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn no_blobs_into_responses() {
|
||||
let spec = Arc::new(test_spec::<E>());
|
||||
|
||||
let mut u = types::test_utils::test_unstructured();
|
||||
let blocks = (0..4)
|
||||
.map(|_| {
|
||||
generate_rand_block_and_blobs::<E>(ForkName::Base, NumBlobs::None, &mut u)
|
||||
.unwrap()
|
||||
.0
|
||||
.into()
|
||||
generate_rand_block_and_blobs::<E>(
|
||||
spec.fork_name_at_epoch(Epoch::new(0)),
|
||||
NumBlobs::None,
|
||||
&mut u,
|
||||
)
|
||||
.unwrap()
|
||||
.0
|
||||
.into()
|
||||
})
|
||||
.collect::<Vec<Arc<SignedBeaconBlock<E>>>>();
|
||||
|
||||
@@ -565,7 +571,6 @@ mod tests {
|
||||
// Send blocks and complete terminate response
|
||||
info.add_blocks(blocks_req_id, blocks).unwrap();
|
||||
|
||||
let spec = Arc::new(test_spec::<E>());
|
||||
let da_checker = Arc::new(test_da_checker(spec.clone(), NodeCustodyType::Fullnode));
|
||||
|
||||
// Assert response is finished and RpcBlocks can be constructed
|
||||
|
||||
@@ -181,7 +181,9 @@ pub enum SyncMessage<E: EthSpec> {
|
||||
result: BlockProcessingResult,
|
||||
},
|
||||
|
||||
/// A block from gossip has completed processing,
|
||||
/// A gossip-received component has completed processing and the block may now be imported.
|
||||
/// In Fulu this is sent after block or blob processing. In Gloas this is also sent after
|
||||
/// data column or payload envelope processing triggers availability.
|
||||
GossipBlockProcessResult { block_root: Hash256, imported: bool },
|
||||
}
|
||||
|
||||
@@ -905,9 +907,13 @@ impl<T: BeaconChainTypes> SyncManager<T> {
|
||||
}),
|
||||
);
|
||||
}
|
||||
// TODO(gloas) support gloas data column variant
|
||||
DataColumnSidecar::Gloas(_) => {
|
||||
error!("Gloas variant not yet supported")
|
||||
// TODO(gloas): proper lookup sync for Gloas. Routing into
|
||||
// `handle_unknown_block_root` here mixes column processing with the
|
||||
// single-block-lookup path; the Gloas column-arrives-before-block
|
||||
// case wants its own queue/wakeup.
|
||||
debug!(%block_root, "Received unknown block data column message");
|
||||
self.handle_unknown_block_root(peer_id, block_root);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1085,10 +1085,22 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
|
||||
block_root: Hash256,
|
||||
lookup_peers: Arc<RwLock<HashSet<PeerId>>>,
|
||||
) -> Result<LookupRequestResult, RpcRequestSendError> {
|
||||
let slot = self
|
||||
.chain
|
||||
.canonical_head
|
||||
.fork_choice_read_lock()
|
||||
.get_block(&block_root)
|
||||
.map(|block| block.slot)
|
||||
.or_else(|| self.chain.slot().ok())
|
||||
.ok_or_else(|| {
|
||||
RpcRequestSendError::InternalError(format!(
|
||||
"Unable to determine slot for block {block_root:?}"
|
||||
))
|
||||
})?;
|
||||
|
||||
let custody_indexes_imported = self
|
||||
.chain
|
||||
.data_availability_checker
|
||||
.cached_data_column_indexes(&block_root)
|
||||
.cached_data_column_indexes(&block_root, slot)
|
||||
.unwrap_or_default();
|
||||
|
||||
let current_epoch = self.chain.epoch().map_err(|e| {
|
||||
|
||||
@@ -2087,8 +2087,7 @@ async fn too_many_processing_failures(depth: usize) {
|
||||
r.build_chain_and_trigger_last_block(depth).await;
|
||||
// Simulate that a peer always returns empty
|
||||
r.simulate(
|
||||
SimulateConfig::new()
|
||||
.with_process_result(|| BlockProcessingResult::Err(BlockError::BlockSlotLimitReached)),
|
||||
SimulateConfig::new().with_process_result(|| BlockError::BlockSlotLimitReached.into()),
|
||||
)
|
||||
.await;
|
||||
// We register multiple penalties, the lookup fails and sync does not progress
|
||||
@@ -2156,9 +2155,10 @@ async fn test_single_block_lookup_duplicate_response() {
|
||||
let mut r = TestRig::default();
|
||||
r.build_chain_and_trigger_last_block(1).await;
|
||||
// Send a DuplicateFullyImported response, the lookup should complete successfully
|
||||
r.simulate(SimulateConfig::new().with_process_result(|| {
|
||||
BlockProcessingResult::Err(BlockError::DuplicateFullyImported(Hash256::ZERO))
|
||||
}))
|
||||
r.simulate(
|
||||
SimulateConfig::new()
|
||||
.with_process_result(|| BlockError::DuplicateFullyImported(Hash256::ZERO).into()),
|
||||
)
|
||||
.await;
|
||||
// The block was not actually imported
|
||||
r.assert_head_slot(0);
|
||||
|
||||
Reference in New Issue
Block a user