Skip to content

Commit

Permalink
sc-network: remove more
Browse files Browse the repository at this point in the history
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
  • Loading branch information
ggwpez committed Sep 18, 2024
1 parent 373beb6 commit 9e14b6c
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 33 deletions.
13 changes: 0 additions & 13 deletions substrate/client/network/src/protocol/notifications/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,6 @@ pub mod tests {

let notif_in = NotificationsInOpen {
handshake: b"hello, world".to_vec(),
negotiated_fallback: None,
substream: NotificationsInSubstream::new(
Framed::new(io, codec),
NotificationsInSubstreamHandshake::NotSent,
Expand All @@ -1142,7 +1141,6 @@ pub mod tests {

let notif_in = NotificationsInOpen {
handshake: b"hello, world".to_vec(),
negotiated_fallback: None,
substream: NotificationsInSubstream::new(
Framed::new(io, codec),
NotificationsInSubstreamHandshake::NotSent,
Expand Down Expand Up @@ -1175,7 +1173,6 @@ pub mod tests {

let notif_in = NotificationsInOpen {
handshake: b"hello, world".to_vec(),
negotiated_fallback: None,
substream: NotificationsInSubstream::new(
Framed::new(io, codec),
NotificationsInSubstreamHandshake::NotSent,
Expand Down Expand Up @@ -1209,7 +1206,6 @@ pub mod tests {

let notif_in = NotificationsInOpen {
handshake: b"hello, world".to_vec(),
negotiated_fallback: None,
substream: NotificationsInSubstream::new(
Framed::new(io, codec),
NotificationsInSubstreamHandshake::NotSent,
Expand Down Expand Up @@ -1249,7 +1245,6 @@ pub mod tests {

let notif_in = NotificationsInOpen {
handshake: b"hello, world".to_vec(),
negotiated_fallback: None,
substream: NotificationsInSubstream::new(
Framed::new(io, codec),
NotificationsInSubstreamHandshake::NotSent,
Expand Down Expand Up @@ -1300,7 +1295,6 @@ pub mod tests {
codec.set_max_len(usize::MAX);
let notif_in = NotificationsInOpen {
handshake: b"hello, world".to_vec(),
negotiated_fallback: None,
substream: NotificationsInSubstream::new(
Framed::new(io, codec),
NotificationsInSubstreamHandshake::NotSent,
Expand Down Expand Up @@ -1339,7 +1333,6 @@ pub mod tests {

let notif_in = NotificationsInOpen {
handshake: b"hello, world".to_vec(),
negotiated_fallback: None,
substream: NotificationsInSubstream::new(
Framed::new(io, codec),
NotificationsInSubstreamHandshake::NotSent,
Expand Down Expand Up @@ -1399,7 +1392,6 @@ pub mod tests {

let notif_in = NotificationsInOpen {
handshake: b"hello, world".to_vec(),
negotiated_fallback: None,
substream: NotificationsInSubstream::new(
Framed::new(io, codec),
NotificationsInSubstreamHandshake::NotSent,
Expand Down Expand Up @@ -1436,7 +1428,6 @@ pub mod tests {

let notif_in = NotificationsInOpen {
handshake: b"hello, world".to_vec(),
negotiated_fallback: None,
substream: NotificationsInSubstream::new(
Framed::new(io, codec),
NotificationsInSubstreamHandshake::NotSent,
Expand Down Expand Up @@ -1482,7 +1473,6 @@ pub mod tests {

let notif_in = NotificationsInOpen {
handshake: b"hello, world".to_vec(),
negotiated_fallback: None,
substream: NotificationsInSubstream::new(
Framed::new(io, codec),
NotificationsInSubstreamHandshake::NotSent,
Expand Down Expand Up @@ -1531,7 +1521,6 @@ pub mod tests {

let notif_in = NotificationsInOpen {
handshake: b"hello, world".to_vec(),
negotiated_fallback: None,
substream: NotificationsInSubstream::new(
Framed::new(io, codec),
NotificationsInSubstreamHandshake::NotSent,
Expand Down Expand Up @@ -1567,7 +1556,6 @@ pub mod tests {

let notif_in = NotificationsInOpen {
handshake: b"hello, world".to_vec(),
negotiated_fallback: None,
substream: NotificationsInSubstream::new(
Framed::new(io, codec),
NotificationsInSubstreamHandshake::NotSent,
Expand Down Expand Up @@ -1642,7 +1630,6 @@ pub mod tests {

let notif_in = NotificationsInOpen {
handshake: b"hello, world".to_vec(),
negotiated_fallback: None,
substream: NotificationsInSubstream::new(
Framed::new(io, codec),
NotificationsInSubstreamHandshake::PendingSend(vec![1, 2, 3, 4]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ where
type Future = Pin<Box<dyn Future<Output = Result<Self::Output, Self::Error>> + Send>>;
type Error = NotificationsHandshakeError;

fn upgrade_inbound(self, mut socket: TSubstream, negotiated_name: Self::Info) -> Self::Future {
fn upgrade_inbound(self, mut socket: TSubstream, _negotiated_name: Self::Info) -> Self::Future {
Box::pin(async move {
let handshake_len = unsigned_varint::aio::read_usize(&mut socket).await?;
if handshake_len > MAX_HANDSHAKE_SIZE {
Expand All @@ -174,15 +174,7 @@ where
handshake: NotificationsInSubstreamHandshake::NotSent,
};

Ok(NotificationsInOpen {
handshake,
negotiated_fallback: if negotiated_name == self.protocol_names[0] {
None
} else {
Some(negotiated_name)
},
substream,
})
Ok(NotificationsInOpen { handshake, substream })
})
}
}
Expand All @@ -191,10 +183,6 @@ where
pub struct NotificationsInOpen<TSubstream> {
/// Handshake sent by the remote.
pub handshake: Vec<u8>,
/// If the negotiated name is not the "main" protocol name but a fallback, contains the
/// name of the negotiated fallback.
#[allow(dead_code)]
pub negotiated_fallback: Option<ProtocolName>,
/// Implementation of `Stream` that allows receives messages from the substream.
pub substream: NotificationsInSubstream<TSubstream>,
}
Expand Down
6 changes: 0 additions & 6 deletions substrate/client/network/src/service/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ pub struct Metrics {
pub distinct_peers_connections_opened_total: Counter<U64>,
pub incoming_connections_errors_total: CounterVec<U64>,
pub incoming_connections_total: Counter<U64>,
#[allow(dead_code)]
pub issued_light_requests: Counter<U64>,
pub kademlia_query_duration: HistogramVec,
pub kademlia_random_queries_total: Counter<U64>,
pub kademlia_records_count: Gauge<U64>,
Expand Down Expand Up @@ -127,10 +125,6 @@ impl Metrics {
"substrate_sub_libp2p_incoming_connections_total",
"Total number of incoming connections on the listening sockets"
)?, registry)?,
issued_light_requests: prometheus::register(Counter::new(
"substrate_issued_light_requests",
"Number of light client requests that our node has issued.",
)?, registry)?,
kademlia_query_duration: prometheus::register(HistogramVec::new(
HistogramOpts {
common_opts: Opts::new(
Expand Down

0 comments on commit 9e14b6c

Please sign in to comment.