From 69807bcbeeae4746eda893701844e91773be4e56 Mon Sep 17 00:00:00 2001 From: Nazar Mokrynskyi Date: Fri, 18 Oct 2024 08:31:14 +0300 Subject: [PATCH] Fix request-response with addresses --- Cargo.lock | 60 ++++++------- crates/subspace-networking/Cargo.toml | 7 +- crates/subspace-networking/src/node_runner.rs | 84 +++---------------- .../request_response_factory.rs | 3 +- .../request_response_factory/tests.rs | 4 + 5 files changed, 51 insertions(+), 107 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c9df164be4..a1f941c1c5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5497,7 +5497,7 @@ dependencies = [ [[package]] name = "libp2p" version = "0.54.1" -source = "git+https://github.com/autonomys/rust-libp2p?rev=458d22ef382641a6f42f7baddff99b70f33cdcc0#458d22ef382641a6f42f7baddff99b70f33cdcc0" +source = "git+https://github.com/autonomys/rust-libp2p?rev=ae7527453146df24aff6afed5f5b9efdffbc15b8#ae7527453146df24aff6afed5f5b9efdffbc15b8" dependencies = [ "bytes", "either", @@ -5526,7 +5526,7 @@ dependencies = [ "libp2p-yamux 0.46.0", "multiaddr 0.18.2", "pin-project", - "rw-stream-sink 0.4.0 (git+https://github.com/autonomys/rust-libp2p?rev=458d22ef382641a6f42f7baddff99b70f33cdcc0)", + "rw-stream-sink 0.4.0 (git+https://github.com/autonomys/rust-libp2p?rev=ae7527453146df24aff6afed5f5b9efdffbc15b8)", "thiserror", ] @@ -5545,7 +5545,7 @@ dependencies = [ [[package]] name = "libp2p-allow-block-list" version = "0.4.0" -source = "git+https://github.com/autonomys/rust-libp2p?rev=458d22ef382641a6f42f7baddff99b70f33cdcc0#458d22ef382641a6f42f7baddff99b70f33cdcc0" +source = "git+https://github.com/autonomys/rust-libp2p?rev=ae7527453146df24aff6afed5f5b9efdffbc15b8#ae7527453146df24aff6afed5f5b9efdffbc15b8" dependencies = [ "libp2p-core 0.42.0", "libp2p-identity", @@ -5556,7 +5556,7 @@ dependencies = [ [[package]] name = "libp2p-autonat" version = "0.13.0" -source = "git+https://github.com/autonomys/rust-libp2p?rev=458d22ef382641a6f42f7baddff99b70f33cdcc0#458d22ef382641a6f42f7baddff99b70f33cdcc0" +source = "git+https://github.com/autonomys/rust-libp2p?rev=ae7527453146df24aff6afed5f5b9efdffbc15b8#ae7527453146df24aff6afed5f5b9efdffbc15b8" dependencies = [ "async-trait", "asynchronous-codec 0.7.0", @@ -5594,7 +5594,7 @@ dependencies = [ [[package]] name = "libp2p-connection-limits" version = "0.4.0" -source = "git+https://github.com/autonomys/rust-libp2p?rev=458d22ef382641a6f42f7baddff99b70f33cdcc0#458d22ef382641a6f42f7baddff99b70f33cdcc0" +source = "git+https://github.com/autonomys/rust-libp2p?rev=ae7527453146df24aff6afed5f5b9efdffbc15b8#ae7527453146df24aff6afed5f5b9efdffbc15b8" dependencies = [ "libp2p-core 0.42.0", "libp2p-identity", @@ -5633,7 +5633,7 @@ dependencies = [ [[package]] name = "libp2p-core" version = "0.42.0" -source = "git+https://github.com/autonomys/rust-libp2p?rev=458d22ef382641a6f42f7baddff99b70f33cdcc0#458d22ef382641a6f42f7baddff99b70f33cdcc0" +source = "git+https://github.com/autonomys/rust-libp2p?rev=ae7527453146df24aff6afed5f5b9efdffbc15b8#ae7527453146df24aff6afed5f5b9efdffbc15b8" dependencies = [ "either", "fnv", @@ -5642,13 +5642,13 @@ dependencies = [ "libp2p-identity", "multiaddr 0.18.2", "multihash 0.19.1", - "multistream-select 0.13.0 (git+https://github.com/autonomys/rust-libp2p?rev=458d22ef382641a6f42f7baddff99b70f33cdcc0)", + "multistream-select 0.13.0 (git+https://github.com/autonomys/rust-libp2p?rev=ae7527453146df24aff6afed5f5b9efdffbc15b8)", "once_cell", "parking_lot 0.12.3", "pin-project", "quick-protobuf", "rand", - "rw-stream-sink 0.4.0 (git+https://github.com/autonomys/rust-libp2p?rev=458d22ef382641a6f42f7baddff99b70f33cdcc0)", + "rw-stream-sink 0.4.0 (git+https://github.com/autonomys/rust-libp2p?rev=ae7527453146df24aff6afed5f5b9efdffbc15b8)", "serde", "smallvec", "thiserror", @@ -5677,7 +5677,7 @@ dependencies = [ [[package]] name = "libp2p-dns" version = "0.42.0" -source = "git+https://github.com/autonomys/rust-libp2p?rev=458d22ef382641a6f42f7baddff99b70f33cdcc0#458d22ef382641a6f42f7baddff99b70f33cdcc0" +source = "git+https://github.com/autonomys/rust-libp2p?rev=ae7527453146df24aff6afed5f5b9efdffbc15b8#ae7527453146df24aff6afed5f5b9efdffbc15b8" dependencies = [ "async-trait", "futures", @@ -5692,7 +5692,7 @@ dependencies = [ [[package]] name = "libp2p-gossipsub" version = "0.47.0" -source = "git+https://github.com/autonomys/rust-libp2p?rev=458d22ef382641a6f42f7baddff99b70f33cdcc0#458d22ef382641a6f42f7baddff99b70f33cdcc0" +source = "git+https://github.com/autonomys/rust-libp2p?rev=ae7527453146df24aff6afed5f5b9efdffbc15b8#ae7527453146df24aff6afed5f5b9efdffbc15b8" dependencies = [ "asynchronous-codec 0.7.0", "base64 0.22.1", @@ -5746,7 +5746,7 @@ dependencies = [ [[package]] name = "libp2p-identify" version = "0.45.0" -source = "git+https://github.com/autonomys/rust-libp2p?rev=458d22ef382641a6f42f7baddff99b70f33cdcc0#458d22ef382641a6f42f7baddff99b70f33cdcc0" +source = "git+https://github.com/autonomys/rust-libp2p?rev=ae7527453146df24aff6afed5f5b9efdffbc15b8#ae7527453146df24aff6afed5f5b9efdffbc15b8" dependencies = [ "asynchronous-codec 0.7.0", "either", @@ -5816,7 +5816,7 @@ dependencies = [ [[package]] name = "libp2p-kad" version = "0.46.1" -source = "git+https://github.com/autonomys/rust-libp2p?rev=458d22ef382641a6f42f7baddff99b70f33cdcc0#458d22ef382641a6f42f7baddff99b70f33cdcc0" +source = "git+https://github.com/autonomys/rust-libp2p?rev=ae7527453146df24aff6afed5f5b9efdffbc15b8#ae7527453146df24aff6afed5f5b9efdffbc15b8" dependencies = [ "arrayvec", "asynchronous-codec 0.7.0", @@ -5866,7 +5866,7 @@ dependencies = [ [[package]] name = "libp2p-mdns" version = "0.46.0" -source = "git+https://github.com/autonomys/rust-libp2p?rev=458d22ef382641a6f42f7baddff99b70f33cdcc0#458d22ef382641a6f42f7baddff99b70f33cdcc0" +source = "git+https://github.com/autonomys/rust-libp2p?rev=ae7527453146df24aff6afed5f5b9efdffbc15b8#ae7527453146df24aff6afed5f5b9efdffbc15b8" dependencies = [ "data-encoding", "futures", @@ -5903,7 +5903,7 @@ dependencies = [ [[package]] name = "libp2p-metrics" version = "0.15.0" -source = "git+https://github.com/autonomys/rust-libp2p?rev=458d22ef382641a6f42f7baddff99b70f33cdcc0#458d22ef382641a6f42f7baddff99b70f33cdcc0" +source = "git+https://github.com/autonomys/rust-libp2p?rev=ae7527453146df24aff6afed5f5b9efdffbc15b8#ae7527453146df24aff6afed5f5b9efdffbc15b8" dependencies = [ "futures", "libp2p-core 0.42.0", @@ -5946,7 +5946,7 @@ dependencies = [ [[package]] name = "libp2p-noise" version = "0.45.0" -source = "git+https://github.com/autonomys/rust-libp2p?rev=458d22ef382641a6f42f7baddff99b70f33cdcc0#458d22ef382641a6f42f7baddff99b70f33cdcc0" +source = "git+https://github.com/autonomys/rust-libp2p?rev=ae7527453146df24aff6afed5f5b9efdffbc15b8#ae7527453146df24aff6afed5f5b9efdffbc15b8" dependencies = [ "asynchronous-codec 0.7.0", "bytes", @@ -5989,7 +5989,7 @@ dependencies = [ [[package]] name = "libp2p-ping" version = "0.45.0" -source = "git+https://github.com/autonomys/rust-libp2p?rev=458d22ef382641a6f42f7baddff99b70f33cdcc0#458d22ef382641a6f42f7baddff99b70f33cdcc0" +source = "git+https://github.com/autonomys/rust-libp2p?rev=ae7527453146df24aff6afed5f5b9efdffbc15b8#ae7527453146df24aff6afed5f5b9efdffbc15b8" dependencies = [ "either", "futures", @@ -6006,7 +6006,7 @@ dependencies = [ [[package]] name = "libp2p-plaintext" version = "0.42.0" -source = "git+https://github.com/autonomys/rust-libp2p?rev=458d22ef382641a6f42f7baddff99b70f33cdcc0#458d22ef382641a6f42f7baddff99b70f33cdcc0" +source = "git+https://github.com/autonomys/rust-libp2p?rev=ae7527453146df24aff6afed5f5b9efdffbc15b8#ae7527453146df24aff6afed5f5b9efdffbc15b8" dependencies = [ "asynchronous-codec 0.7.0", "bytes", @@ -6045,7 +6045,7 @@ dependencies = [ [[package]] name = "libp2p-quic" version = "0.11.1" -source = "git+https://github.com/autonomys/rust-libp2p?rev=458d22ef382641a6f42f7baddff99b70f33cdcc0#458d22ef382641a6f42f7baddff99b70f33cdcc0" +source = "git+https://github.com/autonomys/rust-libp2p?rev=ae7527453146df24aff6afed5f5b9efdffbc15b8#ae7527453146df24aff6afed5f5b9efdffbc15b8" dependencies = [ "bytes", "futures", @@ -6086,7 +6086,7 @@ dependencies = [ [[package]] name = "libp2p-request-response" version = "0.27.0" -source = "git+https://github.com/autonomys/rust-libp2p?rev=458d22ef382641a6f42f7baddff99b70f33cdcc0#458d22ef382641a6f42f7baddff99b70f33cdcc0" +source = "git+https://github.com/autonomys/rust-libp2p?rev=ae7527453146df24aff6afed5f5b9efdffbc15b8#ae7527453146df24aff6afed5f5b9efdffbc15b8" dependencies = [ "async-trait", "futures", @@ -6128,7 +6128,7 @@ dependencies = [ [[package]] name = "libp2p-swarm" version = "0.45.1" -source = "git+https://github.com/autonomys/rust-libp2p?rev=458d22ef382641a6f42f7baddff99b70f33cdcc0#458d22ef382641a6f42f7baddff99b70f33cdcc0" +source = "git+https://github.com/autonomys/rust-libp2p?rev=ae7527453146df24aff6afed5f5b9efdffbc15b8#ae7527453146df24aff6afed5f5b9efdffbc15b8" dependencies = [ "async-std", "either", @@ -6139,7 +6139,7 @@ dependencies = [ "libp2p-identity", "libp2p-swarm-derive 0.35.0", "lru", - "multistream-select 0.13.0 (git+https://github.com/autonomys/rust-libp2p?rev=458d22ef382641a6f42f7baddff99b70f33cdcc0)", + "multistream-select 0.13.0 (git+https://github.com/autonomys/rust-libp2p?rev=ae7527453146df24aff6afed5f5b9efdffbc15b8)", "once_cell", "rand", "smallvec", @@ -6165,7 +6165,7 @@ dependencies = [ [[package]] name = "libp2p-swarm-derive" version = "0.35.0" -source = "git+https://github.com/autonomys/rust-libp2p?rev=458d22ef382641a6f42f7baddff99b70f33cdcc0#458d22ef382641a6f42f7baddff99b70f33cdcc0" +source = "git+https://github.com/autonomys/rust-libp2p?rev=ae7527453146df24aff6afed5f5b9efdffbc15b8#ae7527453146df24aff6afed5f5b9efdffbc15b8" dependencies = [ "heck 0.5.0", "proc-macro2", @@ -6176,7 +6176,7 @@ dependencies = [ [[package]] name = "libp2p-swarm-test" version = "0.4.0" -source = "git+https://github.com/autonomys/rust-libp2p?rev=458d22ef382641a6f42f7baddff99b70f33cdcc0#458d22ef382641a6f42f7baddff99b70f33cdcc0" +source = "git+https://github.com/autonomys/rust-libp2p?rev=ae7527453146df24aff6afed5f5b9efdffbc15b8#ae7527453146df24aff6afed5f5b9efdffbc15b8" dependencies = [ "async-trait", "futures", @@ -6211,7 +6211,7 @@ dependencies = [ [[package]] name = "libp2p-tcp" version = "0.42.0" -source = "git+https://github.com/autonomys/rust-libp2p?rev=458d22ef382641a6f42f7baddff99b70f33cdcc0#458d22ef382641a6f42f7baddff99b70f33cdcc0" +source = "git+https://github.com/autonomys/rust-libp2p?rev=ae7527453146df24aff6afed5f5b9efdffbc15b8#ae7527453146df24aff6afed5f5b9efdffbc15b8" dependencies = [ "async-io 2.3.4", "futures", @@ -6247,7 +6247,7 @@ dependencies = [ [[package]] name = "libp2p-tls" version = "0.5.0" -source = "git+https://github.com/autonomys/rust-libp2p?rev=458d22ef382641a6f42f7baddff99b70f33cdcc0#458d22ef382641a6f42f7baddff99b70f33cdcc0" +source = "git+https://github.com/autonomys/rust-libp2p?rev=ae7527453146df24aff6afed5f5b9efdffbc15b8#ae7527453146df24aff6afed5f5b9efdffbc15b8" dependencies = [ "futures", "futures-rustls 0.26.0", @@ -6281,7 +6281,7 @@ dependencies = [ [[package]] name = "libp2p-upnp" version = "0.3.0" -source = "git+https://github.com/autonomys/rust-libp2p?rev=458d22ef382641a6f42f7baddff99b70f33cdcc0#458d22ef382641a6f42f7baddff99b70f33cdcc0" +source = "git+https://github.com/autonomys/rust-libp2p?rev=ae7527453146df24aff6afed5f5b9efdffbc15b8#ae7527453146df24aff6afed5f5b9efdffbc15b8" dependencies = [ "futures", "futures-timer", @@ -6344,7 +6344,7 @@ dependencies = [ [[package]] name = "libp2p-yamux" version = "0.46.0" -source = "git+https://github.com/autonomys/rust-libp2p?rev=458d22ef382641a6f42f7baddff99b70f33cdcc0#458d22ef382641a6f42f7baddff99b70f33cdcc0" +source = "git+https://github.com/autonomys/rust-libp2p?rev=ae7527453146df24aff6afed5f5b9efdffbc15b8#ae7527453146df24aff6afed5f5b9efdffbc15b8" dependencies = [ "either", "futures", @@ -7048,7 +7048,7 @@ dependencies = [ [[package]] name = "multistream-select" version = "0.13.0" -source = "git+https://github.com/autonomys/rust-libp2p?rev=458d22ef382641a6f42f7baddff99b70f33cdcc0#458d22ef382641a6f42f7baddff99b70f33cdcc0" +source = "git+https://github.com/autonomys/rust-libp2p?rev=ae7527453146df24aff6afed5f5b9efdffbc15b8#ae7527453146df24aff6afed5f5b9efdffbc15b8" dependencies = [ "bytes", "futures", @@ -8873,7 +8873,7 @@ dependencies = [ [[package]] name = "quick-protobuf-codec" version = "0.3.1" -source = "git+https://github.com/autonomys/rust-libp2p?rev=458d22ef382641a6f42f7baddff99b70f33cdcc0#458d22ef382641a6f42f7baddff99b70f33cdcc0" +source = "git+https://github.com/autonomys/rust-libp2p?rev=ae7527453146df24aff6afed5f5b9efdffbc15b8#ae7527453146df24aff6afed5f5b9efdffbc15b8" dependencies = [ "asynchronous-codec 0.7.0", "bytes", @@ -9675,7 +9675,7 @@ dependencies = [ [[package]] name = "rw-stream-sink" version = "0.4.0" -source = "git+https://github.com/autonomys/rust-libp2p?rev=458d22ef382641a6f42f7baddff99b70f33cdcc0#458d22ef382641a6f42f7baddff99b70f33cdcc0" +source = "git+https://github.com/autonomys/rust-libp2p?rev=ae7527453146df24aff6afed5f5b9efdffbc15b8#ae7527453146df24aff6afed5f5b9efdffbc15b8" dependencies = [ "futures", "pin-project", diff --git a/crates/subspace-networking/Cargo.toml b/crates/subspace-networking/Cargo.toml index 7626019bc9..e90e9dac80 100644 --- a/crates/subspace-networking/Cargo.toml +++ b/crates/subspace-networking/Cargo.toml @@ -51,9 +51,10 @@ unsigned-varint = { version = "0.8.0", features = ["futures", "asynchronous_code void = "1.0.2" [dependencies.libp2p] -# TODO: Replace with upstream once https://github.com/libp2p/rust-libp2p/issues/5626 is resolved +# TODO: Replace with upstream once https://github.com/libp2p/rust-libp2p/issues/5626 and +# https://github.com/libp2p/rust-libp2p/issues/5634 are resolved git = "https://github.com/autonomys/rust-libp2p" -rev = "458d22ef382641a6f42f7baddff99b70f33cdcc0" +rev = "ae7527453146df24aff6afed5f5b9efdffbc15b8" version = "0.54.1" default-features = false features = [ @@ -77,4 +78,4 @@ features = [ [dev-dependencies] rand = "0.8.5" # TODO: Replace with upstream once https://github.com/libp2p/rust-libp2p/issues/5626 is resolved -libp2p-swarm-test = { version = "0.4.0", git = "https://github.com/autonomys/rust-libp2p", rev = "458d22ef382641a6f42f7baddff99b70f33cdcc0" } +libp2p-swarm-test = { version = "0.4.0", git = "https://github.com/autonomys/rust-libp2p", rev = "ae7527453146df24aff6afed5f5b9efdffbc15b8" } diff --git a/crates/subspace-networking/src/node_runner.rs b/crates/subspace-networking/src/node_runner.rs index 523be3d923..1ea65d62bc 100644 --- a/crates/subspace-networking/src/node_runner.rs +++ b/crates/subspace-networking/src/node_runner.rs @@ -6,14 +6,14 @@ use crate::constructor; use crate::constructor::temporary_bans::TemporaryBans; use crate::constructor::LocalOnlyRecordStore; use crate::protocols::request_response::request_response_factory::{ - Event as RequestResponseEvent, IfDisconnected, OutboundFailure, RequestFailure, + Event as RequestResponseEvent, IfDisconnected, }; use crate::shared::{Command, CreatedSubscription, PeerDiscovered, Shared}; use crate::utils::{is_global_address_or_dns, strip_peer_id, SubspaceMetrics}; use async_mutex::Mutex as AsyncMutex; use bytes::Bytes; use event_listener_primitives::HandlerId; -use futures::channel::{mpsc, oneshot}; +use futures::channel::mpsc; use futures::future::Fuse; use futures::{FutureExt, StreamExt}; use libp2p::autonat::{Event as AutonatEvent, NatStatus, OutboundProbeEvent}; @@ -28,7 +28,7 @@ use libp2p::kad::{ }; use libp2p::metrics::{Metrics, Recorder}; use libp2p::multiaddr::Protocol; -use libp2p::swarm::dial_opts::{DialOpts, PeerCondition}; +use libp2p::swarm::dial_opts::DialOpts; use libp2p::swarm::{DialError, SwarmEvent}; use libp2p::{Multiaddr, PeerId, Swarm, TransportError}; use nohash_hasher::IntMap; @@ -81,13 +81,6 @@ enum BootstrapCommandState { Finished, } -#[derive(Debug)] -struct PendingGenericRequest { - protocol_name: &'static str, - request: Vec, - result_sender: oneshot::Sender, RequestFailure>>, -} - /// Runner for the Node. #[must_use = "Node does not function properly unless its runner is driven forward"] pub struct NodeRunner @@ -133,7 +126,6 @@ where bootstrap_command_state: Arc>, /// Receives an event on peer address removal from the persistent storage. removed_addresses_rx: mpsc::UnboundedReceiver, - requests_pending_connections: HashMap>, /// Optional storage for the [`HandlerId`] of the address removal task. /// We keep to stop the task along with the rest of the networking. _address_removal_task_handler_id: Option, @@ -228,7 +220,6 @@ where bootstrap_addresses, bootstrap_command_state: Arc::new(AsyncMutex::new(BootstrapCommandState::default())), removed_addresses_rx, - requests_pending_connections: HashMap::new(), _address_removal_task_handler_id: address_removal_task_handler_id, } } @@ -493,18 +484,6 @@ where num_established, .. } => { - if let Some(generic_requests) = self.requests_pending_connections.remove(&peer_id) { - let request_response = &mut self.swarm.behaviour_mut().request_response; - for request in generic_requests { - request_response.send_request( - &peer_id, - request.protocol_name, - request.request, - request.result_sender, - IfDisconnected::ImmediateError, - ); - } - } // Save known addresses that were successfully dialed. if let ConnectedPoint::Dialer { address, .. } = &endpoint { // filter non-global addresses when non-globals addresses are disabled @@ -611,19 +590,6 @@ where }; } SwarmEvent::OutgoingConnectionError { peer_id, error, .. } => { - if let Some(peer_id) = &peer_id { - if let Some(generic_requests) = - self.requests_pending_connections.remove(peer_id) - { - for request in generic_requests { - // Do not care if receiver is gone - let _: Result<(), _> = request - .result_sender - .send(Err(RequestFailure::Network(OutboundFailure::DialFailure))); - } - } - } - if let Some(peer_id) = &peer_id { let should_ban_temporarily = self.should_temporary_ban_on_dial_error(peer_id, &error); @@ -1469,42 +1435,14 @@ where request, result_sender, } => { - // TODO: Ideally it'd be much simpler with https://github.com/libp2p/rust-libp2p/issues/5634 - if !addresses.is_empty() - && !self - .swarm - .connected_peers() - .any(|candidate| candidate == &peer_id) - { - self.requests_pending_connections - .entry(peer_id) - .or_default() - .push(PendingGenericRequest { - protocol_name, - request, - result_sender, - }); - if let Err(error) = self.swarm.dial( - DialOpts::peer_id(peer_id) - .addresses(addresses) - .condition(PeerCondition::DisconnectedAndNotDialing) - .build(), - ) { - warn!( - %error, - %peer_id, - "Failed to dial disconnected peer on generic request" - ); - } - } else { - self.swarm.behaviour_mut().request_response.send_request( - &peer_id, - protocol_name, - request, - result_sender, - IfDisconnected::TryConnect, - ); - } + self.swarm.behaviour_mut().request_response.send_request( + &peer_id, + protocol_name, + request, + result_sender, + IfDisconnected::TryConnect, + addresses, + ); } Command::GetProviders { key, diff --git a/crates/subspace-networking/src/protocols/request_response/request_response_factory.rs b/crates/subspace-networking/src/protocols/request_response/request_response_factory.rs index 5df4d9de1d..9c576158fa 100644 --- a/crates/subspace-networking/src/protocols/request_response/request_response_factory.rs +++ b/crates/subspace-networking/src/protocols/request_response/request_response_factory.rs @@ -379,10 +379,11 @@ impl RequestResponseFactoryBehaviour { request: Vec, pending_response: oneshot::Sender, RequestFailure>>, connect: IfDisconnected, + addresses: Vec, ) { if let Some((protocol, _)) = self.protocols.get_mut(protocol_name) { if protocol.is_connected(target) || connect.should_connect() { - let request_id = protocol.send_request(target, request); + let request_id = protocol.send_request(target, request, addresses); let prev_req_id = self.pending_requests.insert( (protocol_name.to_string().into(), request_id).into(), (Instant::now(), pending_response), diff --git a/crates/subspace-networking/src/protocols/request_response/request_response_factory/tests.rs b/crates/subspace-networking/src/protocols/request_response/request_response_factory/tests.rs index bce255b744..baf21fd231 100644 --- a/crates/subspace-networking/src/protocols/request_response/request_response_factory/tests.rs +++ b/crates/subspace-networking/src/protocols/request_response/request_response_factory/tests.rs @@ -132,6 +132,7 @@ async fn basic_request_response_works() { b"this is a request".to_vec(), sender, IfDisconnected::ImmediateError, + Vec::new(), ); // Wait for request to finish loop { @@ -209,6 +210,7 @@ async fn max_response_size_exceeded() { b"this is a request".to_vec(), sender, IfDisconnected::ImmediateError, + Vec::new(), ); // Wait for request to finish loop { @@ -349,6 +351,7 @@ async fn request_id_collision() { b"this is a request 1".to_vec(), sender_1, IfDisconnected::ImmediateError, + Vec::new(), ); swarm_1.behaviour_mut().send_request( &peer_id_2, @@ -356,6 +359,7 @@ async fn request_id_collision() { b"this is a request 2".to_vec(), sender_2, IfDisconnected::ImmediateError, + Vec::new(), ); // Expect both to finish loop {