Fix BlobsByRange by reverting PR6462 (#6526)

* Revert "Remove generic E from RequestId (#6462)"

This reverts commit 772929fae2.
This commit is contained in:
Michael Sproul
2024-10-21 23:42:51 +11:00
committed by GitHub
parent 56a9befaa1
commit 9aefb5539b
15 changed files with 68 additions and 69 deletions

View File

@@ -893,7 +893,7 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
);
// Should not send more than max request blocks
if req.max_blobs_requested() > self.chain.spec.max_request_blob_sidecars {
if req.max_blobs_requested::<T::EthSpec>() > self.chain.spec.max_request_blob_sidecars {
return Err((
RpcErrorResponse::InvalidRequest,
"Request exceeded `MAX_REQUEST_BLOBS_SIDECARS`",
@@ -1098,7 +1098,7 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
);
// Should not send more than max request data columns
if req.max_requested() > self.chain.spec.max_request_data_column_sidecars {
if req.max_requested::<T::EthSpec>() > self.chain.spec.max_request_data_column_sidecars {
return Err((
RpcErrorResponse::InvalidRequest,
"Request exceeded `MAX_REQUEST_BLOBS_SIDECARS`",

View File

@@ -30,9 +30,9 @@ use std::time::Duration;
use tokio::sync::mpsc;
use types::blob_sidecar::FixedBlobSidecarList;
use types::{
Attestation, AttesterSlashing, BlobSidecar, BlobSidecarList, Epoch, EthSpec, Hash256,
MainnetEthSpec, ProposerSlashing, SignedAggregateAndProof, SignedBeaconBlock,
SignedVoluntaryExit, Slot, SubnetId,
Attestation, AttesterSlashing, BlobSidecar, BlobSidecarList, Epoch, Hash256, MainnetEthSpec,
ProposerSlashing, SignedAggregateAndProof, SignedBeaconBlock, SignedVoluntaryExit, Slot,
SubnetId,
};
type E = MainnetEthSpec;
@@ -366,7 +366,6 @@ impl TestRig {
BlobsByRangeRequest {
start_slot: 0,
count,
max_blobs_per_block: E::max_blobs_per_block(),
},
)
.unwrap();

View File

@@ -58,7 +58,7 @@ pub enum RouterMessage<E: EthSpec> {
RPCRequestReceived {
peer_id: PeerId,
id: PeerRequestId,
request: rpc::Request,
request: rpc::Request<E>,
},
/// An RPC response has been received.
RPCResponseReceived {
@@ -193,11 +193,11 @@ impl<T: BeaconChainTypes> Router<T> {
/* RPC - Related functionality */
/// A new RPC request has been received from the network.
fn handle_rpc_request(
fn handle_rpc_request<E: EthSpec>(
&mut self,
peer_id: PeerId,
request_id: PeerRequestId,
rpc_request: rpc::Request,
rpc_request: rpc::Request<E>,
) {
if !self.network_globals.peers.read().is_connected(&peer_id) {
debug!(self.log, "Dropping request of disconnected peer"; "peer_id" => %peer_id, "request" => ?rpc_request);
@@ -836,7 +836,7 @@ impl<E: EthSpec> HandlerNetworkContext<E> {
}
/// Sends a request to the network task.
pub fn send_processor_request(&mut self, peer_id: PeerId, request: RequestType) {
pub fn send_processor_request(&mut self, peer_id: PeerId, request: RequestType<E>) {
self.inform_network(NetworkMessage::SendRequest {
peer_id,
request_id: AppRequestId::Router,

View File

@@ -62,7 +62,7 @@ pub enum NetworkMessage<E: EthSpec> {
/// Send an RPC request to the libp2p service.
SendRequest {
peer_id: PeerId,
request: RequestType,
request: RequestType<E>,
request_id: AppRequestId,
},
/// Send a successful Response to the libp2p service.

View File

@@ -401,7 +401,6 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
request: RequestType::BlobsByRange(BlobsByRangeRequest {
start_slot: *request.start_slot(),
count: *request.count(),
max_blobs_per_block: T::EthSpec::max_blobs_per_block(),
}),
request_id: AppRequestId::Sync(SyncRequestId::RangeBlockAndBlobs { id }),
})