From e151ecbbf5d2d8a663f6db4d88230469a0eab58f Mon Sep 17 00:00:00 2001 From: Eitan Seri-Levi Date: Tue, 14 Nov 2023 05:26:48 +0300 Subject: [PATCH 1/8] chore: activate `clippy::manual_let_else` lint Refactor let else usage to align w/ idiomatic usage of Rust by activating `clippy::manual_let_else` lint, and resolving all the warning messages. Resolves: #4741. Pull-Request: #4770. --- Cargo.toml | 1 + core/src/transport.rs | 12 +++---- core/src/transport/memory.rs | 19 ++++------- core/tests/transport_upgrade.rs | 10 +++--- examples/browser-webrtc/src/main.rs | 5 ++- examples/file-sharing/src/main.rs | 5 ++- identity/src/ecdsa.rs | 5 ++- misc/memory-connection-limits/src/lib.rs | 9 ++--- muxers/mplex/src/io.rs | 8 ++--- protocols/autonat/src/behaviour/as_client.rs | 17 +++------- protocols/autonat/src/behaviour/as_server.rs | 8 ++--- protocols/autonat/src/protocol.rs | 28 +++++++--------- protocols/dcutr/src/behaviour.rs | 23 +++++-------- protocols/floodsub/src/layer.rs | 5 ++- protocols/gossipsub/src/behaviour.rs | 30 +++++++---------- protocols/gossipsub/src/peer_score.rs | 6 ++-- protocols/gossipsub/src/protocol.rs | 33 +++++++------------ protocols/kad/src/behaviour.rs | 6 +--- .../kad/src/query/peers/closest/disjoint.rs | 5 ++- protocols/mdns/src/behaviour/iface/query.rs | 27 +++++---------- protocols/relay/src/priv_client/transport.rs | 11 +++---- protocols/relay/src/protocol/inbound_hop.rs | 5 +-- protocols/rendezvous/src/codec.rs | 5 ++- transports/noise/src/io/framed.rs | 5 ++- transports/quic/src/transport.rs | 20 +++++------ transports/quic/tests/smoke.rs | 8 ++--- transports/tcp/src/lib.rs | 14 +++----- transports/tls/src/upgrade.rs | 8 ++--- transports/webrtc-websys/src/connection.rs | 9 +++-- transports/webrtc/src/tokio/transport.rs | 16 ++++----- transports/webrtc/tests/smoke.rs | 8 ++--- 31 files changed, 139 insertions(+), 232 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 30d8d566090..72756ac51ad 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -135,6 +135,7 @@ clippy.used_underscore_binding = "warn" clippy.pedantic = "allow" clippy.type_complexity = "allow" clippy.unnecessary_wraps = "warn" +clippy.manual_let_else = "warn" clippy.dbg_macro = "warn" [workspace.metadata.release] diff --git a/core/src/transport.rs b/core/src/transport.rs index 5a214fdcda2..8656b89228c 100644 --- a/core/src/transport.rs +++ b/core/src/transport.rs @@ -401,16 +401,16 @@ impl TransportEvent { /// Returns `None` if the event is not actually an incoming connection, /// otherwise the upgrade and the remote address. pub fn into_incoming(self) -> Option<(TUpgr, Multiaddr)> { - if let TransportEvent::Incoming { + let TransportEvent::Incoming { upgrade, send_back_addr, .. } = self - { - Some((upgrade, send_back_addr)) - } else { - None - } + else { + return None; + }; + + Some((upgrade, send_back_addr)) } /// Returns `true` if this is a [`TransportEvent::NewAddress`]. diff --git a/core/src/transport/memory.rs b/core/src/transport/memory.rs index 4c30ee9b65d..bf88215dd43 100644 --- a/core/src/transport/memory.rs +++ b/core/src/transport/memory.rs @@ -62,9 +62,8 @@ impl Hub { port } else { loop { - let port = match NonZeroU64::new(rand::random()) { - Some(p) => p, - None => continue, + let Some(port) = NonZeroU64::new(rand::random()) else { + continue; }; if !hub.contains_key(&port) { break port; @@ -184,16 +183,12 @@ impl Transport for MemoryTransport { id: ListenerId, addr: Multiaddr, ) -> Result<(), TransportError> { - let port = if let Ok(port) = parse_memory_addr(&addr) { - port - } else { - return Err(TransportError::MultiaddrNotSupported(addr)); - }; + let port = + parse_memory_addr(&addr).map_err(|_| TransportError::MultiaddrNotSupported(addr))?; - let (rx, port) = match HUB.register_port(port) { - Some((rx, port)) => (rx, port), - None => return Err(TransportError::Other(MemoryTransportError::Unreachable)), - }; + let (rx, port) = HUB + .register_port(port) + .ok_or(TransportError::Other(MemoryTransportError::Unreachable))?; let listener = Listener { id, diff --git a/core/tests/transport_upgrade.rs b/core/tests/transport_upgrade.rs index 8f151c886c7..a8872051618 100644 --- a/core/tests/transport_upgrade.rs +++ b/core/tests/transport_upgrade.rs @@ -110,11 +110,11 @@ fn upgrade_pipeline() { let server = async move { loop { - let (upgrade, _send_back_addr) = - match listener_transport.select_next_some().await.into_incoming() { - Some(u) => u, - None => continue, - }; + let Some((upgrade, _send_back_addr)) = + listener_transport.select_next_some().await.into_incoming() + else { + continue; + }; let (peer, _mplex) = upgrade.await.unwrap(); assert_eq!(peer, dialer_id); } diff --git a/examples/browser-webrtc/src/main.rs b/examples/browser-webrtc/src/main.rs index 97d1ab30250..098b70f3054 100644 --- a/examples/browser-webrtc/src/main.rs +++ b/examples/browser-webrtc/src/main.rs @@ -92,9 +92,8 @@ struct StaticFiles; /// Serve the Multiaddr we are listening on and the host files. pub(crate) async fn serve(libp2p_transport: Multiaddr) { - let listen_addr = match libp2p_transport.iter().next() { - Some(Protocol::Ip4(addr)) => addr, - _ => panic!("Expected 1st protocol to be IP4"), + let Some(Protocol::Ip4(listen_addr)) = libp2p_transport.iter().next() else { + panic!("Expected 1st protocol to be IP4") }; let server = Router::new() diff --git a/examples/file-sharing/src/main.rs b/examples/file-sharing/src/main.rs index ad1a12b3b02..a834ee0600e 100644 --- a/examples/file-sharing/src/main.rs +++ b/examples/file-sharing/src/main.rs @@ -62,9 +62,8 @@ async fn main() -> Result<(), Box> { // In case the user provided an address of a peer on the CLI, dial it. if let Some(addr) = opt.peer { - let peer_id = match addr.iter().last() { - Some(Protocol::P2p(peer_id)) => peer_id, - _ => return Err("Expect peer multiaddr to contain peer ID.".into()), + let Some(Protocol::P2p(peer_id)) = addr.iter().last() else { + return Err("Expect peer multiaddr to contain peer ID.".into()); }; network_client .dial(peer_id, addr) diff --git a/identity/src/ecdsa.rs b/identity/src/ecdsa.rs index f24410e038b..2f1a286d46d 100644 --- a/identity/src/ecdsa.rs +++ b/identity/src/ecdsa.rs @@ -151,9 +151,8 @@ pub struct PublicKey(VerifyingKey); impl PublicKey { /// Verify an ECDSA signature on a message using the public key. pub fn verify(&self, msg: &[u8], sig: &[u8]) -> bool { - let sig = match Signature::from_der(sig) { - Ok(sig) => sig, - Err(_) => return false, + let Ok(sig) = Signature::from_der(sig) else { + return false; }; self.0.verify(msg, &sig).is_ok() } diff --git a/misc/memory-connection-limits/src/lib.rs b/misc/memory-connection-limits/src/lib.rs index 5bc5f1068a3..ac911654979 100644 --- a/misc/memory-connection-limits/src/lib.rs +++ b/misc/memory-connection-limits/src/lib.rs @@ -124,12 +124,9 @@ impl Behaviour { return; } - let stats = match memory_stats::memory_stats() { - Some(stats) => stats, - None => { - tracing::warn!("Failed to retrieve process memory stats"); - return; - } + let Some(stats) = memory_stats::memory_stats() else { + tracing::warn!("Failed to retrieve process memory stats"); + return; }; self.last_refreshed = now; diff --git a/muxers/mplex/src/io.rs b/muxers/mplex/src/io.rs index 0dd8b9ea6a9..753294a7845 100644 --- a/muxers/mplex/src/io.rs +++ b/muxers/mplex/src/io.rs @@ -912,9 +912,7 @@ where /// Fails the entire multiplexed stream if too many pending `Reset` /// frames accumulate when using [`MaxBufferBehaviour::ResetStream`]. fn buffer(&mut self, id: LocalStreamId, data: Bytes) -> io::Result<()> { - let state = if let Some(state) = self.substreams.get_mut(&id) { - state - } else { + let Some(state) = self.substreams.get_mut(&id) else { tracing::trace!( connection=%self.id, substream=%id, @@ -924,9 +922,7 @@ where return Ok(()); }; - let buf = if let Some(buf) = state.recv_buf_open() { - buf - } else { + let Some(buf) = state.recv_buf_open() else { tracing::trace!( connection=%self.id, substream=%id, diff --git a/protocols/autonat/src/behaviour/as_client.rs b/protocols/autonat/src/behaviour/as_client.rs index 7c9242d47cc..668f3b93719 100644 --- a/protocols/autonat/src/behaviour/as_client.rs +++ b/protocols/autonat/src/behaviour/as_client.rs @@ -278,13 +278,9 @@ impl<'a> AsClient<'a> { tracing::debug!("Outbound dial-back request aborted: No dial-back addresses"); return Err(OutboundProbeError::NoAddresses); } - let server = match self.random_server() { - Some(s) => s, - None => { - tracing::debug!("Outbound dial-back request aborted: No qualified server"); - return Err(OutboundProbeError::NoServer); - } - }; + + let server = self.random_server().ok_or(OutboundProbeError::NoServer)?; + let request_id = self.inner.send_request( &server, DialRequest { @@ -301,11 +297,8 @@ impl<'a> AsClient<'a> { // Set the delay to the next probe based on the time of our last probe // and the specified delay. fn schedule_next_probe(&mut self, delay: Duration) { - let last_probe_instant = match self.last_probe { - Some(instant) => instant, - None => { - return; - } + let Some(last_probe_instant) = self.last_probe else { + return; }; let schedule_next = *last_probe_instant + delay; self.schedule_probe diff --git a/protocols/autonat/src/behaviour/as_server.rs b/protocols/autonat/src/behaviour/as_server.rs index 6185ecc50e2..878fd713dda 100644 --- a/protocols/autonat/src/behaviour/as_server.rs +++ b/protocols/autonat/src/behaviour/as_server.rs @@ -326,13 +326,13 @@ impl<'a> AsServer<'a> { demanded: Vec, observed_remote_at: &Multiaddr, ) -> Vec { - let observed_ip = match observed_remote_at + let Some(observed_ip) = observed_remote_at .into_iter() .find(|p| matches!(p, Protocol::Ip4(_) | Protocol::Ip6(_))) - { - Some(ip) => ip, - None => return Vec::new(), + else { + return Vec::new(); }; + let mut distinct = HashSet::new(); demanded .into_iter() diff --git a/protocols/autonat/src/protocol.rs b/protocols/autonat/src/protocol.rs index b28f70cadf4..c1862058400 100644 --- a/protocols/autonat/src/protocol.rs +++ b/protocols/autonat/src/protocol.rs @@ -119,22 +119,18 @@ impl DialRequest { if msg.type_pb != Some(proto::MessageType::DIAL) { return Err(io::Error::new(io::ErrorKind::InvalidData, "invalid type")); } - let (peer_id, addrs) = if let Some(proto::Dial { - peer: - Some(proto::PeerInfo { - id: Some(peer_id), - addrs, - }), - }) = msg.dial - { - (peer_id, addrs) - } else { - tracing::debug!("Received malformed dial message"); - return Err(io::Error::new( - io::ErrorKind::InvalidData, - "invalid dial message", - )); - }; + + let peer_id_result = msg.dial.and_then(|dial| { + dial.peer.and_then(|peer_info| { + let Some(peer_id) = peer_info.id else { + return None; + }; + Some((peer_id, peer_info.addrs)) + }) + }); + + let (peer_id, addrs) = peer_id_result + .ok_or_else(|| io::Error::new(io::ErrorKind::InvalidData, "invalid dial message"))?; let peer_id = { PeerId::try_from(peer_id.to_vec()) diff --git a/protocols/dcutr/src/behaviour.rs b/protocols/dcutr/src/behaviour.rs index 2a5f8160b6f..3742eb512f5 100644 --- a/protocols/dcutr/src/behaviour.rs +++ b/protocols/dcutr/src/behaviour.rs @@ -104,33 +104,27 @@ impl Behaviour { .. }: DialFailure, ) { - let peer_id = if let Some(peer_id) = peer_id { - peer_id - } else { + let Some(peer_id) = peer_id else { return; }; - let relayed_connection_id = if let Some(relayed_connection_id) = self + let Some(relayed_connection_id) = self .direct_to_relayed_connections .get(&failed_direct_connection) - { - *relayed_connection_id - } else { + else { return; }; - let attempt = if let Some(attempt) = self + let Some(attempt) = self .outgoing_direct_connection_attempts - .get(&(relayed_connection_id, peer_id)) - { - *attempt - } else { + .get(&(*relayed_connection_id, peer_id)) + else { return; }; - if attempt < MAX_NUMBER_OF_UPGRADE_ATTEMPTS { + if *attempt < MAX_NUMBER_OF_UPGRADE_ATTEMPTS { self.queued_events.push_back(ToSwarm::NotifyHandler { - handler: NotifyHandler::One(relayed_connection_id), + handler: NotifyHandler::One(*relayed_connection_id), peer_id, event: Either::Left(handler::relayed::Command::Connect), }) @@ -245,7 +239,6 @@ impl NetworkBehaviour for Behaviour { result: Ok(connection_id), })]); } - Ok(Either::Right(dummy::ConnectionHandler)) } diff --git a/protocols/floodsub/src/layer.rs b/protocols/floodsub/src/layer.rs index 5bb689dae6a..35711408a8d 100644 --- a/protocols/floodsub/src/layer.rs +++ b/protocols/floodsub/src/layer.rs @@ -146,9 +146,8 @@ impl Floodsub { /// /// Returns true if we were subscribed to this topic. pub fn unsubscribe(&mut self, topic: Topic) -> bool { - let pos = match self.subscribed_topics.iter().position(|t| *t == topic) { - Some(pos) => pos, - None => return false, + let Some(pos) = self.subscribed_topics.iter().position(|t| *t == topic) else { + return false; }; self.subscribed_topics.remove(pos); diff --git a/protocols/gossipsub/src/behaviour.rs b/protocols/gossipsub/src/behaviour.rs index 8f8e8c1fd09..95665581a79 100644 --- a/protocols/gossipsub/src/behaviour.rs +++ b/protocols/gossipsub/src/behaviour.rs @@ -1895,15 +1895,12 @@ where let mut unsubscribed_peers = Vec::new(); - let subscribed_topics = match self.peer_topics.get_mut(propagation_source) { - Some(topics) => topics, - None => { - tracing::error!( - peer=%propagation_source, - "Subscription by unknown peer" - ); - return; - } + let Some(subscribed_topics) = self.peer_topics.get_mut(propagation_source) else { + tracing::error!( + peer=%propagation_source, + "Subscription by unknown peer" + ); + return; }; // Collect potential graft topics for the peer. @@ -3152,15 +3149,12 @@ where // remove from mesh, topic_peers, peer_topic and the fanout tracing::debug!(peer=%peer_id, "Peer disconnected"); { - let topics = match self.peer_topics.get(&peer_id) { - Some(topics) => topics, - None => { - debug_assert!( - self.blacklisted_peers.contains(&peer_id), - "Disconnected node not in connected list" - ); - return; - } + let Some(topics) = self.peer_topics.get(&peer_id) else { + debug_assert!( + self.blacklisted_peers.contains(&peer_id), + "Disconnected node not in connected list" + ); + return; }; // remove peer from all mappings diff --git a/protocols/gossipsub/src/peer_score.rs b/protocols/gossipsub/src/peer_score.rs index b370d2dfe06..b1ea9bfae95 100644 --- a/protocols/gossipsub/src/peer_score.rs +++ b/protocols/gossipsub/src/peer_score.rs @@ -220,11 +220,9 @@ impl PeerScore { /// Returns the score for a peer, logging metrics. This is called from the heartbeat and /// increments the metric counts for penalties. pub(crate) fn metric_score(&self, peer_id: &PeerId, mut metrics: Option<&mut Metrics>) -> f64 { - let peer_stats = match self.peer_stats.get(peer_id) { - Some(v) => v, - None => return 0.0, + let Some(peer_stats) = self.peer_stats.get(peer_id) else { + return 0.0; }; - let mut score = 0.0; // topic scores diff --git a/protocols/gossipsub/src/protocol.rs b/protocols/gossipsub/src/protocol.rs index dcd509f6aa9..bec026dce94 100644 --- a/protocols/gossipsub/src/protocol.rs +++ b/protocols/gossipsub/src/protocol.rs @@ -165,28 +165,19 @@ impl GossipsubCodec { fn verify_signature(message: &proto::Message) -> bool { use quick_protobuf::MessageWrite; - let from = match message.from.as_ref() { - Some(v) => v, - None => { - tracing::debug!("Signature verification failed: No source id given"); - return false; - } + let Some(from) = message.from.as_ref() else { + tracing::debug!("Signature verification failed: No source id given"); + return false; }; - let source = match PeerId::from_bytes(from) { - Ok(v) => v, - Err(_) => { - tracing::debug!("Signature verification failed: Invalid Peer Id"); - return false; - } + let Ok(source) = PeerId::from_bytes(from) else { + tracing::debug!("Signature verification failed: Invalid Peer Id"); + return false; }; - let signature = match message.signature.as_ref() { - Some(v) => v, - None => { - tracing::debug!("Signature verification failed: No signature provided"); - return false; - } + let Some(signature) = message.signature.as_ref() else { + tracing::debug!("Signature verification failed: No signature provided"); + return false; }; // If there is a key value in the protobuf, use that key otherwise the key must be @@ -239,11 +230,9 @@ impl Decoder for GossipsubCodec { type Error = quick_protobuf_codec::Error; fn decode(&mut self, src: &mut BytesMut) -> Result, Self::Error> { - let rpc = match self.codec.decode(src)? { - Some(p) => p, - None => return Ok(None), + let Some(rpc) = self.codec.decode(src)? else { + return Ok(None); }; - // Store valid messages. let mut messages = Vec::with_capacity(rpc.publish.len()); // Store any invalid messages. diff --git a/protocols/kad/src/behaviour.rs b/protocols/kad/src/behaviour.rs index 7af83a1bdb8..5a4b737c998 100644 --- a/protocols/kad/src/behaviour.rs +++ b/protocols/kad/src/behaviour.rs @@ -1983,11 +1983,7 @@ where } fn on_dial_failure(&mut self, DialFailure { peer_id, error, .. }: DialFailure) { - let peer_id = match peer_id { - Some(id) => id, - // Not interested in dial failures to unknown peers. - None => return, - }; + let Some(peer_id) = peer_id else { return }; match error { DialError::LocalPeerId { .. } diff --git a/protocols/kad/src/query/peers/closest/disjoint.rs b/protocols/kad/src/query/peers/closest/disjoint.rs index 151e26f69f1..68721f93d7c 100644 --- a/protocols/kad/src/query/peers/closest/disjoint.rs +++ b/protocols/kad/src/query/peers/closest/disjoint.rs @@ -406,9 +406,8 @@ impl>> Iterator for ResultIter { .iter_mut() // Find the iterator with the next closest peer. .fold(Option::<&mut Peekable<_>>::None, |iter_a, iter_b| { - let iter_a = match iter_a { - Some(iter_a) => iter_a, - None => return Some(iter_b), + let Some(iter_a) = iter_a else { + return Some(iter_b); }; match (iter_a.peek(), iter_b.peek()) { diff --git a/protocols/mdns/src/behaviour/iface/query.rs b/protocols/mdns/src/behaviour/iface/query.rs index eb326617a2d..eeb699fca6b 100644 --- a/protocols/mdns/src/behaviour/iface/query.rs +++ b/protocols/mdns/src/behaviour/iface/query.rs @@ -156,9 +156,8 @@ impl MdnsResponse { return None; } - let record_value = match record.data() { - Some(RData::PTR(record)) => record, - _ => return None, + let RData::PTR(record_value) = record.data()? else { + return None; }; MdnsPeer::new(packet, record_value, record.ttl()) @@ -248,21 +247,14 @@ impl MdnsPeer { .flat_map(|txt| txt.iter()) .filter_map(|txt| { // TODO: wrong, txt can be multiple character strings - let addr = match dns::decode_character_string(txt) { - Ok(a) => a, - Err(_) => return None, - }; + let addr = dns::decode_character_string(txt).ok()?; + if !addr.starts_with(b"dnsaddr=") { return None; } - let addr = match str::from_utf8(&addr[8..]) { - Ok(a) => a, - Err(_) => return None, - }; - let mut addr = match addr.parse::() { - Ok(a) => a, - Err(_) => return None, - }; + + let mut addr = str::from_utf8(&addr[8..]).ok()?.parse::().ok()?; + match addr.pop() { Some(Protocol::P2p(peer_id)) => { if let Some(pid) = &my_peer_id { @@ -345,9 +337,8 @@ mod tests { if record.name().to_utf8() != SERVICE_NAME_FQDN { return None; } - let record_value = match record.data() { - Some(RData::PTR(record)) => record, - _ => return None, + let Some(RData::PTR(record_value)) = record.data() else { + return None; }; Some(record_value) }) diff --git a/protocols/relay/src/priv_client/transport.rs b/protocols/relay/src/priv_client/transport.rs index c463de9cc66..7147f0b5e55 100644 --- a/protocols/relay/src/priv_client/transport.rs +++ b/protocols/relay/src/priv_client/transport.rs @@ -345,13 +345,10 @@ impl Stream for Listener { return Poll::Ready(None); } - let msg = match ready!(self.from_behaviour.poll_next_unpin(cx)) { - Some(msg) => msg, - None => { - // Sender of `from_behaviour` has been dropped, signaling listener to close. - self.close(Ok(())); - continue; - } + let Some(msg) = ready!(self.from_behaviour.poll_next_unpin(cx)) else { + // Sender of `from_behaviour` has been dropped, signaling listener to close. + self.close(Ok(())); + continue; }; match msg { diff --git a/protocols/relay/src/protocol/inbound_hop.rs b/protocols/relay/src/protocol/inbound_hop.rs index 951ae579a2d..41fe2675dce 100644 --- a/protocols/relay/src/protocol/inbound_hop.rs +++ b/protocols/relay/src/protocol/inbound_hop.rs @@ -201,10 +201,7 @@ pub(crate) async fn handle_inbound_request( None => return Err(Error::MissingPeer), }; - let dst = match peer_id_res { - Ok(res) => res, - Err(_) => return Err(Error::ParsePeerId), - }; + let dst = peer_id_res.map_err(|_| Error::ParsePeerId)?; Either::Right(CircuitReq { dst, substream }) } diff --git a/protocols/rendezvous/src/codec.rs b/protocols/rendezvous/src/codec.rs index bfc3cf275fc..df913353e20 100644 --- a/protocols/rendezvous/src/codec.rs +++ b/protocols/rendezvous/src/codec.rs @@ -227,9 +227,8 @@ impl Decoder for Codec { fn decode(&mut self, src: &mut BytesMut) -> Result, Self::Error> { let mut pb: ProtobufCodec = ProtobufCodec::new(MAX_MESSAGE_LEN_BYTES); - let message = match pb.decode(src)? { - Some(p) => p, - None => return Ok(None), + let Some(message) = pb.decode(src)? else { + return Ok(None); }; Ok(Some(message.try_into()?)) diff --git a/transports/noise/src/io/framed.rs b/transports/noise/src/io/framed.rs index b7504f2e37a..9ed6045cf38 100644 --- a/transports/noise/src/io/framed.rs +++ b/transports/noise/src/io/framed.rs @@ -197,9 +197,8 @@ fn decrypt( ciphertext: &mut BytesMut, decrypt_fn: impl FnOnce(&[u8], &mut [u8]) -> Result, ) -> io::Result> { - let ciphertext = match decode_length_prefixed(ciphertext)? { - Some(b) => b, - None => return Ok(None), + let Some(ciphertext) = decode_length_prefixed(ciphertext)? else { + return Ok(None); }; tracing::trace!("Incoming ciphertext has {} bytes", ciphertext.len()); diff --git a/transports/quic/src/transport.rs b/transports/quic/src/transport.rs index feda501464f..aea3c91093f 100644 --- a/transports/quic/src/transport.rs +++ b/transports/quic/src/transport.rs @@ -522,9 +522,8 @@ impl Listener

{ /// Poll for a next If Event. fn poll_if_addr(&mut self, cx: &mut Context<'_>) -> Poll<::Item> { let endpoint_addr = self.socket_addr(); - let if_watcher = match self.if_watcher.as_mut() { - Some(iw) => iw, - None => return Poll::Pending, + let Some(if_watcher) = self.if_watcher.as_mut() else { + return Poll::Pending; }; loop { match ready!(P::poll_if_event(if_watcher, cx)) { @@ -717,17 +716,14 @@ fn multiaddr_to_socketaddr( fn is_quic_addr(addr: &Multiaddr, support_draft_29: bool) -> bool { use Protocol::*; let mut iter = addr.iter(); - let first = match iter.next() { - Some(p) => p, - None => return false, + let Some(first) = iter.next() else { + return false; }; - let second = match iter.next() { - Some(p) => p, - None => return false, + let Some(second) = iter.next() else { + return false; }; - let third = match iter.next() { - Some(p) => p, - None => return false, + let Some(third) = iter.next() else { + return false; }; let fourth = iter.next(); let fifth = iter.next(); diff --git a/transports/quic/tests/smoke.rs b/transports/quic/tests/smoke.rs index 77dfac6bb44..36fb72a5ee7 100644 --- a/transports/quic/tests/smoke.rs +++ b/transports/quic/tests/smoke.rs @@ -653,15 +653,13 @@ async fn answer_inbound_streams( mut connection: StreamMuxerBox, ) { loop { - let mut inbound_stream = match future::poll_fn(|cx| { + let Ok(mut inbound_stream) = future::poll_fn(|cx| { let _ = connection.poll_unpin(cx)?; - connection.poll_inbound_unpin(cx) }) .await - { - Ok(s) => s, - Err(_) => return, + else { + return; }; P::spawn(async move { diff --git a/transports/tcp/src/lib.rs b/transports/tcp/src/lib.rs index b466f387ba4..fbb7008aa5b 100644 --- a/transports/tcp/src/lib.rs +++ b/transports/tcp/src/lib.rs @@ -441,12 +441,9 @@ where id: ListenerId, addr: Multiaddr, ) -> Result<(), TransportError> { - let socket_addr = if let Ok(sa) = multiaddr_to_socketaddr(addr.clone()) { - sa - } else { - return Err(TransportError::MultiaddrNotSupported(addr)); - }; - tracing::debug!(address=%socket_addr, "listening on address"); + let socket_addr = multiaddr_to_socketaddr(addr.clone()) + .map_err(|_| TransportError::MultiaddrNotSupported(addr))?; + tracing::debug!("listening on {}", socket_addr); let listener = self .do_listen(id, socket_addr) .map_err(TransportError::Other)?; @@ -665,9 +662,8 @@ where /// Poll for a next If Event. fn poll_if_addr(&mut self, cx: &mut Context<'_>) -> Poll<::Item> { - let if_watcher = match self.if_watcher.as_mut() { - Some(if_watcher) => if_watcher, - None => return Poll::Pending, + let Some(if_watcher) = self.if_watcher.as_mut() else { + return Poll::Pending; }; let my_listen_addr_port = self.listen_addr.port(); diff --git a/transports/tls/src/upgrade.rs b/transports/tls/src/upgrade.rs index 463f2c3a323..84510b6bab0 100644 --- a/transports/tls/src/upgrade.rs +++ b/transports/tls/src/upgrade.rs @@ -121,12 +121,8 @@ where fn extract_single_certificate( state: &CommonState, ) -> Result, certificate::ParseError> { - let cert = match state - .peer_certificates() - .expect("config enforces presence of certificates") - { - [single] => single, - _ => panic!("config enforces exactly one certificate"), + let Some([cert]) = state.peer_certificates() else { + panic!("config enforces exactly one certificate"); }; certificate::parse(cert) diff --git a/transports/webrtc-websys/src/connection.rs b/transports/webrtc-websys/src/connection.rs index d0c8968f62e..b858237da63 100644 --- a/transports/webrtc-websys/src/connection.rs +++ b/transports/webrtc-websys/src/connection.rs @@ -297,11 +297,10 @@ mod sdp_tests { #[test] fn test_fingerprint() { - let sdp: &str = "v=0\r\no=- 0 0 IN IP6 ::1\r\ns=-\r\nc=IN IP6 ::1\r\nt=0 0\r\na=ice-lite\r\nm=application 61885 UDP/DTLS/SCTP webrtc-datachannel\r\na=mid:0\r\na=setup:passive\r\na=ice-ufrag:libp2p+webrtc+v1/YwapWySn6fE6L9i47PhlB6X4gzNXcgFs\r\na=ice-pwd:libp2p+webrtc+v1/YwapWySn6fE6L9i47PhlB6X4gzNXcgFs\r\na=fingerprint:sha-256 A8:17:77:1E:02:7E:D1:2B:53:92:70:A6:8E:F9:02:CC:21:72:3A:92:5D:F4:97:5F:27:C4:5E:75:D4:F4:31:89\r\na=sctp-port:5000\r\na=max-message-size:16384\r\na=candidate:1467250027 1 UDP 1467250027 ::1 61885 typ host\r\n"; - let fingerprint = match parse_fingerprint(sdp) { - Some(fingerprint) => fingerprint, - None => panic!("No fingerprint found"), - }; + let sdp = "v=0\r\no=- 0 0 IN IP6 ::1\r\ns=-\r\nc=IN IP6 ::1\r\nt=0 0\r\na=ice-lite\r\nm=application 61885 UDP/DTLS/SCTP webrtc-datachannel\r\na=mid:0\r\na=setup:passive\r\na=ice-ufrag:libp2p+webrtc+v1/YwapWySn6fE6L9i47PhlB6X4gzNXcgFs\r\na=ice-pwd:libp2p+webrtc+v1/YwapWySn6fE6L9i47PhlB6X4gzNXcgFs\r\na=fingerprint:sha-256 A8:17:77:1E:02:7E:D1:2B:53:92:70:A6:8E:F9:02:CC:21:72:3A:92:5D:F4:97:5F:27:C4:5E:75:D4:F4:31:89\r\na=sctp-port:5000\r\na=max-message-size:16384\r\na=candidate:1467250027 1 UDP 1467250027 ::1 61885 typ host\r\n"; + + let fingerprint = parse_fingerprint(sdp).unwrap(); + assert_eq!(fingerprint.algorithm(), "sha-256"); assert_eq!(fingerprint.to_sdp_format(), "A8:17:77:1E:02:7E:D1:2B:53:92:70:A6:8E:F9:02:CC:21:72:3A:92:5D:F4:97:5F:27:C4:5E:75:D4:F4:31:89"); } diff --git a/transports/webrtc/src/tokio/transport.rs b/transports/webrtc/src/tokio/transport.rs index b50e44fe4ba..02cfa6f7296 100644 --- a/transports/webrtc/src/tokio/transport.rs +++ b/transports/webrtc/src/tokio/transport.rs @@ -257,9 +257,8 @@ impl ListenStream { } fn poll_if_watcher(&mut self, cx: &mut Context<'_>) -> Poll<::Item> { - let if_watcher = match self.if_watcher.as_mut() { - Some(w) => w, - None => return Poll::Pending, + let Some(if_watcher) = self.if_watcher.as_mut() else { + return Poll::Pending; }; while let Poll::Ready(event) = if_watcher.poll_if_event(cx) { @@ -412,12 +411,11 @@ fn parse_webrtc_listen_addr(addr: &Multiaddr) -> Option { _ => return None, }; - let port = iter.next()?; - let webrtc = iter.next()?; - - let port = match (port, webrtc) { - (Protocol::Udp(port), Protocol::WebRTCDirect) => port, - _ => return None, + let Protocol::Udp(port) = iter.next()? else { + return None; + }; + let Protocol::WebRTCDirect = iter.next()? else { + return None; }; if iter.next().is_some() { diff --git a/transports/webrtc/tests/smoke.rs b/transports/webrtc/tests/smoke.rs index 6e83f75f0d4..76e168edfd6 100644 --- a/transports/webrtc/tests/smoke.rs +++ b/transports/webrtc/tests/smoke.rs @@ -178,15 +178,13 @@ fn prop(number_listeners: NonZeroU8, number_streams: NonZeroU8) -> quickcheck::T async fn answer_inbound_streams(mut connection: StreamMuxerBox) { loop { - let mut inbound_stream = match future::poll_fn(|cx| { + let Ok(mut inbound_stream) = future::poll_fn(|cx| { let _ = connection.poll_unpin(cx)?; - connection.poll_inbound_unpin(cx) }) .await - { - Ok(s) => s, - Err(_) => return, + else { + return; }; tokio::spawn(async move { From 69e62cbf69a3cfc3c48e732b877371c7bf5a0c98 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 Nov 2023 02:38:02 +0000 Subject: [PATCH 2/8] deps: bump smallvec from 1.11.1 to 1.11.2 Pull-Request: #4852. --- Cargo.lock | 4 ++-- core/Cargo.toml | 2 +- misc/multistream-select/Cargo.toml | 2 +- muxers/mplex/Cargo.toml | 2 +- protocols/floodsub/Cargo.toml | 2 +- protocols/gossipsub/Cargo.toml | 2 +- protocols/identify/Cargo.toml | 2 +- protocols/kad/Cargo.toml | 2 +- protocols/mdns/Cargo.toml | 2 +- protocols/request-response/Cargo.toml | 2 +- swarm/Cargo.toml | 2 +- transports/dns/Cargo.toml | 2 +- 12 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 842b7ebb462..f86b3ebecaf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5254,9 +5254,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.1" +version = "1.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" +checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" [[package]] name = "smol" diff --git a/core/Cargo.toml b/core/Cargo.toml index 3d3bad6eefa..5f75c978fed 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -27,7 +27,7 @@ quick-protobuf = "0.8" rand = "0.8" rw-stream-sink = { workspace = true } serde = { version = "1", optional = true, features = ["derive"] } -smallvec = "1.11.1" +smallvec = "1.11.2" thiserror = "1.0" tracing = "0.1.37" unsigned-varint = "0.7" diff --git a/misc/multistream-select/Cargo.toml b/misc/multistream-select/Cargo.toml index e33478c1a08..12161aef0fd 100644 --- a/misc/multistream-select/Cargo.toml +++ b/misc/multistream-select/Cargo.toml @@ -15,7 +15,7 @@ bytes = "1" futures = "0.3" tracing = "0.1.37" pin-project = "1.1.3" -smallvec = "1.11.1" +smallvec = "1.11.2" unsigned-varint = "0.7" [dev-dependencies] diff --git a/muxers/mplex/Cargo.toml b/muxers/mplex/Cargo.toml index c38b11dca9e..fb321b6f22e 100644 --- a/muxers/mplex/Cargo.toml +++ b/muxers/mplex/Cargo.toml @@ -19,7 +19,7 @@ libp2p-identity = { workspace = true } nohash-hasher = "0.2" parking_lot = "0.12" rand = "0.8" -smallvec = "1.11.1" +smallvec = "1.11.2" tracing = "0.1.37" unsigned-varint = { version = "0.7", features = ["asynchronous_codec"] } diff --git a/protocols/floodsub/Cargo.toml b/protocols/floodsub/Cargo.toml index 9d5776c56b7..92c3b0ffd8d 100644 --- a/protocols/floodsub/Cargo.toml +++ b/protocols/floodsub/Cargo.toml @@ -22,7 +22,7 @@ libp2p-identity = { workspace = true } quick-protobuf = "0.8" quick-protobuf-codec = { workspace = true } rand = "0.8" -smallvec = "1.11.1" +smallvec = "1.11.2" thiserror = "1.0.50" tracing = "0.1.37" diff --git a/protocols/gossipsub/Cargo.toml b/protocols/gossipsub/Cargo.toml index dc987fec1b8..16cc0d39209 100644 --- a/protocols/gossipsub/Cargo.toml +++ b/protocols/gossipsub/Cargo.toml @@ -34,7 +34,7 @@ rand = "0.8" regex = "1.10.2" serde = { version = "1", optional = true, features = ["derive"] } sha2 = "0.10.8" -smallvec = "1.11.1" +smallvec = "1.11.2" tracing = "0.1.37" unsigned-varint = { version = "0.7.2", features = ["asynchronous_codec"] } void = "1.0.2" diff --git a/protocols/identify/Cargo.toml b/protocols/identify/Cargo.toml index fbed5779266..ed9ca3fc3e9 100644 --- a/protocols/identify/Cargo.toml +++ b/protocols/identify/Cargo.toml @@ -21,7 +21,7 @@ libp2p-identity = { workspace = true } lru = "0.12.0" quick-protobuf-codec = { workspace = true } quick-protobuf = "0.8" -smallvec = "1.11.1" +smallvec = "1.11.2" thiserror = "1.0" tracing = "0.1.37" void = "1.0" diff --git a/protocols/kad/Cargo.toml b/protocols/kad/Cargo.toml index affde929b0e..403189b1801 100644 --- a/protocols/kad/Cargo.toml +++ b/protocols/kad/Cargo.toml @@ -24,7 +24,7 @@ quick-protobuf-codec = { workspace = true } libp2p-identity = { workspace = true, features = ["rand"] } rand = "0.8" sha2 = "0.10.8" -smallvec = "1.11.1" +smallvec = "1.11.2" uint = "0.9" unsigned-varint = { version = "0.7", features = ["asynchronous_codec"] } void = "1.0" diff --git a/protocols/mdns/Cargo.toml b/protocols/mdns/Cargo.toml index a3cbe43dcf6..b1af9b8ca75 100644 --- a/protocols/mdns/Cargo.toml +++ b/protocols/mdns/Cargo.toml @@ -20,7 +20,7 @@ libp2p-core = { workspace = true } libp2p-swarm = { workspace = true } libp2p-identity = { workspace = true } rand = "0.8.3" -smallvec = "1.11.1" +smallvec = "1.11.2" socket2 = { version = "0.5.5", features = ["all"] } tokio = { version = "1.33", default-features = false, features = ["net", "time"], optional = true} tracing = "0.1.37" diff --git a/protocols/request-response/Cargo.toml b/protocols/request-response/Cargo.toml index 66b37e3d528..1bfd03e1520 100644 --- a/protocols/request-response/Cargo.toml +++ b/protocols/request-response/Cargo.toml @@ -21,7 +21,7 @@ libp2p-identity = { workspace = true } rand = "0.8" serde = { version = "1.0", optional = true} serde_json = { version = "1.0.108", optional = true } -smallvec = "1.11.1" +smallvec = "1.11.2" tracing = "0.1.37" void = "1.0.2" futures-timer = "3.0.2" diff --git a/swarm/Cargo.toml b/swarm/Cargo.toml index 25fbabe939d..08cb7c8a161 100644 --- a/swarm/Cargo.toml +++ b/swarm/Cargo.toml @@ -23,7 +23,7 @@ libp2p-swarm-derive = { workspace = true, optional = true } multistream-select = { workspace = true } once_cell = "1.18.0" rand = "0.8" -smallvec = "1.11.1" +smallvec = "1.11.2" tracing = "0.1.37" void = "1" wasm-bindgen-futures = { version = "0.4.38", optional = true } diff --git a/transports/dns/Cargo.toml b/transports/dns/Cargo.toml index ad9810f1b3d..f1946af7c0e 100644 --- a/transports/dns/Cargo.toml +++ b/transports/dns/Cargo.toml @@ -18,7 +18,7 @@ libp2p-core = { workspace = true } libp2p-identity = { workspace = true } parking_lot = "0.12.0" hickory-resolver = { version = "0.24.0", default-features = false, features = ["system-config"] } -smallvec = "1.11.1" +smallvec = "1.11.2" tracing = "0.1.37" [dev-dependencies] From 22f1e23610d4c28653c34cdb49f8a1a98e6bbfe5 Mon Sep 17 00:00:00 2001 From: Ademola <83315082+0xcrust@users.noreply.github.com> Date: Tue, 14 Nov 2023 03:47:01 +0100 Subject: [PATCH 3/8] feat(gossipsub): process send-queue before inbound stream Process outbound stream before inbound stream in `gossipsub::EnabledHandler::poll(..)`. Pull-Request: #4778. --- protocols/gossipsub/CHANGELOG.md | 6 +- protocols/gossipsub/src/handler.rs | 128 ++++++++++++++--------------- 2 files changed, 67 insertions(+), 67 deletions(-) diff --git a/protocols/gossipsub/CHANGELOG.md b/protocols/gossipsub/CHANGELOG.md index dd5fcf5febd..68041f2dcd3 100644 --- a/protocols/gossipsub/CHANGELOG.md +++ b/protocols/gossipsub/CHANGELOG.md @@ -10,9 +10,9 @@ - Remove deprecated `gossipsub::Config::idle_timeout` in favor of `SwarmBuilder::idle_connection_timeout`. See [PR 4642](https://github.com/libp2p/rust-libp2p/pull/4642). - Return typed error from config builder. - See [PR 4445]. - -[PR 4445]: https://github.com/libp2p/rust-libp2p/pull/4445 + See [PR 4445](https://github.com/libp2p/rust-libp2p/pull/4445). +- Process outbound stream before inbound stream in `EnabledHandler::poll(..)`. + See [PR 4778](https://github.com/libp2p/rust-libp2p/pull/4778). ## 0.45.2 diff --git a/protocols/gossipsub/src/handler.rs b/protocols/gossipsub/src/handler.rs index 63ef96781d9..e2ec681321c 100644 --- a/protocols/gossipsub/src/handler.rs +++ b/protocols/gossipsub/src/handler.rs @@ -241,70 +241,6 @@ impl EnabledHandler { }); } - loop { - match std::mem::replace( - &mut self.inbound_substream, - Some(InboundSubstreamState::Poisoned), - ) { - // inbound idle state - Some(InboundSubstreamState::WaitingInput(mut substream)) => { - match substream.poll_next_unpin(cx) { - Poll::Ready(Some(Ok(message))) => { - self.last_io_activity = Instant::now(); - self.inbound_substream = - Some(InboundSubstreamState::WaitingInput(substream)); - return Poll::Ready(ConnectionHandlerEvent::NotifyBehaviour(message)); - } - Poll::Ready(Some(Err(error))) => { - tracing::debug!("Failed to read from inbound stream: {error}"); - // Close this side of the stream. If the - // peer is still around, they will re-establish their - // outbound stream i.e. our inbound stream. - self.inbound_substream = - Some(InboundSubstreamState::Closing(substream)); - } - // peer closed the stream - Poll::Ready(None) => { - tracing::debug!("Inbound stream closed by remote"); - self.inbound_substream = - Some(InboundSubstreamState::Closing(substream)); - } - Poll::Pending => { - self.inbound_substream = - Some(InboundSubstreamState::WaitingInput(substream)); - break; - } - } - } - Some(InboundSubstreamState::Closing(mut substream)) => { - match Sink::poll_close(Pin::new(&mut substream), cx) { - Poll::Ready(res) => { - if let Err(e) = res { - // Don't close the connection but just drop the inbound substream. - // In case the remote has more to send, they will open up a new - // substream. - tracing::debug!("Inbound substream error while closing: {e}"); - } - self.inbound_substream = None; - break; - } - Poll::Pending => { - self.inbound_substream = - Some(InboundSubstreamState::Closing(substream)); - break; - } - } - } - None => { - self.inbound_substream = None; - break; - } - Some(InboundSubstreamState::Poisoned) => { - unreachable!("Error occurred during inbound stream processing") - } - } - } - // process outbound stream loop { match std::mem::replace( @@ -382,6 +318,70 @@ impl EnabledHandler { } } + loop { + match std::mem::replace( + &mut self.inbound_substream, + Some(InboundSubstreamState::Poisoned), + ) { + // inbound idle state + Some(InboundSubstreamState::WaitingInput(mut substream)) => { + match substream.poll_next_unpin(cx) { + Poll::Ready(Some(Ok(message))) => { + self.last_io_activity = Instant::now(); + self.inbound_substream = + Some(InboundSubstreamState::WaitingInput(substream)); + return Poll::Ready(ConnectionHandlerEvent::NotifyBehaviour(message)); + } + Poll::Ready(Some(Err(error))) => { + tracing::debug!("Failed to read from inbound stream: {error}"); + // Close this side of the stream. If the + // peer is still around, they will re-establish their + // outbound stream i.e. our inbound stream. + self.inbound_substream = + Some(InboundSubstreamState::Closing(substream)); + } + // peer closed the stream + Poll::Ready(None) => { + tracing::debug!("Inbound stream closed by remote"); + self.inbound_substream = + Some(InboundSubstreamState::Closing(substream)); + } + Poll::Pending => { + self.inbound_substream = + Some(InboundSubstreamState::WaitingInput(substream)); + break; + } + } + } + Some(InboundSubstreamState::Closing(mut substream)) => { + match Sink::poll_close(Pin::new(&mut substream), cx) { + Poll::Ready(res) => { + if let Err(e) = res { + // Don't close the connection but just drop the inbound substream. + // In case the remote has more to send, they will open up a new + // substream. + tracing::debug!("Inbound substream error while closing: {e}"); + } + self.inbound_substream = None; + break; + } + Poll::Pending => { + self.inbound_substream = + Some(InboundSubstreamState::Closing(substream)); + break; + } + } + } + None => { + self.inbound_substream = None; + break; + } + Some(InboundSubstreamState::Poisoned) => { + unreachable!("Error occurred during inbound stream processing") + } + } + } + Poll::Pending } } From cf284cd7b7668faf85a821b1227c8bf8beeb7989 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Tue, 14 Nov 2023 13:56:28 +1100 Subject: [PATCH 4/8] deps: bump all related `opentelemtry` dependencies together Pull-Request: #4856. --- .github/dependabot.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 59915a71b6c..e7a12feeec6 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -13,6 +13,10 @@ updates: patterns: - "trust-dns-*" - "async-std-resolver" + opentelemetry: + patterns: + - "opentelemetry*" + - "tracing-opentelemetry" - package-ecosystem: "github-actions" directory: "/" schedule: From 8d87c08a0ff8efcc588b9381e6d2b54d053a6df3 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Tue, 14 Nov 2023 14:05:41 +1100 Subject: [PATCH 5/8] deps: rename `trust-dns` dependabot group These dependencies have been renamed and the old ones are no longer present in our dependency tree. Pull-Request: #4857. --- .github/dependabot.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index e7a12feeec6..b40857107c9 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -9,9 +9,9 @@ updates: prefix: "deps" rebase-strategy: "disabled" groups: - trust-dns: + hickory-dns: patterns: - - "trust-dns-*" + - "hickory-*" - "async-std-resolver" opentelemetry: patterns: From 2e19947910b2a185857c323b679ac8ff5e332704 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 Nov 2023 03:16:18 +0000 Subject: [PATCH 6/8] deps: bump async-io from 1.13.0 to 2.2.0 Pull-Request: #4804. --- Cargo.lock | 138 +++++++++++++++++++++++++++++--------- protocols/mdns/Cargo.toml | 2 +- transports/tcp/Cargo.toml | 2 +- 3 files changed, 109 insertions(+), 33 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f86b3ebecaf..57a81c352ed 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -233,7 +233,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" dependencies = [ "concurrent-queue", - "event-listener", + "event-listener 2.5.3", "futures-core", ] @@ -243,11 +243,11 @@ version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fa3dc5f2a8564f07759c008b9109dc0d39de92a88d5588b8a5036d286383afb" dependencies = [ - "async-lock", + "async-lock 2.7.0", "async-task", "concurrent-queue", "fastrand 1.9.0", - "futures-lite", + "futures-lite 1.13.0", "slab", ] @@ -257,10 +257,10 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "279cf904654eeebfa37ac9bb1598880884924aab82e290aa65c9e77a0e142e06" dependencies = [ - "async-lock", + "async-lock 2.7.0", "autocfg", "blocking", - "futures-lite", + "futures-lite 1.13.0", ] [[package]] @@ -271,10 +271,10 @@ checksum = "f1b6f5d7df27bd294849f8eec66ecfc63d11814df7a4f5d74168a2394467b776" dependencies = [ "async-channel", "async-executor", - "async-io", - "async-lock", + "async-io 1.13.0", + "async-lock 2.7.0", "blocking", - "futures-lite", + "futures-lite 1.13.0", "once_cell", ] @@ -284,27 +284,58 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af" dependencies = [ - "async-lock", + "async-lock 2.7.0", "autocfg", "cfg-if", "concurrent-queue", - "futures-lite", + "futures-lite 1.13.0", "log", "parking", - "polling", + "polling 2.8.0", "rustix 0.37.25", "slab", "socket2 0.4.9", "waker-fn", ] +[[package]] +name = "async-io" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41ed9d5715c2d329bf1b4da8d60455b99b187f27ba726df2883799af9af60997" +dependencies = [ + "async-lock 3.1.0", + "cfg-if", + "concurrent-queue", + "futures-io", + "futures-lite 2.0.1", + "parking", + "polling 3.3.0", + "rustix 0.38.21", + "slab", + "tracing", + "waker-fn", + "windows-sys", +] + [[package]] name = "async-lock" version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa24f727524730b077666307f2734b4a1a1c57acb79193127dcc8914d5242dd7" dependencies = [ - "event-listener", + "event-listener 2.5.3", +] + +[[package]] +name = "async-lock" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "deb2ab2aa8a746e221ab826c73f48bc6ba41be6763f0855cb249eb6d154cf1d7" +dependencies = [ + "event-listener 3.1.0", + "event-listener-strategy", + "pin-project-lite", ] [[package]] @@ -313,10 +344,10 @@ version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4051e67316bc7eff608fe723df5d32ed639946adcd69e07df41fd42a7b411f1f" dependencies = [ - "async-io", + "async-io 1.13.0", "autocfg", "blocking", - "futures-lite", + "futures-lite 1.13.0", ] [[package]] @@ -325,13 +356,13 @@ version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a9d28b1d97e08915212e2e45310d47854eafa69600756fc735fb788f75199c9" dependencies = [ - "async-io", - "async-lock", + "async-io 1.13.0", + "async-lock 2.7.0", "autocfg", "blocking", "cfg-if", - "event-listener", - "futures-lite", + "event-listener 2.5.3", + "futures-lite 1.13.0", "rustix 0.37.25", "signal-hook", "windows-sys", @@ -346,14 +377,14 @@ dependencies = [ "async-attributes", "async-channel", "async-global-executor", - "async-io", - "async-lock", + "async-io 1.13.0", + "async-lock 2.7.0", "async-process", "crossbeam-utils", "futures-channel", "futures-core", "futures-io", - "futures-lite", + "futures-lite 1.13.0", "gloo-timers", "kv-log-macro", "log", @@ -631,11 +662,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77231a1c8f801696fc0123ec6150ce92cffb8e164a02afb9c8ddee0e9b65ad65" dependencies = [ "async-channel", - "async-lock", + "async-lock 2.7.0", "async-task", "atomic-waker", "fastrand 1.9.0", - "futures-lite", + "futures-lite 1.13.0", "log", ] @@ -1418,6 +1449,27 @@ version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" +[[package]] +name = "event-listener" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d93877bcde0eb80ca09131a08d23f0a5c18a620b01db137dba666d18cd9b30c2" +dependencies = [ + "concurrent-queue", + "parking", + "pin-project-lite", +] + +[[package]] +name = "event-listener-strategy" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d96b852f1345da36d551b9473fa1e2b1eb5c5195585c6c018118bc92a8d91160" +dependencies = [ + "event-listener 3.1.0", + "pin-project-lite", +] + [[package]] name = "fantoccini" version = "0.20.0-rc.4" @@ -1589,6 +1641,16 @@ dependencies = [ "waker-fn", ] +[[package]] +name = "futures-lite" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3831c2651acb5177cbd83943f3d9c8912c5ad03c76afcc0e9511ba568ec5ebb" +dependencies = [ + "futures-core", + "pin-project-lite", +] + [[package]] name = "futures-macro" version = "0.3.29" @@ -2097,7 +2159,7 @@ version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbb892e5777fe09e16f3d44de7802f4daa7267ecbe8c466f19d94e25bb0c303e" dependencies = [ - "async-io", + "async-io 1.13.0", "core-foundation", "fnv", "futures", @@ -2698,7 +2760,7 @@ dependencies = [ name = "libp2p-mdns" version = "0.45.1" dependencies = [ - "async-io", + "async-io 2.2.0", "async-std", "data-encoding", "futures", @@ -3109,7 +3171,7 @@ dependencies = [ name = "libp2p-tcp" version = "0.41.0" dependencies = [ - "async-io", + "async-io 2.2.0", "async-std", "futures", "futures-timer", @@ -3688,7 +3750,7 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6471bf08e7ac0135876a9581bf3217ef0333c191c128d34878079f42ee150411" dependencies = [ - "async-io", + "async-io 1.13.0", "bytes", "futures", "libc", @@ -4172,6 +4234,20 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "polling" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e53b6af1f60f36f8c2ac2aad5459d75a5a9b4be1e8cdd40264f315d78193e531" +dependencies = [ + "cfg-if", + "concurrent-queue", + "pin-project-lite", + "rustix 0.38.21", + "tracing", + "windows-sys", +] + [[package]] name = "poly1305" version = "0.8.0" @@ -4340,7 +4416,7 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8cc2c5017e4b43d5995dcea317bc46c1e09404c0a9664d2908f7f02dfe943d75" dependencies = [ - "async-io", + "async-io 1.13.0", "async-std", "bytes", "futures-io", @@ -5267,12 +5343,12 @@ dependencies = [ "async-channel", "async-executor", "async-fs", - "async-io", - "async-lock", + "async-io 1.13.0", + "async-lock 2.7.0", "async-net", "async-process", "blocking", - "futures-lite", + "futures-lite 1.13.0", ] [[package]] diff --git a/protocols/mdns/Cargo.toml b/protocols/mdns/Cargo.toml index b1af9b8ca75..cfa37aae6f6 100644 --- a/protocols/mdns/Cargo.toml +++ b/protocols/mdns/Cargo.toml @@ -12,7 +12,7 @@ categories = ["network-programming", "asynchronous"] [dependencies] async-std = { version = "1.12.0", optional = true } -async-io = { version = "1.13.0", optional = true } +async-io = { version = "2.2.0", optional = true } data-encoding = "2.4.0" futures = "0.3.29" if-watch = "3.1.0" diff --git a/transports/tcp/Cargo.toml b/transports/tcp/Cargo.toml index 28604a4ebdd..5bf9eee54cd 100644 --- a/transports/tcp/Cargo.toml +++ b/transports/tcp/Cargo.toml @@ -11,7 +11,7 @@ keywords = ["peer-to-peer", "libp2p", "networking"] categories = ["network-programming", "asynchronous"] [dependencies] -async-io = { version = "1.13.0", optional = true } +async-io = { version = "2.2.0", optional = true } futures = "0.3.29" futures-timer = "3.0" if-watch = "3.1.0" From 2821dc3ee040032ec3ea9ba62673698bb4317cce Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 Nov 2023 03:25:54 +0000 Subject: [PATCH 7/8] deps: bump tokio from 1.33.0 to 1.34.0 Pull-Request: #4847. --- Cargo.lock | 12 ++++++------ examples/autonat/Cargo.toml | 2 +- examples/browser-webrtc/Cargo.toml | 2 +- examples/chat/Cargo.toml | 2 +- examples/dcutr/Cargo.toml | 2 +- examples/ipfs-kad/Cargo.toml | 2 +- examples/ipfs-private/Cargo.toml | 2 +- examples/ping/Cargo.toml | 2 +- examples/rendezvous/Cargo.toml | 2 +- hole-punching-tests/Cargo.toml | 2 +- interop-tests/Cargo.toml | 2 +- misc/futures-bounded/Cargo.toml | 2 +- protocols/mdns/Cargo.toml | 4 ++-- protocols/perf/Cargo.toml | 2 +- protocols/rendezvous/Cargo.toml | 2 +- protocols/upnp/Cargo.toml | 2 +- swarm/Cargo.toml | 4 ++-- transports/pnet/Cargo.toml | 2 +- transports/quic/Cargo.toml | 4 ++-- transports/tcp/Cargo.toml | 4 ++-- transports/tls/Cargo.toml | 2 +- transports/uds/Cargo.toml | 2 +- transports/webrtc/Cargo.toml | 4 ++-- 23 files changed, 33 insertions(+), 33 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 57a81c352ed..863d0352b05 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3602,9 +3602,9 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.8" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" +checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" dependencies = [ "libc", "wasi 0.11.0+wasi-snapshot-preview1", @@ -5709,9 +5709,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.33.0" +version = "1.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653" +checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9" dependencies = [ "backtrace", "bytes", @@ -5738,9 +5738,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" +checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", diff --git a/examples/autonat/Cargo.toml b/examples/autonat/Cargo.toml index ecf330b7bc8..5cfa11c0aa6 100644 --- a/examples/autonat/Cargo.toml +++ b/examples/autonat/Cargo.toml @@ -9,7 +9,7 @@ license = "MIT" release = false [dependencies] -tokio = { version = "1.33", features = ["full"] } +tokio = { version = "1.34", features = ["full"] } clap = { version = "4.4.8", features = ["derive"] } futures = "0.3.29" libp2p = { path = "../../libp2p", features = ["tokio", "tcp", "noise", "yamux", "autonat", "identify", "macros"] } diff --git a/examples/browser-webrtc/Cargo.toml b/examples/browser-webrtc/Cargo.toml index d9084441b14..38407c8b667 100644 --- a/examples/browser-webrtc/Cargo.toml +++ b/examples/browser-webrtc/Cargo.toml @@ -27,7 +27,7 @@ axum = "0.6.19" libp2p = { path = "../../libp2p", features = [ "ed25519", "macros", "ping", "wasm-bindgen", "tokio"] } libp2p-webrtc = { workspace = true, features = ["tokio"] } rust-embed = { version = "8.0.0", features = ["include-exclude", "interpolate-folder-path"] } -tokio = { version = "1.33", features = ["macros", "net", "rt", "signal"] } +tokio = { version = "1.34", features = ["macros", "net", "rt", "signal"] } tokio-util = { version = "0.7", features = ["compat"] } tower = "0.4" tower-http = { version = "0.4.0", features = ["cors"] } diff --git a/examples/chat/Cargo.toml b/examples/chat/Cargo.toml index b5af806501b..9b3561dab48 100644 --- a/examples/chat/Cargo.toml +++ b/examples/chat/Cargo.toml @@ -9,7 +9,7 @@ license = "MIT" release = false [dependencies] -tokio = { version = "1.33", features = ["full"] } +tokio = { version = "1.34", features = ["full"] } async-trait = "0.1" futures = "0.3.29" libp2p = { path = "../../libp2p", features = [ "tokio", "gossipsub", "mdns", "noise", "macros", "tcp", "yamux", "quic"] } diff --git a/examples/dcutr/Cargo.toml b/examples/dcutr/Cargo.toml index 08d0332ef0b..c65e2ca91e6 100644 --- a/examples/dcutr/Cargo.toml +++ b/examples/dcutr/Cargo.toml @@ -14,7 +14,7 @@ futures = "0.3.29" futures-timer = "3.0" libp2p = { path = "../../libp2p", features = [ "dns", "dcutr", "identify", "macros", "noise", "ping", "quic", "relay", "rendezvous", "tcp", "tokio", "yamux"] } log = "0.4" -tokio = { version = "1.29", features = ["macros", "net", "rt", "signal"] } +tokio = { version = "1.34", features = ["macros", "net", "rt", "signal"] } tracing = "0.1.37" tracing-subscriber = { version = "0.3", features = ["env-filter"] } diff --git a/examples/ipfs-kad/Cargo.toml b/examples/ipfs-kad/Cargo.toml index 9c53d9c53ae..8c1ecebf022 100644 --- a/examples/ipfs-kad/Cargo.toml +++ b/examples/ipfs-kad/Cargo.toml @@ -9,7 +9,7 @@ license = "MIT" release = false [dependencies] -tokio = { version = "1.33", features = ["rt-multi-thread", "macros"] } +tokio = { version = "1.34", features = ["rt-multi-thread", "macros"] } async-trait = "0.1" clap = { version = "4.4.8", features = ["derive"] } env_logger = "0.10" diff --git a/examples/ipfs-private/Cargo.toml b/examples/ipfs-private/Cargo.toml index 20cafabe079..97c1ca59368 100644 --- a/examples/ipfs-private/Cargo.toml +++ b/examples/ipfs-private/Cargo.toml @@ -9,7 +9,7 @@ license = "MIT" release = false [dependencies] -tokio = { version = "1.33", features = ["rt-multi-thread", "macros", "io-std"] } +tokio = { version = "1.34", features = ["rt-multi-thread", "macros", "io-std"] } async-trait = "0.1" either = "1.9" futures = "0.3.29" diff --git a/examples/ping/Cargo.toml b/examples/ping/Cargo.toml index 58cee54409e..66d2847cb8f 100644 --- a/examples/ping/Cargo.toml +++ b/examples/ping/Cargo.toml @@ -11,7 +11,7 @@ release = false [dependencies] futures = "0.3.29" libp2p = { path = "../../libp2p", features = ["noise", "ping", "tcp", "tokio", "yamux"] } -tokio = { version = "1.33.0", features = ["full"] } +tokio = { version = "1.34.0", features = ["full"] } tracing = "0.1.37" tracing-subscriber = { version = "0.3", features = ["env-filter"] } diff --git a/examples/rendezvous/Cargo.toml b/examples/rendezvous/Cargo.toml index f20e5f519ae..fbb2ed44a03 100644 --- a/examples/rendezvous/Cargo.toml +++ b/examples/rendezvous/Cargo.toml @@ -13,7 +13,7 @@ async-std = { version = "1.12", features = ["attributes"] } async-trait = "0.1" futures = "0.3.29" libp2p = { path = "../../libp2p", features = [ "async-std", "identify", "macros", "noise", "ping", "rendezvous", "tcp", "tokio", "yamux"] } -tokio = { version = "1.33", features = ["rt-multi-thread", "macros", "time"] } +tokio = { version = "1.34", features = ["rt-multi-thread", "macros", "time"] } tracing = "0.1.37" tracing-subscriber = { version = "0.3", features = ["env-filter"] } diff --git a/hole-punching-tests/Cargo.toml b/hole-punching-tests/Cargo.toml index 9155d3e69a0..a1a191d2e36 100644 --- a/hole-punching-tests/Cargo.toml +++ b/hole-punching-tests/Cargo.toml @@ -12,7 +12,7 @@ futures = "0.3.29" libp2p = { path = "../libp2p", features = ["tokio", "dcutr", "identify", "macros", "noise", "ping", "relay", "tcp", "yamux", "quic"] } tracing = "0.1.37" redis = { version = "0.23.0", default-features = false, features = ["tokio-comp"] } -tokio = { version = "1.29.1", features = ["full"] } +tokio = { version = "1.34.0", features = ["full"] } serde = { version = "1.0.192", features = ["derive"] } serde_json = "1.0.108" either = "1.9.0" diff --git a/interop-tests/Cargo.toml b/interop-tests/Cargo.toml index 3caad98dfa2..eba65b782e7 100644 --- a/interop-tests/Cargo.toml +++ b/interop-tests/Cargo.toml @@ -34,7 +34,7 @@ redis = { version = "0.23.3", default-features = false, features = [ rust-embed = "8.0" serde_json = "1" thirtyfour = "=0.32.0-rc.8" # https://github.com/stevepryde/thirtyfour/issues/169 -tokio = { version = "1.33.0", features = ["full"] } +tokio = { version = "1.34.0", features = ["full"] } tower-http = { version = "0.4", features = ["cors", "fs", "trace"] } tracing = "0.1.37" tracing-subscriber = { version = "0.3", features = ["env-filter"] } diff --git a/misc/futures-bounded/Cargo.toml b/misc/futures-bounded/Cargo.toml index 7b622374b43..b7c4086c87d 100644 --- a/misc/futures-bounded/Cargo.toml +++ b/misc/futures-bounded/Cargo.toml @@ -17,7 +17,7 @@ futures-util = { version = "0.3.29" } futures-timer = "3.0.2" [dev-dependencies] -tokio = { version = "1.33.0", features = ["macros", "rt"] } +tokio = { version = "1.34.0", features = ["macros", "rt"] } [lints] workspace = true diff --git a/protocols/mdns/Cargo.toml b/protocols/mdns/Cargo.toml index cfa37aae6f6..5c495e7cb15 100644 --- a/protocols/mdns/Cargo.toml +++ b/protocols/mdns/Cargo.toml @@ -22,7 +22,7 @@ libp2p-identity = { workspace = true } rand = "0.8.3" smallvec = "1.11.2" socket2 = { version = "0.5.5", features = ["all"] } -tokio = { version = "1.33", default-features = false, features = ["net", "time"], optional = true} +tokio = { version = "1.34", default-features = false, features = ["net", "time"], optional = true} tracing = "0.1.37" hickory-proto = { version = "0.24.0", default-features = false, features = ["mdns"] } void = "1.0.2" @@ -37,7 +37,7 @@ libp2p-noise = { workspace = true } libp2p-swarm = { workspace = true, features = ["tokio", "async-std"] } libp2p-tcp = { workspace = true, features = ["tokio", "async-io"] } libp2p-yamux = { workspace = true } -tokio = { version = "1.33", default-features = false, features = ["macros", "rt", "rt-multi-thread", "time"] } +tokio = { version = "1.34", default-features = false, features = ["macros", "rt", "rt-multi-thread", "time"] } libp2p-swarm-test = { path = "../../swarm-test" } tracing-subscriber = { version = "0.3", features = ["env-filter"] } diff --git a/protocols/perf/Cargo.toml b/protocols/perf/Cargo.toml index ed9d086c8ab..4d001e87d30 100644 --- a/protocols/perf/Cargo.toml +++ b/protocols/perf/Cargo.toml @@ -31,7 +31,7 @@ serde_json = "1.0" thiserror = "1.0" tracing = "0.1.37" tracing-subscriber = { version = "0.3", features = ["env-filter"] } -tokio = { version = "1.33", default-features = false, features = ["macros", "rt", "rt-multi-thread"] } +tokio = { version = "1.34", default-features = false, features = ["macros", "rt", "rt-multi-thread"] } void = "1" [dev-dependencies] diff --git a/protocols/rendezvous/Cargo.toml b/protocols/rendezvous/Cargo.toml index c5f1c6e5729..0e9ff88cd72 100644 --- a/protocols/rendezvous/Cargo.toml +++ b/protocols/rendezvous/Cargo.toml @@ -37,7 +37,7 @@ libp2p-swarm-test = { path = "../../swarm-test" } libp2p-tcp = { workspace = true, features = ["tokio"] } libp2p-yamux = { workspace = true } rand = "0.8" -tokio = { version = "1.33", features = [ "rt-multi-thread", "time", "macros", "sync", "process", "fs", "net" ] } +tokio = { version = "1.34", features = [ "rt-multi-thread", "time", "macros", "sync", "process", "fs", "net" ] } tracing-subscriber = { version = "0.3", features = ["env-filter"] } # Passing arguments to the docsrs builder in order to properly document cfg's. diff --git a/protocols/upnp/Cargo.toml b/protocols/upnp/Cargo.toml index 30d50923009..f00c80aabb3 100644 --- a/protocols/upnp/Cargo.toml +++ b/protocols/upnp/Cargo.toml @@ -16,7 +16,7 @@ futures-timer = "3.0.2" igd-next = "0.14.2" libp2p-core = { workspace = true } libp2p-swarm = { workspace = true } -tokio = { version = "1.33", default-features = false, features = ["rt"], optional = true } +tokio = { version = "1.34", default-features = false, features = ["rt"], optional = true } tracing = "0.1.37" void = "1.0.2" diff --git a/swarm/Cargo.toml b/swarm/Cargo.toml index 08cb7c8a161..3b706df6d2b 100644 --- a/swarm/Cargo.toml +++ b/swarm/Cargo.toml @@ -30,7 +30,7 @@ wasm-bindgen-futures = { version = "0.4.38", optional = true } [target.'cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")))'.dependencies] async-std = { version = "1.6.2", optional = true } -tokio = { version = "1.33", features = ["rt"], optional = true } +tokio = { version = "1.34", features = ["rt"], optional = true } [features] macros = ["dep:libp2p-swarm-derive"] @@ -54,7 +54,7 @@ quickcheck = { workspace = true } void = "1" once_cell = "1.18.0" trybuild = "1.0.85" -tokio = { version = "1.33.0", features = ["time", "rt", "macros", "rt-multi-thread"] } +tokio = { version = "1.34.0", features = ["time", "rt", "macros", "rt-multi-thread"] } tracing-subscriber = { version = "0.3", features = ["env-filter"] } [[test]] diff --git a/transports/pnet/Cargo.toml b/transports/pnet/Cargo.toml index 000cf0eb203..ab23de720e7 100644 --- a/transports/pnet/Cargo.toml +++ b/transports/pnet/Cargo.toml @@ -27,7 +27,7 @@ libp2p-tcp = { workspace = true, features = ["tokio"] } libp2p-websocket = { workspace = true } libp2p-yamux = { workspace = true } quickcheck = { workspace = true } -tokio = { version = "1.33.0", features = ["full"] } +tokio = { version = "1.34.0", features = ["full"] } # Passing arguments to the docsrs builder in order to properly document cfg's. # More information: https://docs.rs/about/builds#cross-compiling diff --git a/transports/quic/Cargo.toml b/transports/quic/Cargo.toml index 013d2269980..22b241c8d8e 100644 --- a/transports/quic/Cargo.toml +++ b/transports/quic/Cargo.toml @@ -22,7 +22,7 @@ quinn = { version = "0.10.2", default-features = false, features = ["tls-rustls" rand = "0.8.5" rustls = { version = "0.21.8", default-features = false } thiserror = "1.0.50" -tokio = { version = "1.33.0", default-features = false, features = ["net", "rt", "time"], optional = true } +tokio = { version = "1.34.0", default-features = false, features = ["net", "rt", "time"], optional = true } tracing = "0.1.37" socket2 = "0.5.5" ring = "0.16.20" @@ -46,7 +46,7 @@ libp2p-noise = { workspace = true } libp2p-tcp = { workspace = true, features = ["async-io"] } libp2p-yamux = { workspace = true } quickcheck = "1" -tokio = { version = "1.33.0", features = ["macros", "rt-multi-thread", "time"] } +tokio = { version = "1.34.0", features = ["macros", "rt-multi-thread", "time"] } tracing-subscriber = { version = "0.3", features = ["env-filter"] } [[test]] diff --git a/transports/tcp/Cargo.toml b/transports/tcp/Cargo.toml index 5bf9eee54cd..3974459cbe4 100644 --- a/transports/tcp/Cargo.toml +++ b/transports/tcp/Cargo.toml @@ -19,7 +19,7 @@ libc = "0.2.150" libp2p-core = { workspace = true } libp2p-identity = { workspace = true } socket2 = { version = "0.5.5", features = ["all"] } -tokio = { version = "1.33.0", default-features = false, features = ["net"], optional = true } +tokio = { version = "1.34.0", default-features = false, features = ["net"], optional = true } tracing = "0.1.37" [features] @@ -29,7 +29,7 @@ async-io = ["dep:async-io", "if-watch/smol"] [dev-dependencies] async-std = { version = "1.6.5", features = ["attributes"] } libp2p-identity = { workspace = true, features = ["rand"] } -tokio = { version = "1.33.0", default-features = false, features = ["full"] } +tokio = { version = "1.34.0", default-features = false, features = ["full"] } tracing-subscriber = { version = "0.3", features = ["env-filter"] } # Passing arguments to the docsrs builder in order to properly document cfg's. diff --git a/transports/tls/Cargo.toml b/transports/tls/Cargo.toml index 3df1674c4b3..196251dcb76 100644 --- a/transports/tls/Cargo.toml +++ b/transports/tls/Cargo.toml @@ -33,7 +33,7 @@ libp2p-core = { workspace = true } libp2p-identity = { workspace = true, features = ["ed25519", "rsa", "secp256k1", "ecdsa", "rand"] } libp2p-swarm = { workspace = true, features = ["tokio"] } libp2p-yamux = { workspace = true } -tokio = { version = "1.33.0", features = ["full"] } +tokio = { version = "1.34.0", features = ["full"] } # Passing arguments to the docsrs builder in order to properly document cfg's. # More information: https://docs.rs/about/builds#cross-compiling diff --git a/transports/uds/Cargo.toml b/transports/uds/Cargo.toml index 9d480fd1dbe..bcf7570c44f 100644 --- a/transports/uds/Cargo.toml +++ b/transports/uds/Cargo.toml @@ -14,7 +14,7 @@ categories = ["network-programming", "asynchronous"] async-std = { version = "1.6.2", optional = true } libp2p-core = { workspace = true } futures = "0.3.29" -tokio = { version = "1.33", default-features = false, features = ["net"], optional = true } +tokio = { version = "1.34", default-features = false, features = ["net"], optional = true } tracing = "0.1.37" [dev-dependencies] diff --git a/transports/webrtc/Cargo.toml b/transports/webrtc/Cargo.toml index e8306f7a8ba..7578c9d5257 100644 --- a/transports/webrtc/Cargo.toml +++ b/transports/webrtc/Cargo.toml @@ -28,7 +28,7 @@ serde = { version = "1.0", features = ["derive"] } stun = "0.5" thiserror = "1" tinytemplate = "1.2" -tokio = { version = "1.33", features = ["net"], optional = true } +tokio = { version = "1.34", features = ["net"], optional = true } tokio-util = { version = "0.7", features = ["compat"], optional = true } tracing = "0.1.37" webrtc = { version = "0.9.0", optional = true } @@ -39,7 +39,7 @@ pem = ["webrtc?/pem"] [dev-dependencies] libp2p-identity = { workspace = true, features = ["rand"] } -tokio = { version = "1.33", features = ["full"] } +tokio = { version = "1.34", features = ["full"] } quickcheck = "1.0.3" tracing-subscriber = { version = "0.3", features = ["env-filter"] } From cddc306978a7cca705de5ce10ec5e16e8b732084 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 Nov 2023 03:35:36 +0000 Subject: [PATCH 8/8] deps: bump tracing-subscriber from 0.3.17 to 0.3.18 Pull-Request: #4859. --- Cargo.lock | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 863d0352b05..4ed0b66625b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5923,6 +5923,17 @@ dependencies = [ "tracing-core", ] +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + [[package]] name = "tracing-opentelemetry" version = "0.21.0" @@ -5935,15 +5946,15 @@ dependencies = [ "smallvec", "tracing", "tracing-core", - "tracing-log", + "tracing-log 0.1.3", "tracing-subscriber", ] [[package]] name = "tracing-subscriber" -version = "0.3.17" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" dependencies = [ "matchers", "nu-ansi-term", @@ -5954,7 +5965,7 @@ dependencies = [ "thread_local", "tracing", "tracing-core", - "tracing-log", + "tracing-log 0.2.0", ] [[package]]