From 01329ab2303fee85ef115fd0f745e47e7662ba47 Mon Sep 17 00:00:00 2001 From: dapplion <35266934+dapplion@users.noreply.github.com> Date: Mon, 26 May 2025 19:07:15 -0500 Subject: [PATCH] Improve RangeBlockComponent type --- beacon_node/network/src/sync/manager.rs | 14 +------------- beacon_node/network/src/sync/network_context.rs | 10 +++------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/beacon_node/network/src/sync/manager.rs b/beacon_node/network/src/sync/manager.rs index b5e936d7e8..5c72ac6d12 100644 --- a/beacon_node/network/src/sync/manager.rs +++ b/beacon_node/network/src/sync/manager.rs @@ -1237,21 +1237,9 @@ impl SyncManager { id: CustodyByRangeRequestId, result: CustodyRequestResult, ) { - // TODO(das): Improve the type of RangeBlockComponent::CustodyColumns, not - // not have to pass a PeerGroup in case of error - let peers = match &result { - Ok((_, peers, _)) => peers.clone(), - // TODO(das): this PeerGroup with no peers incorrect - Err(_) => PeerGroup::from_set(<_>::default()), - }; - self.on_block_components_by_range_response( id.parent_request_id, - RangeBlockComponent::CustodyColumns( - id, - result.map(|(data, _peers, timestamp)| (data, timestamp)), - peers, - ), + RangeBlockComponent::CustodyColumns(id, result), ); } diff --git a/beacon_node/network/src/sync/network_context.rs b/beacon_node/network/src/sync/network_context.rs index ce2f91a391..3197fcf13e 100644 --- a/beacon_node/network/src/sync/network_context.rs +++ b/beacon_node/network/src/sync/network_context.rs @@ -240,11 +240,7 @@ pub enum RangeBlockComponent { RpcResponseResult>>>, PeerId, ), - CustodyColumns( - CustodyByRangeRequestId, - RpcResponseResult>>>, - PeerGroup, - ), + CustodyColumns(CustodyByRangeRequestId, CustodyRequestResult), } #[cfg(test)] @@ -1462,8 +1458,8 @@ impl SyncNetworkContext { .on_blobs_by_range_result(req_id, blobs, peer_id, self) .map_err(Into::::into) }), - RangeBlockComponent::CustodyColumns(req_id, resp, peers) => { - resp.and_then(|(custody_columns, _)| { + RangeBlockComponent::CustodyColumns(req_id, resp) => { + resp.and_then(|(custody_columns, peers, _)| { request .on_custody_by_range_result(req_id, custody_columns, peers, self) .map_err(Into::::into)