From 9c2aceed10a73c5ac31e03046efa5f580410215f Mon Sep 17 00:00:00 2001 From: realbigsean Date: Tue, 25 Apr 2023 09:25:24 -0400 Subject: [PATCH] fix some todos --- .../src/data_availability_checker.rs | 23 ------------------- .../beacon_processor/worker/gossip_methods.rs | 7 +++--- beacon_node/network/src/sync/manager.rs | 8 +++---- 3 files changed, 8 insertions(+), 30 deletions(-) diff --git a/beacon_node/beacon_chain/src/data_availability_checker.rs b/beacon_node/beacon_chain/src/data_availability_checker.rs index 668ac3fe37..5f0eddd60a 100644 --- a/beacon_node/beacon_chain/src/data_availability_checker.rs +++ b/beacon_node/beacon_chain/src/data_availability_checker.rs @@ -23,7 +23,6 @@ use types::{ #[derive(Debug)] pub enum AvailabilityCheckError { - DuplicateBlob(Hash256), Kzg(KzgError), KzgVerificationFailed, KzgNotInitialized, @@ -37,7 +36,6 @@ pub enum AvailabilityCheckError { KzgCommitmentMismatch { blob_index: u64, }, - Pending, IncorrectFork, BlockBlobRootMismatch { block_root: Hash256, @@ -412,27 +410,6 @@ impl DataAvailabilityChecker { } } - /// Checks if a block is available, returning an error if the block is not immediately available. - /// Does not access the gossip cache. - pub fn try_check_availability( - &self, - block: BlockWrapper, - ) -> Result, AvailabilityCheckError> { - match block { - BlockWrapper::Block(block) => { - let blob_requirements = self.get_blob_requirements(&block)?; - let blobs = match blob_requirements { - BlobRequirements::EmptyBlobs => VerifiedBlobs::EmptyBlobs, - BlobRequirements::NotRequired => VerifiedBlobs::NotRequired, - BlobRequirements::PreDeneb => VerifiedBlobs::PreDeneb, - BlobRequirements::Required => return Err(AvailabilityCheckError::MissingBlobs), - }; - Ok(AvailableBlock { block, blobs }) - } - BlockWrapper::BlockAndBlobs(_, _) => Err(AvailabilityCheckError::Pending), - } - } - /// Verifies a block against a set of KZG verified blobs. Returns an AvailableBlock if block's /// commitments are consistent with the provided verified blob commitments. pub fn check_availability_with_blobs( diff --git a/beacon_node/network/src/beacon_processor/worker/gossip_methods.rs b/beacon_node/network/src/beacon_processor/worker/gossip_methods.rs index 9b76b25e59..31b698c5ca 100644 --- a/beacon_node/network/src/beacon_processor/worker/gossip_methods.rs +++ b/beacon_node/network/src/beacon_processor/worker/gossip_methods.rs @@ -989,8 +989,10 @@ impl Worker { ); return None; } - Err(e @ BlockError::BlobValidation(_)) => { - warn!(self.log, "Could not verify blob for gossip. Rejecting the block and blob"; + Err(e @ BlockError::BlobValidation(_)) + | Err(e @ BlockError::MissingBlockParts(_, _)) + | Err(e @ BlockError::AvailabilityCheck(_)) => { + warn!(self.log, "Could not verify block against known blobs in gossip. Rejecting the block"; "error" => %e); self.propagate_validation_result(message_id, peer_id, MessageAcceptance::Reject); self.gossip_penalize_peer( @@ -1000,7 +1002,6 @@ impl Worker { ); return None; } - _ => todo!(), //TODO(sean) }; metrics::inc_counter(&metrics::BEACON_PROCESSOR_GOSSIP_BLOCK_VERIFIED_TOTAL); diff --git a/beacon_node/network/src/sync/manager.rs b/beacon_node/network/src/sync/manager.rs index de9025b9f9..8c37dd284e 100644 --- a/beacon_node/network/src/sync/manager.rs +++ b/beacon_node/network/src/sync/manager.rs @@ -984,11 +984,11 @@ impl SyncManager { seen_timestamp, &mut self.network, ), - RequestId::BackFillBlocks { id } => { - todo!() + RequestId::BackFillBlocks { id: _ } => { + warn!(self.log, "Blob received during backfill block request"; "peer_id" => %peer_id ); } - RequestId::RangeBlocks { id } => { - todo!() + RequestId::RangeBlocks { id: _ } => { + warn!(self.log, "Blob received during range block request"; "peer_id" => %peer_id ); } RequestId::BackFillBlockAndBlobs { id } => { self.backfill_block_and_blobs_response(id, peer_id, blob.into())