Notify lookup sync of gossip processing results (#5722)

* Notify lookup sync of gossip processing results

* Add tests

* Add GossipBlockProcessResult event

* Re-add dropped comments

* Update beacon_node/network/src/network_beacon_processor/sync_methods.rs

* update test_lookup_disconnection_peer_left
This commit is contained in:
Lion - dapplion
2024-05-13 14:41:29 +03:00
committed by GitHub
parent 6d792b4280
commit 93e0649abc
12 changed files with 398 additions and 93 deletions

View File

@@ -144,6 +144,9 @@ pub enum SyncMessage<E: EthSpec> {
process_type: BlockProcessType,
result: BlockProcessingResult<E>,
},
/// A block from gossip has completed processing,
GossipBlockProcessResult { block_root: Hash256, imported: bool },
}
/// The type of processing specified for a received block.
@@ -153,14 +156,6 @@ pub enum BlockProcessType {
SingleBlob { id: Id },
}
impl BlockProcessType {
pub fn id(&self) -> Id {
match self {
BlockProcessType::SingleBlock { id } | BlockProcessType::SingleBlob { id } => *id,
}
}
}
#[derive(Debug)]
pub enum BlockProcessingResult<E: EthSpec> {
Ok(AvailabilityProcessingStatus),
@@ -637,6 +632,14 @@ impl<T: BeaconChainTypes> SyncManager<T> {
} => self
.block_lookups
.on_processing_result(process_type, result, &mut self.network),
SyncMessage::GossipBlockProcessResult {
block_root,
imported,
} => self.block_lookups.on_external_processing_result(
block_root,
imported,
&mut self.network,
),
SyncMessage::BatchProcessed { sync_type, result } => match sync_type {
ChainSegmentProcessId::RangeBatchId(chain_id, epoch) => {
self.range_sync.handle_block_process_result(