Track request IDs in RangeBlockComponentsRequest (#6998)

Part of
- https://github.com/sigp/lighthouse/issues/6258


  `RangeBlockComponentsRequest` handles a set of by_range requests. It's quite lose on these requests, not tracking them by ID. We want to implement individual request retries, so we must make `RangeBlockComponentsRequest` aware of its requests IDs. We don't want the result of a prior by_range request to affect the state of a future retry. Lookup sync uses this mechanism.

Now `RangeBlockComponentsRequest` tracks:

```rust
pub struct RangeBlockComponentsRequest<E: EthSpec> {
blocks_request: ByRangeRequest<BlocksByRangeRequestId, Vec<Arc<SignedBeaconBlock<E>>>>,
block_data_request: RangeBlockDataRequest<E>,
}

enum RangeBlockDataRequest<E: EthSpec> {
NoData,
Blobs(ByRangeRequest<BlobsByRangeRequestId, Vec<Arc<BlobSidecar<E>>>>),
DataColumns {
requests: HashMap<
DataColumnsByRangeRequestId,
ByRangeRequest<DataColumnsByRangeRequestId, DataColumnSidecarList<E>>,
>,
expected_custody_columns: Vec<ColumnIndex>,
},
}

enum ByRangeRequest<I: PartialEq + std::fmt::Display, T> {
Active(I),
Complete(T),
}
```

I have merged `is_finished` and `Into_responses` into the same function. Otherwise, we need to duplicate the logic to figure out if the requests are done.
This commit is contained in:
Lion - dapplion
2025-03-21 01:07:30 -03:00
committed by GitHub
parent a1b1d7ae58
commit ca237652f1
3 changed files with 320 additions and 167 deletions

View File

@@ -1167,7 +1167,7 @@ impl<T: BeaconChainTypes> SyncManager<T> {
self.on_range_components_response(
id.parent_request_id,
peer_id,
RangeBlockComponent::Block(resp),
RangeBlockComponent::Block(id, resp),
);
}
}
@@ -1182,7 +1182,7 @@ impl<T: BeaconChainTypes> SyncManager<T> {
self.on_range_components_response(
id.parent_request_id,
peer_id,
RangeBlockComponent::Blob(resp),
RangeBlockComponent::Blob(id, resp),
);
}
}
@@ -1200,7 +1200,7 @@ impl<T: BeaconChainTypes> SyncManager<T> {
self.on_range_components_response(
id.parent_request_id,
peer_id,
RangeBlockComponent::CustodyColumns(resp),
RangeBlockComponent::CustodyColumns(id, resp),
);
}
}