From 4c8143ff8ba144ae60578ac502c65b4440b545ff Mon Sep 17 00:00:00 2001 From: dapplion <35266934+dapplion@users.noreply.github.com> Date: Tue, 23 Apr 2024 01:28:53 +0900 Subject: [PATCH] Drop reconstructed for processing --- .../network/src/sync/block_lookups/common.rs | 37 +++---------------- .../network/src/sync/block_lookups/mod.rs | 9 +---- 2 files changed, 7 insertions(+), 39 deletions(-) diff --git a/beacon_node/network/src/sync/block_lookups/common.rs b/beacon_node/network/src/sync/block_lookups/common.rs index 7193dd6e216..43fb0229a70 100644 --- a/beacon_node/network/src/sync/block_lookups/common.rs +++ b/beacon_node/network/src/sync/block_lookups/common.rs @@ -53,9 +53,6 @@ pub trait RequestState { /// The type created after validation. type VerifiedResponseType: Clone; - /// We convert a `VerifiedResponseType` to this type prior to sending it to the beacon processor. - type ReconstructedResponseType; - /* Request building methods */ /// Construct a new request. @@ -141,18 +138,12 @@ pub trait RequestState { components: &mut ChildComponents, ); - /// Convert a verified response to the type we send to the beacon processor. - fn verified_to_reconstructed( - block_root: Hash256, - verified: Self::VerifiedResponseType, - ) -> Self::ReconstructedResponseType; - /// Send the response to the beacon processor. - fn send_reconstructed_for_processing( + fn send_for_processing( id: Id, bl: &BlockLookups, block_root: Hash256, - verified: Self::ReconstructedResponseType, + verified: Self::VerifiedResponseType, duration: Duration, cx: &SyncNetworkContext, ) -> Result<(), LookupRequestError>; @@ -180,7 +171,6 @@ pub trait RequestState { impl RequestState for BlockRequestState { type RequestType = BlocksByRootSingleRequest; type VerifiedResponseType = Arc>; - type ReconstructedResponseType = RpcBlock; fn new_request(&self) -> Self::RequestType { BlocksByRootSingleRequest(self.requested_block_root) @@ -207,24 +197,17 @@ impl RequestState for BlockRequestState { components.merge_block(verified_response); } - fn verified_to_reconstructed( - block_root: Hash256, - block: Arc>, - ) -> RpcBlock { - RpcBlock::new_without_blobs(Some(block_root), block) - } - - fn send_reconstructed_for_processing( + fn send_for_processing( id: Id, bl: &BlockLookups, block_root: Hash256, - constructed: RpcBlock, + block: Arc>, duration: Duration, cx: &SyncNetworkContext, ) -> Result<(), LookupRequestError> { bl.send_block_for_processing( block_root, - constructed, + RpcBlock::new_without_blobs(Some(block_root), block), duration, BlockProcessType::SingleBlock { id }, cx, @@ -248,7 +231,6 @@ impl RequestState for BlockRequestState { impl RequestState for BlobRequestState { type RequestType = BlobsByRootSingleBlockRequest; type VerifiedResponseType = FixedBlobSidecarList; - type ReconstructedResponseType = FixedBlobSidecarList; fn new_request(&self) -> Self::RequestType { BlobsByRootSingleBlockRequest { @@ -282,14 +264,7 @@ impl RequestState for BlobRequestState { components.merge_blobs(verified_response); } - fn verified_to_reconstructed( - _block_root: Hash256, - blobs: FixedBlobSidecarList, - ) -> FixedBlobSidecarList { - blobs - } - - fn send_reconstructed_for_processing( + fn send_for_processing( id: Id, bl: &BlockLookups, block_root: Hash256, diff --git a/beacon_node/network/src/sync/block_lookups/mod.rs b/beacon_node/network/src/sync/block_lookups/mod.rs index a2909b49dd1..5e369d376da 100644 --- a/beacon_node/network/src/sync/block_lookups/mod.rs +++ b/beacon_node/network/src/sync/block_lookups/mod.rs @@ -427,14 +427,7 @@ impl BlockLookups { .on_download_success() .map_err(LookupRequestError::BadState)?; - R::send_reconstructed_for_processing( - id, - self, - block_root, - R::verified_to_reconstructed(block_root, verified_response), - seen_timestamp, - cx, - )? + R::send_for_processing(id, self, block_root, verified_response, seen_timestamp, cx)? } CachedChild::Err(e) => { warn!(self.log, "Consistency error in cached block";