renamings

This commit is contained in:
realbigsean
2023-04-26 14:45:07 -04:00
parent 4390036887
commit 69e5e00350
6 changed files with 36 additions and 36 deletions

View File

@@ -2919,7 +2919,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
Availability::Available(block) => { Availability::Available(block) => {
self.import_available_block(block, count_unrealized).await self.import_available_block(block, count_unrealized).await
} }
Availability::MissingParts(block_root) => Ok( Availability::MissingComponents(block_root) => Ok(
AvailabilityProcessingStatus::MissingComponents(slot, block_root), AvailabilityProcessingStatus::MissingComponents(slot, block_root),
), ),
} }

View File

@@ -120,7 +120,7 @@ impl<T: EthSpec> ReceivedComponents<T> {
/// Indicates if the block is fully `Available` or if we need blobs or blocks /// Indicates if the block is fully `Available` or if we need blobs or blocks
/// to "complete" the requirements for an `AvailableBlock`. /// to "complete" the requirements for an `AvailableBlock`.
pub enum Availability<T: EthSpec> { pub enum Availability<T: EthSpec> {
MissingParts(Hash256), MissingComponents(Hash256),
Available(Box<AvailableExecutedBlock<T>>), Available(Box<AvailableExecutedBlock<T>>),
} }
@@ -295,12 +295,12 @@ impl<T: EthSpec, S: SlotClock> DataAvailabilityChecker<T, S> {
if let Some(executed_block) = received_components.executed_block.take() { if let Some(executed_block) = received_components.executed_block.take() {
self.check_block_availability_maybe_cache(occupied_entry, executed_block)? self.check_block_availability_maybe_cache(occupied_entry, executed_block)?
} else { } else {
Availability::MissingParts(block_root) Availability::MissingComponents(block_root)
} }
} }
Entry::Vacant(vacant_entry) => { Entry::Vacant(vacant_entry) => {
vacant_entry.insert(ReceivedComponents::new_from_blobs(kzg_verified_blobs)); vacant_entry.insert(ReceivedComponents::new_from_blobs(kzg_verified_blobs));
Availability::MissingParts(block_root) Availability::MissingComponents(block_root)
} }
}; };
@@ -324,7 +324,7 @@ impl<T: EthSpec, S: SlotClock> DataAvailabilityChecker<T, S> {
Entry::Vacant(vacant_entry) => { Entry::Vacant(vacant_entry) => {
let block_root = executed_block.import_data.block_root; let block_root = executed_block.import_data.block_root;
vacant_entry.insert(ReceivedComponents::new_from_block(executed_block)); vacant_entry.insert(ReceivedComponents::new_from_block(executed_block));
Availability::MissingParts(block_root) Availability::MissingComponents(block_root)
} }
}; };
@@ -377,7 +377,7 @@ impl<T: EthSpec, S: SlotClock> DataAvailabilityChecker<T, S> {
let _ = received_components.executed_block.insert(executed_block); let _ = received_components.executed_block.insert(executed_block);
Ok(Availability::MissingParts(block_root)) Ok(Availability::MissingComponents(block_root))
} }
} }

View File

@@ -60,7 +60,7 @@ impl<T: BeaconChainTypes> Worker<T> {
// Sync handles these results // Sync handles these results
self.send_sync_message(SyncMessage::BlockPartProcessed { self.send_sync_message(SyncMessage::BlockPartProcessed {
process_type, process_type,
result: crate::sync::manager::BlockPartProcessingResult::Ignored, result: crate::sync::manager::BlockProcessingResult::Ignored,
response_type: crate::sync::manager::ResponseType::Block, response_type: crate::sync::manager::ResponseType::Block,
}); });
return; return;

View File

@@ -17,7 +17,7 @@ use types::{BlobSidecar, SignedBeaconBlock, Slot};
use self::parent_lookup::{LookupDownloadStatus, PARENT_FAIL_TOLERANCE}; use self::parent_lookup::{LookupDownloadStatus, PARENT_FAIL_TOLERANCE};
use self::parent_lookup::{ParentLookup, ParentVerifyError}; use self::parent_lookup::{ParentLookup, ParentVerifyError};
use self::single_block_lookup::SingleBlockLookup; use self::single_block_lookup::SingleBlockLookup;
use super::manager::BlockPartProcessingResult; use super::manager::BlockProcessingResult;
use super::BatchProcessResult; use super::BatchProcessResult;
use super::{ use super::{
manager::{BlockProcessType, Id}, manager::{BlockProcessType, Id},
@@ -794,7 +794,7 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
pub fn single_block_processed( pub fn single_block_processed(
&mut self, &mut self,
id: Id, id: Id,
result: BlockPartProcessingResult<T::EthSpec>, result: BlockProcessingResult<T::EthSpec>,
response_type: ResponseType, response_type: ResponseType,
cx: &mut SyncNetworkContext<T>, cx: &mut SyncNetworkContext<T>,
) { ) {
@@ -825,7 +825,7 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
}; };
let should_remove_lookup = match result { let should_remove_lookup = match result {
BlockPartProcessingResult::Ok(status) => match status { BlockProcessingResult::Ok(status) => match status {
AvailabilityProcessingStatus::Imported(root) => { AvailabilityProcessingStatus::Imported(root) => {
trace!(self.log, "Single block processing succeeded"; "block" => %root); trace!(self.log, "Single block processing succeeded"; "block" => %root);
ShouldRemoveLookup::True ShouldRemoveLookup::True
@@ -836,7 +836,7 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
ShouldRemoveLookup::False ShouldRemoveLookup::False
} }
}, },
BlockPartProcessingResult::Ignored => { BlockProcessingResult::Ignored => {
// Beacon processor signalled to ignore the block processing result. // Beacon processor signalled to ignore the block processing result.
// This implies that the cpu is overloaded. Drop the request. // This implies that the cpu is overloaded. Drop the request.
warn!( warn!(
@@ -846,7 +846,7 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
); );
ShouldRemoveLookup::True ShouldRemoveLookup::True
} }
BlockPartProcessingResult::Err(e) => { BlockProcessingResult::Err(e) => {
trace!(self.log, "Single block processing failed"; "block" => %root, "error" => %e); trace!(self.log, "Single block processing failed"; "block" => %root, "error" => %e);
match e { match e {
BlockError::BlockIsAlreadyKnown => { BlockError::BlockIsAlreadyKnown => {
@@ -907,7 +907,7 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
pub fn parent_block_processed( pub fn parent_block_processed(
&mut self, &mut self,
chain_hash: Hash256, chain_hash: Hash256,
result: BlockPartProcessingResult<T::EthSpec>, result: BlockProcessingResult<T::EthSpec>,
response_type: ResponseType, response_type: ResponseType,
cx: &mut SyncNetworkContext<T>, cx: &mut SyncNetworkContext<T>,
) { ) {
@@ -932,7 +932,7 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
}; };
match &result { match &result {
BlockPartProcessingResult::Ok(status) => match status { BlockProcessingResult::Ok(status) => match status {
AvailabilityProcessingStatus::Imported(block_root) => { AvailabilityProcessingStatus::Imported(block_root) => {
trace!(self.log, "Parent block processing succeeded"; &parent_lookup, "block_root" => ?block_root) trace!(self.log, "Parent block processing succeeded"; &parent_lookup, "block_root" => ?block_root)
} }
@@ -940,10 +940,10 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
trace!(self.log, "Parent missing parts, triggering single block lookup "; &parent_lookup,"block_root" => ?block_root) 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) trace!(self.log, "Parent block processing failed"; &parent_lookup, "error" => %e)
} }
BlockPartProcessingResult::Ignored => { BlockProcessingResult::Ignored => {
trace!( trace!(
self.log, self.log,
"Parent block processing job was ignored"; "Parent block processing job was ignored";
@@ -954,18 +954,18 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
} }
match result { match result {
BlockPartProcessingResult::Ok(AvailabilityProcessingStatus::MissingComponents( BlockProcessingResult::Ok(AvailabilityProcessingStatus::MissingComponents(
_, _,
block_root, block_root,
)) => { )) => {
self.search_block(block_root, peer_id, PeerShouldHave::BlockAndBlobs, cx); 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); parent_lookup.add_block_wrapper(block);
self.request_parent_block_and_blobs(parent_lookup, cx); self.request_parent_block_and_blobs(parent_lookup, cx);
} }
BlockPartProcessingResult::Ok(AvailabilityProcessingStatus::Imported(_)) BlockProcessingResult::Ok(AvailabilityProcessingStatus::Imported(_))
| BlockPartProcessingResult::Err(BlockError::BlockIsAlreadyKnown { .. }) => { | BlockProcessingResult::Err(BlockError::BlockIsAlreadyKnown { .. }) => {
// Check if the beacon processor is available // Check if the beacon processor is available
let beacon_processor_send = match cx.processor_channel_if_enabled() { let beacon_processor_send = match cx.processor_channel_if_enabled() {
Some(channel) => channel, Some(channel) => channel,
@@ -997,7 +997,7 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
} }
} }
} }
ref e @ BlockPartProcessingResult::Err(BlockError::ExecutionPayloadError(ref epe)) ref e @ BlockProcessingResult::Err(BlockError::ExecutionPayloadError(ref epe))
if !epe.penalize_peer() => if !epe.penalize_peer() =>
{ {
// These errors indicate that the execution layer is offline // These errors indicate that the execution layer is offline
@@ -1009,7 +1009,7 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
"error" => ?e "error" => ?e
); );
} }
BlockPartProcessingResult::Err(outcome) => { BlockProcessingResult::Err(outcome) => {
// all else we consider the chain a failure and downvote the peer that sent // all else we consider the chain a failure and downvote the peer that sent
// us the last block // us the last block
warn!( warn!(
@@ -1035,7 +1035,7 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
} }
} }
} }
BlockPartProcessingResult::Ignored => { BlockProcessingResult::Ignored => {
// Beacon processor signalled to ignore the block processing result. // Beacon processor signalled to ignore the block processing result.
// This implies that the cpu is overloaded. Drop the request. // This implies that the cpu is overloaded. Drop the request.
warn!( warn!(

View File

@@ -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_lookup_response(id, peer_id, None, D, &mut cx);
bl.single_block_processed( bl.single_block_processed(
id, id,
BlockPartProcessingResult::Ok(AvailabilityProcessingStatus::Imported(block_root)), BlockProcessingResult::Ok(AvailabilityProcessingStatus::Imported(block_root)),
ResponseType::Block, ResponseType::Block,
&mut cx, &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. // Processing succeeds, now the rest of the chain should be sent for processing.
bl.parent_block_processed( bl.parent_block_processed(
chain_hash, chain_hash,
BlockPartProcessingResult::Ok(AvailabilityProcessingStatus::Imported(block_root)), BlockProcessingResult::Ok(AvailabilityProcessingStatus::Imported(block_root)),
ResponseType::Block, ResponseType::Block,
&mut cx, &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. // Processing succeeds, now the rest of the chain should be sent for processing.
bl.parent_block_processed( bl.parent_block_processed(
chain_hash, chain_hash,
BlockPartProcessingResult::Ok(AvailabilityProcessingStatus::Imported(block_root)), BlockProcessingResult::Ok(AvailabilityProcessingStatus::Imported(block_root)),
ResponseType::Block, ResponseType::Block,
&mut cx, &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. // Processing succeeds, now the rest of the chain should be sent for processing.
bl.parent_block_processed( bl.parent_block_processed(
chain_hash, chain_hash,
BlockPartProcessingResult::Ok(AvailabilityProcessingStatus::Imported(block_root)), BlockProcessingResult::Ok(AvailabilityProcessingStatus::Imported(block_root)),
ResponseType::Block, ResponseType::Block,
&mut cx, &mut cx,
); );
@@ -700,7 +700,7 @@ fn test_single_block_lookup_ignored_response() {
// Send an Ignored response, the request should be dropped // Send an Ignored response, the request should be dropped
bl.single_block_processed( bl.single_block_processed(
id, id,
BlockPartProcessingResult::Ignored, BlockProcessingResult::Ignored,
ResponseType::Block, ResponseType::Block,
&mut cx, &mut cx,
); );
@@ -732,7 +732,7 @@ fn test_parent_lookup_ignored_response() {
// Return an Ignored result. The request should be dropped // Return an Ignored result. The request should be dropped
bl.parent_block_processed( bl.parent_block_processed(
chain_hash, chain_hash,
BlockPartProcessingResult::Ignored, BlockProcessingResult::Ignored,
ResponseType::Block, ResponseType::Block,
&mut cx, &mut cx,
); );

View File

@@ -154,7 +154,7 @@ pub enum SyncMessage<T: EthSpec> {
/// Block processed /// Block processed
BlockPartProcessed { BlockPartProcessed {
process_type: BlockProcessType, process_type: BlockProcessType,
result: BlockPartProcessingResult<T>, result: BlockProcessingResult<T>,
response_type: ResponseType, response_type: ResponseType,
}, },
} }
@@ -167,7 +167,7 @@ pub enum BlockProcessType {
} }
#[derive(Debug)] #[derive(Debug)]
pub enum BlockPartProcessingResult<T: EthSpec> { pub enum BlockProcessingResult<T: EthSpec> {
Ok(AvailabilityProcessingStatus), Ok(AvailabilityProcessingStatus),
Err(BlockError<T>), Err(BlockError<T>),
Ignored, Ignored,
@@ -1097,18 +1097,18 @@ impl<T: BeaconChainTypes> SyncManager<T> {
} }
impl<T: EthSpec> From<Result<AvailabilityProcessingStatus, BlockError<T>>> impl<T: EthSpec> From<Result<AvailabilityProcessingStatus, BlockError<T>>>
for BlockPartProcessingResult<T> for BlockProcessingResult<T>
{ {
fn from(result: Result<AvailabilityProcessingStatus, BlockError<T>>) -> Self { fn from(result: Result<AvailabilityProcessingStatus, BlockError<T>>) -> Self {
match result { match result {
Ok(status) => BlockPartProcessingResult::Ok(status), Ok(status) => BlockProcessingResult::Ok(status),
Err(e) => BlockPartProcessingResult::Err(e), Err(e) => BlockProcessingResult::Err(e),
} }
} }
} }
impl<T: EthSpec> From<BlockError<T>> for BlockPartProcessingResult<T> { impl<T: EthSpec> From<BlockError<T>> for BlockProcessingResult<T> {
fn from(e: BlockError<T>) -> Self { fn from(e: BlockError<T>) -> Self {
BlockPartProcessingResult::Err(e) BlockProcessingResult::Err(e)
} }
} }