diff --git a/beacon_node/beacon_chain/src/beacon_chain.rs b/beacon_node/beacon_chain/src/beacon_chain.rs index f4993c2677..834180888a 100644 --- a/beacon_node/beacon_chain/src/beacon_chain.rs +++ b/beacon_node/beacon_chain/src/beacon_chain.rs @@ -2919,7 +2919,7 @@ impl BeaconChain { Availability::Available(block) => { self.import_available_block(block, count_unrealized).await } - Availability::MissingParts(block_root) => Ok( + Availability::MissingComponents(block_root) => Ok( AvailabilityProcessingStatus::MissingComponents(slot, block_root), ), } diff --git a/beacon_node/beacon_chain/src/data_availability_checker.rs b/beacon_node/beacon_chain/src/data_availability_checker.rs index 5b2b54fa2a..0d8c4541cc 100644 --- a/beacon_node/beacon_chain/src/data_availability_checker.rs +++ b/beacon_node/beacon_chain/src/data_availability_checker.rs @@ -120,7 +120,7 @@ impl ReceivedComponents { /// Indicates if the block is fully `Available` or if we need blobs or blocks /// to "complete" the requirements for an `AvailableBlock`. pub enum Availability { - MissingParts(Hash256), + MissingComponents(Hash256), Available(Box>), } @@ -295,12 +295,12 @@ impl DataAvailabilityChecker { if let Some(executed_block) = received_components.executed_block.take() { self.check_block_availability_maybe_cache(occupied_entry, executed_block)? } else { - Availability::MissingParts(block_root) + Availability::MissingComponents(block_root) } } Entry::Vacant(vacant_entry) => { vacant_entry.insert(ReceivedComponents::new_from_blobs(kzg_verified_blobs)); - Availability::MissingParts(block_root) + Availability::MissingComponents(block_root) } }; @@ -324,7 +324,7 @@ impl DataAvailabilityChecker { Entry::Vacant(vacant_entry) => { let block_root = executed_block.import_data.block_root; vacant_entry.insert(ReceivedComponents::new_from_block(executed_block)); - Availability::MissingParts(block_root) + Availability::MissingComponents(block_root) } }; @@ -377,7 +377,7 @@ impl DataAvailabilityChecker { let _ = received_components.executed_block.insert(executed_block); - Ok(Availability::MissingParts(block_root)) + Ok(Availability::MissingComponents(block_root)) } } diff --git a/beacon_node/network/src/beacon_processor/worker/sync_methods.rs b/beacon_node/network/src/beacon_processor/worker/sync_methods.rs index 2ec23f673c..b057961c4e 100644 --- a/beacon_node/network/src/beacon_processor/worker/sync_methods.rs +++ b/beacon_node/network/src/beacon_processor/worker/sync_methods.rs @@ -60,7 +60,7 @@ impl Worker { // Sync handles these results self.send_sync_message(SyncMessage::BlockPartProcessed { process_type, - result: crate::sync::manager::BlockPartProcessingResult::Ignored, + result: crate::sync::manager::BlockProcessingResult::Ignored, response_type: crate::sync::manager::ResponseType::Block, }); return; diff --git a/beacon_node/network/src/sync/block_lookups/mod.rs b/beacon_node/network/src/sync/block_lookups/mod.rs index a63dc228f1..ccb288c858 100644 --- a/beacon_node/network/src/sync/block_lookups/mod.rs +++ b/beacon_node/network/src/sync/block_lookups/mod.rs @@ -17,7 +17,7 @@ use types::{BlobSidecar, SignedBeaconBlock, Slot}; use self::parent_lookup::{LookupDownloadStatus, PARENT_FAIL_TOLERANCE}; use self::parent_lookup::{ParentLookup, ParentVerifyError}; use self::single_block_lookup::SingleBlockLookup; -use super::manager::BlockPartProcessingResult; +use super::manager::BlockProcessingResult; use super::BatchProcessResult; use super::{ manager::{BlockProcessType, Id}, @@ -794,7 +794,7 @@ impl BlockLookups { pub fn single_block_processed( &mut self, id: Id, - result: BlockPartProcessingResult, + result: BlockProcessingResult, response_type: ResponseType, cx: &mut SyncNetworkContext, ) { @@ -825,7 +825,7 @@ impl BlockLookups { }; let should_remove_lookup = match result { - BlockPartProcessingResult::Ok(status) => match status { + BlockProcessingResult::Ok(status) => match status { AvailabilityProcessingStatus::Imported(root) => { trace!(self.log, "Single block processing succeeded"; "block" => %root); ShouldRemoveLookup::True @@ -836,7 +836,7 @@ impl BlockLookups { ShouldRemoveLookup::False } }, - BlockPartProcessingResult::Ignored => { + BlockProcessingResult::Ignored => { // Beacon processor signalled to ignore the block processing result. // This implies that the cpu is overloaded. Drop the request. warn!( @@ -846,7 +846,7 @@ impl BlockLookups { ); ShouldRemoveLookup::True } - BlockPartProcessingResult::Err(e) => { + BlockProcessingResult::Err(e) => { trace!(self.log, "Single block processing failed"; "block" => %root, "error" => %e); match e { BlockError::BlockIsAlreadyKnown => { @@ -907,7 +907,7 @@ impl BlockLookups { pub fn parent_block_processed( &mut self, chain_hash: Hash256, - result: BlockPartProcessingResult, + result: BlockProcessingResult, response_type: ResponseType, cx: &mut SyncNetworkContext, ) { @@ -932,7 +932,7 @@ impl BlockLookups { }; match &result { - BlockPartProcessingResult::Ok(status) => match status { + BlockProcessingResult::Ok(status) => match status { AvailabilityProcessingStatus::Imported(block_root) => { trace!(self.log, "Parent block processing succeeded"; &parent_lookup, "block_root" => ?block_root) } @@ -940,10 +940,10 @@ impl BlockLookups { trace!(self.log, "Parent missing parts, triggering single block lookup "; &parent_lookup,"block_root" => ?block_root) } }, - BlockPartProcessingResult::Err(e) => { + BlockProcessingResult::Err(e) => { trace!(self.log, "Parent block processing failed"; &parent_lookup, "error" => %e) } - BlockPartProcessingResult::Ignored => { + BlockProcessingResult::Ignored => { trace!( self.log, "Parent block processing job was ignored"; @@ -954,18 +954,18 @@ impl BlockLookups { } match result { - BlockPartProcessingResult::Ok(AvailabilityProcessingStatus::MissingComponents( + BlockProcessingResult::Ok(AvailabilityProcessingStatus::MissingComponents( _, block_root, )) => { self.search_block(block_root, peer_id, PeerShouldHave::BlockAndBlobs, cx); } - BlockPartProcessingResult::Err(BlockError::ParentUnknown(block)) => { + BlockProcessingResult::Err(BlockError::ParentUnknown(block)) => { parent_lookup.add_block_wrapper(block); self.request_parent_block_and_blobs(parent_lookup, cx); } - BlockPartProcessingResult::Ok(AvailabilityProcessingStatus::Imported(_)) - | BlockPartProcessingResult::Err(BlockError::BlockIsAlreadyKnown { .. }) => { + BlockProcessingResult::Ok(AvailabilityProcessingStatus::Imported(_)) + | BlockProcessingResult::Err(BlockError::BlockIsAlreadyKnown { .. }) => { // Check if the beacon processor is available let beacon_processor_send = match cx.processor_channel_if_enabled() { Some(channel) => channel, @@ -997,7 +997,7 @@ impl BlockLookups { } } } - ref e @ BlockPartProcessingResult::Err(BlockError::ExecutionPayloadError(ref epe)) + ref e @ BlockProcessingResult::Err(BlockError::ExecutionPayloadError(ref epe)) if !epe.penalize_peer() => { // These errors indicate that the execution layer is offline @@ -1009,7 +1009,7 @@ impl BlockLookups { "error" => ?e ); } - BlockPartProcessingResult::Err(outcome) => { + BlockProcessingResult::Err(outcome) => { // all else we consider the chain a failure and downvote the peer that sent // us the last block warn!( @@ -1035,7 +1035,7 @@ impl BlockLookups { } } } - BlockPartProcessingResult::Ignored => { + BlockProcessingResult::Ignored => { // Beacon processor signalled to ignore the block processing result. // This implies that the cpu is overloaded. Drop the request. warn!( diff --git a/beacon_node/network/src/sync/block_lookups/tests.rs b/beacon_node/network/src/sync/block_lookups/tests.rs index 256ed80042..468a2e8c65 100644 --- a/beacon_node/network/src/sync/block_lookups/tests.rs +++ b/beacon_node/network/src/sync/block_lookups/tests.rs @@ -188,7 +188,7 @@ fn test_single_block_lookup_happy_path() { bl.single_block_lookup_response(id, peer_id, None, D, &mut cx); bl.single_block_processed( id, - BlockPartProcessingResult::Ok(AvailabilityProcessingStatus::Imported(block_root)), + BlockProcessingResult::Ok(AvailabilityProcessingStatus::Imported(block_root)), ResponseType::Block, &mut cx, ); @@ -361,7 +361,7 @@ fn test_parent_lookup_wrong_response() { // Processing succeeds, now the rest of the chain should be sent for processing. bl.parent_block_processed( chain_hash, - BlockPartProcessingResult::Ok(AvailabilityProcessingStatus::Imported(block_root)), + BlockProcessingResult::Ok(AvailabilityProcessingStatus::Imported(block_root)), ResponseType::Block, &mut cx, ); @@ -401,7 +401,7 @@ fn test_parent_lookup_empty_response() { // Processing succeeds, now the rest of the chain should be sent for processing. bl.parent_block_processed( chain_hash, - BlockPartProcessingResult::Ok(AvailabilityProcessingStatus::Imported(block_root)), + BlockProcessingResult::Ok(AvailabilityProcessingStatus::Imported(block_root)), ResponseType::Block, &mut cx, ); @@ -448,7 +448,7 @@ fn test_parent_lookup_rpc_failure() { // Processing succeeds, now the rest of the chain should be sent for processing. bl.parent_block_processed( chain_hash, - BlockPartProcessingResult::Ok(AvailabilityProcessingStatus::Imported(block_root)), + BlockProcessingResult::Ok(AvailabilityProcessingStatus::Imported(block_root)), ResponseType::Block, &mut cx, ); @@ -700,7 +700,7 @@ fn test_single_block_lookup_ignored_response() { // Send an Ignored response, the request should be dropped bl.single_block_processed( id, - BlockPartProcessingResult::Ignored, + BlockProcessingResult::Ignored, ResponseType::Block, &mut cx, ); @@ -732,7 +732,7 @@ fn test_parent_lookup_ignored_response() { // Return an Ignored result. The request should be dropped bl.parent_block_processed( chain_hash, - BlockPartProcessingResult::Ignored, + BlockProcessingResult::Ignored, ResponseType::Block, &mut cx, ); diff --git a/beacon_node/network/src/sync/manager.rs b/beacon_node/network/src/sync/manager.rs index 6334f0c269..e645ba9f96 100644 --- a/beacon_node/network/src/sync/manager.rs +++ b/beacon_node/network/src/sync/manager.rs @@ -154,7 +154,7 @@ pub enum SyncMessage { /// Block processed BlockPartProcessed { process_type: BlockProcessType, - result: BlockPartProcessingResult, + result: BlockProcessingResult, response_type: ResponseType, }, } @@ -167,7 +167,7 @@ pub enum BlockProcessType { } #[derive(Debug)] -pub enum BlockPartProcessingResult { +pub enum BlockProcessingResult { Ok(AvailabilityProcessingStatus), Err(BlockError), Ignored, @@ -1097,18 +1097,18 @@ impl SyncManager { } impl From>> - for BlockPartProcessingResult + for BlockProcessingResult { fn from(result: Result>) -> Self { match result { - Ok(status) => BlockPartProcessingResult::Ok(status), - Err(e) => BlockPartProcessingResult::Err(e), + Ok(status) => BlockProcessingResult::Ok(status), + Err(e) => BlockProcessingResult::Err(e), } } } -impl From> for BlockPartProcessingResult { +impl From> for BlockProcessingResult { fn from(e: BlockError) -> Self { - BlockPartProcessingResult::Err(e) + BlockProcessingResult::Err(e) } }