Improve RangeBlockComponent type

This commit is contained in:
dapplion
2025-05-26 19:07:15 -05:00
parent c8a0c9e379
commit 01329ab230
2 changed files with 4 additions and 20 deletions

View File

@@ -1237,21 +1237,9 @@ impl<T: BeaconChainTypes> SyncManager<T> {
id: CustodyByRangeRequestId, id: CustodyByRangeRequestId,
result: CustodyRequestResult<T::EthSpec>, result: CustodyRequestResult<T::EthSpec>,
) { ) {
// 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( self.on_block_components_by_range_response(
id.parent_request_id, id.parent_request_id,
RangeBlockComponent::CustodyColumns( RangeBlockComponent::CustodyColumns(id, result),
id,
result.map(|(data, _peers, timestamp)| (data, timestamp)),
peers,
),
); );
} }

View File

@@ -240,11 +240,7 @@ pub enum RangeBlockComponent<E: EthSpec> {
RpcResponseResult<Vec<Arc<BlobSidecar<E>>>>, RpcResponseResult<Vec<Arc<BlobSidecar<E>>>>,
PeerId, PeerId,
), ),
CustodyColumns( CustodyColumns(CustodyByRangeRequestId, CustodyRequestResult<E>),
CustodyByRangeRequestId,
RpcResponseResult<Vec<Arc<DataColumnSidecar<E>>>>,
PeerGroup,
),
} }
#[cfg(test)] #[cfg(test)]
@@ -1462,8 +1458,8 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
.on_blobs_by_range_result(req_id, blobs, peer_id, self) .on_blobs_by_range_result(req_id, blobs, peer_id, self)
.map_err(Into::<RpcResponseError>::into) .map_err(Into::<RpcResponseError>::into)
}), }),
RangeBlockComponent::CustodyColumns(req_id, resp, peers) => { RangeBlockComponent::CustodyColumns(req_id, resp) => {
resp.and_then(|(custody_columns, _)| { resp.and_then(|(custody_columns, peers, _)| {
request request
.on_custody_by_range_result(req_id, custody_columns, peers, self) .on_custody_by_range_result(req_id, custody_columns, peers, self)
.map_err(Into::<RpcResponseError>::into) .map_err(Into::<RpcResponseError>::into)