Remove generic E from RequestId (#6462)

* remove Ethspec from types where it's possible to do so

* remove generic E from RequestType
This commit is contained in:
João Oliveira
2024-10-17 00:05:59 +01:00
committed by GitHub
parent 83d5c521d7
commit 772929fae2
15 changed files with 69 additions and 68 deletions

View File

@@ -20,6 +20,7 @@ use slog::{crit, debug, trace};
use smallvec::SmallVec;
use std::{
collections::{hash_map::Entry, VecDeque},
marker::PhantomData,
pin::Pin,
sync::Arc,
task::{Context, Poll},
@@ -96,7 +97,7 @@ where
events_out: SmallVec<[HandlerEvent<Id, E>; 4]>,
/// Queue of outbound substreams to open.
dial_queue: SmallVec<[(Id, RequestType<E>); 4]>,
dial_queue: SmallVec<[(Id, RequestType); 4]>,
/// Current number of concurrent outbound substreams being opened.
dial_negotiated: u32,
@@ -206,7 +207,7 @@ pub enum OutboundSubstreamState<E: EthSpec> {
/// The framed negotiated substream.
substream: Box<OutboundFramed<Stream, E>>,
/// Keeps track of the actual request sent.
request: RequestType<E>,
request: RequestType,
},
/// Closing an outbound substream>
Closing(Box<OutboundFramed<Stream, E>>),
@@ -274,7 +275,7 @@ where
}
/// Opens an outbound substream with a request.
fn send_request(&mut self, id: Id, req: RequestType<E>) {
fn send_request(&mut self, id: Id, req: RequestType) {
match self.state {
HandlerState::Active => {
self.dial_queue.push((id, req));
@@ -330,7 +331,7 @@ where
type ToBehaviour = HandlerEvent<Id, E>;
type InboundProtocol = RPCProtocol<E>;
type OutboundProtocol = OutboundRequestContainer<E>;
type OutboundOpenInfo = (Id, RequestType<E>); // Keep track of the id and the request
type OutboundOpenInfo = (Id, RequestType); // Keep track of the id and the request
type InboundOpenInfo = ();
fn listen_protocol(&self) -> SubstreamProtocol<Self::InboundProtocol, ()> {
@@ -788,6 +789,7 @@ where
req: req.clone(),
fork_context: self.fork_context.clone(),
max_rpc_size: self.listen_protocol().upgrade().max_rpc_size,
phantom: PhantomData,
},
(),
)
@@ -905,7 +907,7 @@ where
fn on_fully_negotiated_outbound(
&mut self,
substream: OutboundFramed<Stream, E>,
(id, request): (Id, RequestType<E>),
(id, request): (Id, RequestType),
) {
self.dial_negotiated -= 1;
// Reset any io-retries counter.
@@ -961,7 +963,7 @@ where
}
fn on_dial_upgrade_error(
&mut self,
request_info: (Id, RequestType<E>),
request_info: (Id, RequestType),
error: StreamUpgradeError<RPCError>,
) {
let (id, req) = request_info;