From bd710df61aa91c759885ae72d08303fc51896848 Mon Sep 17 00:00:00 2001 From: hopinheimer <48147533+hopinheimer@users.noreply.github.com> Date: Mon, 23 Dec 2024 02:32:04 -0500 Subject: [PATCH 01/56] feat(mdns): emit `ToSwarm::NewExternalAddrOfPeer` on discovery fixes #5104 and superseeds #5179 Pull-Request: #5753. --- Cargo.lock | 2 +- Cargo.toml | 2 +- protocols/mdns/CHANGELOG.md | 5 + protocols/mdns/Cargo.toml | 2 +- protocols/mdns/src/behaviour.rs | 178 ++++++++++++++++++-------------- 5 files changed, 111 insertions(+), 78 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 31df58e8ec4..43bcd4c8689 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2985,7 +2985,7 @@ dependencies = [ [[package]] name = "libp2p-mdns" -version = "0.46.1" +version = "0.46.2" dependencies = [ "async-io", "async-std", diff --git a/Cargo.toml b/Cargo.toml index c77768db311..7a116949bcc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -84,7 +84,7 @@ libp2p-gossipsub = { version = "0.48.0", path = "protocols/gossipsub" } libp2p-identify = { version = "0.46.1", path = "protocols/identify" } libp2p-identity = { version = "0.2.10" } libp2p-kad = { version = "0.47.1", path = "protocols/kad" } -libp2p-mdns = { version = "0.46.1", path = "protocols/mdns" } +libp2p-mdns = { version = "0.46.2", path = "protocols/mdns" } libp2p-memory-connection-limits = { version = "0.3.1", path = "misc/memory-connection-limits" } libp2p-metrics = { version = "0.15.0", path = "misc/metrics" } libp2p-mplex = { version = "0.42.0", path = "muxers/mplex" } diff --git a/protocols/mdns/CHANGELOG.md b/protocols/mdns/CHANGELOG.md index 61290703c34..98dc3d55454 100644 --- a/protocols/mdns/CHANGELOG.md +++ b/protocols/mdns/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.46.2 + +- Emit `ToSwarm::NewExternalAddrOfPeer` on discovery. + See [PR 5753](https://github.com/libp2p/rust-libp2p/pull/5753) + ## 0.46.1 - Upgrade `hickory-proto`. diff --git a/protocols/mdns/Cargo.toml b/protocols/mdns/Cargo.toml index 16436848efe..618d41e9b9d 100644 --- a/protocols/mdns/Cargo.toml +++ b/protocols/mdns/Cargo.toml @@ -2,7 +2,7 @@ name = "libp2p-mdns" edition = "2021" rust-version = { workspace = true } -version = "0.46.1" +version = "0.46.2" description = "Implementation of the libp2p mDNS discovery method" authors = ["Parity Technologies "] license = "MIT" diff --git a/protocols/mdns/src/behaviour.rs b/protocols/mdns/src/behaviour.rs index b6dde8f4487..68e28cf3d63 100644 --- a/protocols/mdns/src/behaviour.rs +++ b/protocols/mdns/src/behaviour.rs @@ -24,7 +24,11 @@ mod timer; use std::{ cmp, - collections::hash_map::{Entry, HashMap}, + collections::{ + hash_map::{Entry, HashMap}, + VecDeque, + }, + convert::Infallible, fmt, future::Future, io, @@ -188,6 +192,9 @@ where listen_addresses: Arc>, local_peer_id: PeerId, + + /// Pending behaviour events to be emitted. + pending_events: VecDeque>, } impl

Behaviour

@@ -208,6 +215,7 @@ where closest_expiration: Default::default(), listen_addresses: Default::default(), local_peer_id, + pending_events: Default::default(), }) } @@ -304,93 +312,113 @@ where &mut self, cx: &mut Context<'_>, ) -> Poll>> { - // Poll ifwatch. - while let Poll::Ready(Some(event)) = Pin::new(&mut self.if_watch).poll_next(cx) { - match event { - Ok(IfEvent::Up(inet)) => { - let addr = inet.addr(); - if addr.is_loopback() { - continue; - } - if addr.is_ipv4() && self.config.enable_ipv6 - || addr.is_ipv6() && !self.config.enable_ipv6 - { - continue; - } - if let Entry::Vacant(e) = self.if_tasks.entry(addr) { - match InterfaceState::::new( - addr, - self.config.clone(), - self.local_peer_id, - self.listen_addresses.clone(), - self.query_response_sender.clone(), - ) { - Ok(iface_state) => { - e.insert(P::spawn(iface_state)); - } - Err(err) => { - tracing::error!("failed to create `InterfaceState`: {}", err) + loop { + // Check for pending events and emit them. + if let Some(event) = self.pending_events.pop_front() { + return Poll::Ready(event); + } + + // Poll ifwatch. + while let Poll::Ready(Some(event)) = Pin::new(&mut self.if_watch).poll_next(cx) { + match event { + Ok(IfEvent::Up(inet)) => { + let addr = inet.addr(); + if addr.is_loopback() { + continue; + } + if addr.is_ipv4() && self.config.enable_ipv6 + || addr.is_ipv6() && !self.config.enable_ipv6 + { + continue; + } + if let Entry::Vacant(e) = self.if_tasks.entry(addr) { + match InterfaceState::::new( + addr, + self.config.clone(), + self.local_peer_id, + self.listen_addresses.clone(), + self.query_response_sender.clone(), + ) { + Ok(iface_state) => { + e.insert(P::spawn(iface_state)); + } + Err(err) => { + tracing::error!("failed to create `InterfaceState`: {}", err) + } } } } - } - Ok(IfEvent::Down(inet)) => { - if let Some(handle) = self.if_tasks.remove(&inet.addr()) { - tracing::info!(instance=%inet.addr(), "dropping instance"); + Ok(IfEvent::Down(inet)) => { + if let Some(handle) = self.if_tasks.remove(&inet.addr()) { + tracing::info!(instance=%inet.addr(), "dropping instance"); - handle.abort(); + handle.abort(); + } } + Err(err) => tracing::error!("if watch returned an error: {}", err), } - Err(err) => tracing::error!("if watch returned an error: {}", err), } - } - // Emit discovered event. - let mut discovered = Vec::new(); - - while let Poll::Ready(Some((peer, addr, expiration))) = - self.query_response_receiver.poll_next_unpin(cx) - { - if let Some((_, _, cur_expires)) = self - .discovered_nodes - .iter_mut() - .find(|(p, a, _)| *p == peer && *a == addr) + // Emit discovered event. + let mut discovered = Vec::new(); + + while let Poll::Ready(Some((peer, addr, expiration))) = + self.query_response_receiver.poll_next_unpin(cx) { - *cur_expires = cmp::max(*cur_expires, expiration); - } else { - tracing::info!(%peer, address=%addr, "discovered peer on address"); - self.discovered_nodes.push((peer, addr.clone(), expiration)); - discovered.push((peer, addr)); + if let Some((_, _, cur_expires)) = self + .discovered_nodes + .iter_mut() + .find(|(p, a, _)| *p == peer && *a == addr) + { + *cur_expires = cmp::max(*cur_expires, expiration); + } else { + tracing::info!(%peer, address=%addr, "discovered peer on address"); + self.discovered_nodes.push((peer, addr.clone(), expiration)); + discovered.push((peer, addr.clone())); + + self.pending_events + .push_back(ToSwarm::NewExternalAddrOfPeer { + peer_id: peer, + address: addr, + }); + } } - } - if !discovered.is_empty() { - let event = Event::Discovered(discovered); - return Poll::Ready(ToSwarm::GenerateEvent(event)); - } - // Emit expired event. - let now = Instant::now(); - let mut closest_expiration = None; - let mut expired = Vec::new(); - self.discovered_nodes.retain(|(peer, addr, expiration)| { - if *expiration <= now { - tracing::info!(%peer, address=%addr, "expired peer on address"); - expired.push((*peer, addr.clone())); - return false; + if !discovered.is_empty() { + let event = Event::Discovered(discovered); + // Push to the front of the queue so that the behavior event is reported before + // the individual discovered addresses. + self.pending_events + .push_front(ToSwarm::GenerateEvent(event)); + continue; + } + // Emit expired event. + let now = Instant::now(); + let mut closest_expiration = None; + let mut expired = Vec::new(); + self.discovered_nodes.retain(|(peer, addr, expiration)| { + if *expiration <= now { + tracing::info!(%peer, address=%addr, "expired peer on address"); + expired.push((*peer, addr.clone())); + return false; + } + closest_expiration = + Some(closest_expiration.unwrap_or(*expiration).min(*expiration)); + true + }); + if !expired.is_empty() { + let event = Event::Expired(expired); + self.pending_events.push_back(ToSwarm::GenerateEvent(event)); + continue; + } + if let Some(closest_expiration) = closest_expiration { + let mut timer = P::Timer::at(closest_expiration); + let _ = Pin::new(&mut timer).poll_next(cx); + + self.closest_expiration = Some(timer); } - closest_expiration = Some(closest_expiration.unwrap_or(*expiration).min(*expiration)); - true - }); - if !expired.is_empty() { - let event = Event::Expired(expired); - return Poll::Ready(ToSwarm::GenerateEvent(event)); - } - if let Some(closest_expiration) = closest_expiration { - let mut timer = P::Timer::at(closest_expiration); - let _ = Pin::new(&mut timer).poll_next(cx); - self.closest_expiration = Some(timer); + return Poll::Pending; } - Poll::Pending } } From cddb7d6b7d1b85a3334a76a063a777b17f9f7d8e Mon Sep 17 00:00:00 2001 From: crStiv Date: Tue, 24 Dec 2024 00:34:31 +0100 Subject: [PATCH 02/56] fix: multiple typos of different importance This pull request addresses several typos and minor grammatical inconsistencies found across multiple files in the repository. The fixes aim to improve clarity, readability, and maintain consistency in the project's documentation and workflows. ### Key Changes: - **`.github/ISSUE_TEMPLATE/bug_report.yml`**: - Fixed grammatical issues in descriptions and labels. - **`.github/ISSUE_TEMPLATE/enhancement.yml`**: - Corrected label text and standardized phrasing. - **`.github/ISSUE_TEMPLATE/feature_request.yml`**: - Improved label consistency and readability. - **`.github/pull_request_template.md`**: - Enhanced phrasing and corrected minor grammatical errors. - **`.github/workflows/ci.yml`**: - Adjusted text to ensure consistent phrasing and clarity in workflow steps. These updates ensure a more professional and coherent presentation across the project documentation and workflows. Pull-Request: #5756. --- .github/ISSUE_TEMPLATE/bug_report.yml | 8 ++++---- .github/ISSUE_TEMPLATE/enhancement.yml | 4 ++-- .github/ISSUE_TEMPLATE/feature_request.yml | 4 ++-- .github/pull_request_template.md | 4 ++-- .github/workflows/ci.yml | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 1a531e3646c..40131a47a17 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -9,7 +9,7 @@ body: - type: textarea attributes: label: Summary - description: Please provide a short summary of the bug, along with any information you feel relevant to replicate the bug. + description: Please provide a short summary of the bug, along with any information you feel is relevant to replicate the bug. validations: required: true - type: textarea @@ -34,7 +34,7 @@ body: - type: textarea attributes: label: Possible Solution - description: Suggest a fix/reason for the bug, or ideas how to implement the addition or change. + description: Suggest a fix/reason for the bug, or ideas on how to implement the addition or change. validations: required: false - type: textarea @@ -45,11 +45,11 @@ body: required: false - type: dropdown attributes: - label: Would you like to work on fixing this bug ? + label: Would you like to work on fixing this bug? description: Any contribution towards fixing the bug is greatly appreciated. We are more than happy to provide help on the process. options: - "Yes" - "No" - Maybe validations: - required: true \ No newline at end of file + required: true diff --git a/.github/ISSUE_TEMPLATE/enhancement.yml b/.github/ISSUE_TEMPLATE/enhancement.yml index ed7aeb644b3..05330cf071c 100644 --- a/.github/ISSUE_TEMPLATE/enhancement.yml +++ b/.github/ISSUE_TEMPLATE/enhancement.yml @@ -21,11 +21,11 @@ body: required: true - type: dropdown attributes: - label: Are you planning to do it yourself in a pull request ? + label: Are you planning to do it yourself in a pull request? description: Any contribution is greatly appreciated. We are more than happy to provide help on the process. options: - "Yes" - "No" - Maybe validations: - required: true \ No newline at end of file + required: true diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index 6fa3e638be8..45e1da2cad0 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -32,11 +32,11 @@ body: required: false - type: dropdown attributes: - label: Are you planning to do it yourself in a pull request ? + label: Are you planning to do it yourself in a pull request? description: Any contribution is greatly appreciated. We are more than happy to provide help on the process. options: - "Yes" - "No" - Maybe validations: - required: true \ No newline at end of file + required: true diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 90e8b2cda53..24eb1b75b2c 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -6,7 +6,7 @@ This section will appear as the commit message after merging. Please craft it accordingly. For a quick primer on good commit messages, check out this blog post: https://cbea.ms/git-commit/ -Please include any relevant issues in here, for example: +Please include any relevant issues here, for example: Related https://github.com/libp2p/rust-libp2p/issues/ABCD. Fixes https://github.com/libp2p/rust-libp2p/issues/XYZ. @@ -15,7 +15,7 @@ Fixes https://github.com/libp2p/rust-libp2p/issues/XYZ. ## Notes & open questions ## Change checklist diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8b3817a7aa9..f8cff086990 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -67,7 +67,7 @@ jobs: echo "CRATE_VERSION=$CRATE_VERSION" >> $GITHUB_ENV - - name: Enforce version in `workspace.dependencies` matches latest version + - name: Enforce version in `workspace.dependencies` matches the latest version if: env.CRATE != 'libp2p' run: | SPECIFIED_VERSION=$(tq "workspace.dependencies.$CRATE.version" --file ./Cargo.toml) @@ -77,7 +77,7 @@ jobs: test "$CRATE_VERSION" = "$SPECIFIED_VERSION" || test "=$CRATE_VERSION" = "$SPECIFIED_VERSION" - - name: Enforce version in CHANGELOG.md matches version in manifest + - name: Enforce version in CHANGELOG.md matches the version in manifest run: | MANIFEST_PATH=$(cargo metadata --format-version=1 --no-deps | jq -e -r '.packages[] | select(.name == "'"$CRATE"'") | .manifest_path') DIR_TO_CRATE=$(dirname "$MANIFEST_PATH") From 7590ab2de72758f8ae92adc59567191007514831 Mon Sep 17 00:00:00 2001 From: hanabi1224 Date: Tue, 24 Dec 2024 17:14:24 +0800 Subject: [PATCH 03/56] chore(deps): remove unused deps Remove unused dependencies (Not sure how to bump `libp2p-identity` and `libp2p-swarm-derive` versions in a PR) Pull-Request: #5747. --- Cargo.lock | 106 +++--------------- Cargo.toml | 2 + core/Cargo.toml | 5 +- examples/autonat/Cargo.toml | 1 - examples/autonatv2/Cargo.toml | 4 +- examples/chat/Cargo.toml | 2 - examples/dcutr/Cargo.toml | 1 - .../distributed-key-value-store/Cargo.toml | 2 - examples/file-sharing/Cargo.toml | 1 - examples/identify/Cargo.toml | 1 - examples/ipfs-kad/Cargo.toml | 3 - examples/ipfs-private/Cargo.toml | 2 - examples/ping/Cargo.toml | 1 - examples/relay-server/Cargo.toml | 1 - hole-punching-tests/Cargo.toml | 2 +- identity/Cargo.toml | 1 - interop-tests/Cargo.toml | 1 - libp2p/Cargo.toml | 4 +- misc/keygen/Cargo.toml | 1 - misc/memory-connection-limits/Cargo.toml | 2 - misc/multistream-select/Cargo.toml | 1 - misc/server/Cargo.toml | 4 +- misc/server/src/config.rs | 2 +- misc/webrtc-utils/Cargo.toml | 1 - protocols/autonat/Cargo.toml | 3 +- protocols/dcutr/Cargo.toml | 5 - protocols/gossipsub/Cargo.toml | 6 +- protocols/identify/Cargo.toml | 1 - protocols/kad/Cargo.toml | 1 - protocols/mdns/Cargo.toml | 4 - protocols/perf/Cargo.toml | 3 - protocols/ping/Cargo.toml | 2 - protocols/rendezvous/Cargo.toml | 5 - protocols/request-response/Cargo.toml | 5 - swarm-derive/Cargo.toml | 1 - swarm-test/Cargo.toml | 1 - swarm/Cargo.toml | 2 +- transports/noise/Cargo.toml | 2 - transports/plaintext/Cargo.toml | 1 - transports/quic/Cargo.toml | 2 - transports/tcp/Cargo.toml | 2 - transports/tls/Cargo.toml | 1 - transports/webrtc-websys/Cargo.toml | 2 +- transports/webrtc/Cargo.toml | 3 - transports/websocket-websys/Cargo.toml | 1 - wasm-tests/webtransport-tests/Cargo.toml | 2 +- 46 files changed, 31 insertions(+), 175 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 43bcd4c8689..a0303989154 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -102,9 +102,9 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.1" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd" +checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" [[package]] name = "anstyle-parse" @@ -158,12 +158,6 @@ version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" -[[package]] -name = "arrayvec" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" - [[package]] name = "asn1-rs" version = "0.5.2" @@ -543,7 +537,6 @@ dependencies = [ "futures", "libp2p", "tokio", - "tracing", "tracing-subscriber", ] @@ -554,7 +547,6 @@ dependencies = [ "cfg-if", "clap", "libp2p", - "opentelemetry 0.21.0", "opentelemetry-jaeger", "opentelemetry_sdk 0.21.2", "rand 0.8.5", @@ -891,11 +883,9 @@ dependencies = [ name = "chat-example" version = "0.1.0" dependencies = [ - "async-trait", "futures", "libp2p", "tokio", - "tracing", "tracing-subscriber", ] @@ -1268,7 +1258,6 @@ dependencies = [ "futures", "futures-timer", "libp2p", - "log", "tokio", "tracing", "tracing-subscriber", @@ -1378,11 +1367,9 @@ dependencies = [ name = "distributed-key-value-store-example" version = "0.1.0" dependencies = [ - "async-trait", "futures", "libp2p", "tokio", - "tracing", "tracing-subscriber", ] @@ -1479,6 +1466,16 @@ dependencies = [ "syn 2.0.89", ] +[[package]] +name = "env_filter" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f2c92ceda6ceec50f43169f9ee8424fe2db276791afde7b2cd8bc084cb376ab" +dependencies = [ + "log", + "regex", +] + [[package]] name = "env_logger" version = "0.8.4" @@ -1491,15 +1488,15 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.10.2" +version = "0.11.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cd405aab171cb85d6735e5c8d9db038c17d3ca007a4d2c25f337935c3d90580" +checksum = "e13fa619b91fb2381732789fc5de83b45675e882f66623b7d8cb4f643017018d" dependencies = [ + "anstream", + "anstyle", + "env_filter", "humantime", - "is-terminal", "log", - "regex", - "termcolor", ] [[package]] @@ -1597,7 +1594,6 @@ dependencies = [ "libp2p", "serde", "tokio", - "tracing", "tracing-subscriber", ] @@ -2052,7 +2048,7 @@ version = "0.1.0" dependencies = [ "anyhow", "either", - "env_logger 0.10.2", + "env_logger 0.11.5", "futures", "libp2p", "redis", @@ -2353,7 +2349,6 @@ dependencies = [ "futures", "libp2p", "tokio", - "tracing", "tracing-subscriber", ] @@ -2495,7 +2490,6 @@ dependencies = [ "anyhow", "axum", "console_error_panic_hook", - "either", "futures", "futures-timer", "libp2p", @@ -2539,13 +2533,10 @@ name = "ipfs-kad-example" version = "0.1.0" dependencies = [ "anyhow", - "async-trait", "clap", - "env_logger 0.10.2", "futures", "libp2p", "tokio", - "tracing", "tracing-subscriber", ] @@ -2553,12 +2544,10 @@ dependencies = [ name = "ipfs-private-example" version = "0.1.0" dependencies = [ - "async-trait", "either", "futures", "libp2p", "tokio", - "tracing", "tracing-subscriber", ] @@ -2624,7 +2613,6 @@ version = "0.1.0" dependencies = [ "base64 0.22.1", "clap", - "libp2p-core", "libp2p-identity", "serde", "serde_json", @@ -2657,9 +2645,7 @@ name = "libp2p" version = "0.54.2" dependencies = [ "async-std", - "async-trait", "bytes", - "clap", "either", "futures", "futures-timer", @@ -2722,7 +2708,6 @@ version = "0.13.2" dependencies = [ "async-trait", "asynchronous-codec", - "bytes", "either", "futures", "futures-bounded", @@ -2779,11 +2764,8 @@ dependencies = [ "parking_lot", "pin-project", "quick-protobuf", - "quickcheck-ext", "rand 0.8.5", "rw-stream-sink", - "serde", - "smallvec", "thiserror 2.0.3", "tracing", "unsigned-varint 0.8.0", @@ -2795,17 +2777,13 @@ name = "libp2p-dcutr" version = "0.12.1" dependencies = [ "asynchronous-codec", - "clap", "either", "futures", "futures-bounded", "futures-timer", "libp2p-core", - "libp2p-dns", "libp2p-identify", "libp2p-identity", - "libp2p-noise", - "libp2p-ping", "libp2p-plaintext", "libp2p-relay", "libp2p-swarm", @@ -2815,7 +2793,6 @@ dependencies = [ "lru", "quick-protobuf", "quick-protobuf-codec", - "rand 0.8.5", "thiserror 2.0.3", "tokio", "tracing", @@ -2875,14 +2852,11 @@ dependencies = [ "futures", "futures-timer", "getrandom 0.2.15", - "hex", "hex_fmt", "libp2p-core", "libp2p-identity", - "libp2p-noise", "libp2p-swarm", "libp2p-swarm-test", - "libp2p-yamux", "prometheus-client", "quick-protobuf", "quick-protobuf-codec", @@ -2891,7 +2865,6 @@ dependencies = [ "regex", "serde", "sha2 0.10.8", - "smallvec", "tokio", "tracing", "tracing-subscriber", @@ -2912,7 +2885,6 @@ dependencies = [ "libp2p-identity", "libp2p-swarm", "libp2p-swarm-test", - "lru", "quick-protobuf", "quick-protobuf-codec", "smallvec", @@ -2926,7 +2898,6 @@ name = "libp2p-identity" version = "0.2.10" dependencies = [ "asn1_der", - "base64 0.22.1", "bs58", "criterion", "ed25519-dalek", @@ -2953,7 +2924,6 @@ dependencies = [ name = "libp2p-kad" version = "0.47.1" dependencies = [ - "arrayvec", "async-std", "asynchronous-codec", "bytes", @@ -2989,17 +2959,13 @@ version = "0.46.2" dependencies = [ "async-io", "async-std", - "data-encoding", "futures", "hickory-proto", "if-watch", "libp2p-core", "libp2p-identity", - "libp2p-noise", "libp2p-swarm", "libp2p-swarm-test", - "libp2p-tcp", - "libp2p-yamux", "rand 0.8.5", "smallvec", "socket2", @@ -3012,7 +2978,6 @@ dependencies = [ name = "libp2p-memory-connection-limits" version = "0.3.1" dependencies = [ - "async-std", "libp2p-core", "libp2p-identify", "libp2p-identity", @@ -3020,7 +2985,6 @@ dependencies = [ "libp2p-swarm-derive", "libp2p-swarm-test", "memory-stats", - "rand 0.8.5", "sysinfo", "tracing", ] @@ -3085,7 +3049,6 @@ version = "0.45.1" dependencies = [ "asynchronous-codec", "bytes", - "curve25519-dalek", "futures", "futures_ringbuf", "libp2p-core", @@ -3096,7 +3059,6 @@ dependencies = [ "quick-protobuf", "quickcheck-ext", "rand 0.8.5", - "sha2 0.10.8", "snow", "static_assertions", "thiserror 2.0.3", @@ -3117,15 +3079,12 @@ dependencies = [ "futures-timer", "libp2p", "libp2p-core", - "libp2p-dns", "libp2p-identity", - "libp2p-quic", "libp2p-swarm", "libp2p-swarm-test", "libp2p-tcp", "libp2p-tls", "libp2p-yamux", - "rand 0.8.5", "serde", "serde_json", "thiserror 2.0.3", @@ -3139,7 +3098,6 @@ dependencies = [ name = "libp2p-ping" version = "0.45.1" dependencies = [ - "either", "futures", "futures-timer", "libp2p-core", @@ -3150,7 +3108,6 @@ dependencies = [ "rand 0.8.5", "tokio", "tracing", - "tracing-subscriber", "web-time 1.1.0", ] @@ -3167,7 +3124,6 @@ dependencies = [ "quick-protobuf", "quick-protobuf-codec", "quickcheck-ext", - "rand 0.8.5", "tracing", "tracing-subscriber", ] @@ -3198,7 +3154,6 @@ name = "libp2p-quic" version = "0.11.2" dependencies = [ "async-std", - "bytes", "futures", "futures-timer", "if-watch", @@ -3209,7 +3164,6 @@ dependencies = [ "libp2p-tcp", "libp2p-tls", "libp2p-yamux", - "parking_lot", "quickcheck", "quinn", "rand 0.8.5", @@ -3260,15 +3214,10 @@ dependencies = [ "futures", "futures-timer", "libp2p-core", - "libp2p-identify", "libp2p-identity", - "libp2p-noise", - "libp2p-ping", "libp2p-request-response", "libp2p-swarm", "libp2p-swarm-test", - "libp2p-tcp", - "libp2p-yamux", "quick-protobuf", "quick-protobuf-codec", "rand 0.8.5", @@ -3289,22 +3238,17 @@ dependencies = [ "cbor4ii", "futures", "futures-bounded", - "futures-timer", "futures_ringbuf", "libp2p-core", "libp2p-identity", - "libp2p-noise", "libp2p-swarm", "libp2p-swarm-test", - "libp2p-tcp", - "libp2p-yamux", "rand 0.8.5", "serde", "serde_json", "smallvec", "tracing", "tracing-subscriber", - "web-time 1.1.0", ] [[package]] @@ -3315,11 +3259,9 @@ dependencies = [ "base64 0.22.1", "clap", "futures", - "futures-timer", "libp2p", "prometheus-client", "serde", - "serde_derive", "serde_json", "tokio", "tracing", @@ -3381,7 +3323,6 @@ name = "libp2p-swarm-derive" version = "0.35.0" dependencies = [ "heck 0.5.0", - "proc-macro2", "quote", "syn 2.0.89", ] @@ -3399,7 +3340,6 @@ dependencies = [ "libp2p-swarm", "libp2p-tcp", "libp2p-yamux", - "rand 0.8.5", "tracing", ] @@ -3414,7 +3354,6 @@ dependencies = [ "if-watch", "libc", "libp2p-core", - "libp2p-identity", "socket2", "tokio", "tracing", @@ -3427,7 +3366,6 @@ version = "0.5.0" dependencies = [ "futures", "futures-rustls", - "hex", "hex-literal", "libp2p-core", "libp2p-identity", @@ -3473,7 +3411,6 @@ name = "libp2p-webrtc" version = "0.8.0-alpha" dependencies = [ "async-trait", - "bytes", "futures", "futures-timer", "hex", @@ -3486,10 +3423,8 @@ dependencies = [ "quickcheck", "rand 0.8.5", "rcgen", - "serde", "stun 0.6.0", "thiserror 2.0.3", - "tinytemplate", "tokio", "tokio-util", "tracing", @@ -3514,7 +3449,6 @@ dependencies = [ "rand 0.8.5", "serde", "sha2 0.10.8", - "thiserror 2.0.3", "tinytemplate", "tracing", ] @@ -3573,7 +3507,6 @@ dependencies = [ "libp2p-identity", "libp2p-noise", "libp2p-yamux", - "parking_lot", "send_wrapper 0.6.0", "thiserror 2.0.3", "tracing", @@ -3912,7 +3845,6 @@ dependencies = [ "futures_ringbuf", "pin-project", "quickcheck-ext", - "rand 0.8.5", "rw-stream-sink", "smallvec", "tracing", @@ -4463,7 +4395,6 @@ dependencies = [ "futures", "libp2p", "tokio", - "tracing", "tracing-subscriber", ] @@ -4976,7 +4907,6 @@ dependencies = [ "futures", "libp2p", "tokio", - "tracing", "tracing-subscriber", ] diff --git a/Cargo.toml b/Cargo.toml index 7a116949bcc..039281f5346 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -117,9 +117,11 @@ libp2p-yamux = { version = "0.46.0", path = "muxers/yamux" } # External dependencies async-std-resolver = { version = "0.25.0-alpha.4", default-features = false } asynchronous-codec = { version = "0.7.0" } +env_logger = "0.11" futures = "0.3.30" futures-bounded = { version = "0.2.4" } futures-rustls = { version = "0.26.0", default-features = false } +getrandom = "0.2" hickory-proto = { version = "0.25.0-alpha.4", default-features = false } hickory-resolver = { version = "0.25.0-alpha.4", default-features = false } multiaddr = "0.18.1" diff --git a/core/Cargo.toml b/core/Cargo.toml index 8ec0b0fc197..162800b96c2 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -26,8 +26,6 @@ pin-project = "1.1.5" quick-protobuf = "0.8" rand = "0.8" rw-stream-sink = { workspace = true } -serde = { version = "1", optional = true, features = ["derive"] } -smallvec = "1.13.2" thiserror = { workspace = true } tracing = { workspace = true } unsigned-varint = { workspace = true } @@ -37,11 +35,10 @@ async-std = { version = "1.6.2", features = ["attributes"] } libp2p-mplex = { path = "../muxers/mplex" } # Using `path` here because this is a cyclic dev-dependency which otherwise breaks releasing. libp2p-noise = { path = "../transports/noise" } # Using `path` here because this is a cyclic dev-dependency which otherwise breaks releasing. multihash = { workspace = true, features = ["arb"] } -quickcheck = { workspace = true } libp2p-identity = { workspace = true, features = ["ed25519", "rand"] } [features] -serde = ["multihash/serde-codec", "dep:serde", "libp2p-identity/serde"] +serde = ["multihash/serde-codec", "libp2p-identity/serde"] # 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/examples/autonat/Cargo.toml b/examples/autonat/Cargo.toml index 010b76623e0..7c06b48a105 100644 --- a/examples/autonat/Cargo.toml +++ b/examples/autonat/Cargo.toml @@ -13,7 +13,6 @@ tokio = { workspace = true, features = ["full"] } clap = { version = "4.5.6", features = ["derive"] } futures = { workspace = true } libp2p = { path = "../../libp2p", features = ["tokio", "tcp", "noise", "yamux", "autonat", "identify", "macros"] } -tracing = { workspace = true } tracing-subscriber = { workspace = true, features = ["env-filter"] } [lints] diff --git a/examples/autonatv2/Cargo.toml b/examples/autonatv2/Cargo.toml index 6c862ee22e4..67e74d67a22 100644 --- a/examples/autonatv2/Cargo.toml +++ b/examples/autonatv2/Cargo.toml @@ -21,15 +21,13 @@ tokio = { version = "1.35.1", features = ["macros", "rt-multi-thread"] } tracing = "0.1.40" tracing-subscriber = { version = "0.3.18", features = ["env-filter"] } rand = "0.8.5" -opentelemetry = { version = "0.21.0", optional = true } opentelemetry_sdk = { version = "0.21.1", optional = true, features = ["rt-tokio"] } tracing-opentelemetry = { version = "0.22.0", optional = true } opentelemetry-jaeger = { version = "0.20.0", optional = true, features = ["rt-tokio"] } cfg-if = "1.0.0" [features] -jaeger = ["opentelemetry", "opentelemetry_sdk", "tracing-opentelemetry", "opentelemetry-jaeger"] -opentelemetry = ["dep:opentelemetry"] +jaeger = ["opentelemetry_sdk", "tracing-opentelemetry", "opentelemetry-jaeger"] opentelemetry_sdk = ["dep:opentelemetry_sdk"] tracing-opentelemetry = ["dep:tracing-opentelemetry"] opentelemetry-jaeger = ["dep:opentelemetry-jaeger"] diff --git a/examples/chat/Cargo.toml b/examples/chat/Cargo.toml index a1d32956825..031f84b6f95 100644 --- a/examples/chat/Cargo.toml +++ b/examples/chat/Cargo.toml @@ -10,10 +10,8 @@ release = false [dependencies] tokio = { workspace = true, features = ["full"] } -async-trait = "0.1" futures = { workspace = true } libp2p = { path = "../../libp2p", features = [ "tokio", "gossipsub", "mdns", "noise", "macros", "tcp", "yamux", "quic"] } -tracing = { workspace = true } tracing-subscriber = { workspace = true, features = ["env-filter"] } [lints] diff --git a/examples/dcutr/Cargo.toml b/examples/dcutr/Cargo.toml index c1b4bbc6e7e..67edf04e2b0 100644 --- a/examples/dcutr/Cargo.toml +++ b/examples/dcutr/Cargo.toml @@ -13,7 +13,6 @@ clap = { version = "4.5.6", features = ["derive"] } futures = { workspace = true } futures-timer = "3.0" libp2p = { path = "../../libp2p", features = [ "dns", "dcutr", "identify", "macros", "noise", "ping", "quic", "relay", "rendezvous", "tcp", "tokio", "yamux"] } -log = "0.4" tokio = { workspace = true, features = ["macros", "net", "rt", "signal"] } tracing = { workspace = true } tracing-subscriber = { workspace = true, features = ["env-filter"] } diff --git a/examples/distributed-key-value-store/Cargo.toml b/examples/distributed-key-value-store/Cargo.toml index 3846e54c8d3..8e30dd2c75d 100644 --- a/examples/distributed-key-value-store/Cargo.toml +++ b/examples/distributed-key-value-store/Cargo.toml @@ -10,10 +10,8 @@ release = false [dependencies] tokio = { workspace = true, features = ["full"] } -async-trait = "0.1" futures = { workspace = true } libp2p = { path = "../../libp2p", features = [ "tokio", "dns", "kad", "mdns", "noise", "macros", "tcp", "yamux"] } -tracing = { workspace = true } tracing-subscriber = { workspace = true, features = ["env-filter"] } [lints] diff --git a/examples/file-sharing/Cargo.toml b/examples/file-sharing/Cargo.toml index d098ce44317..021215c003b 100644 --- a/examples/file-sharing/Cargo.toml +++ b/examples/file-sharing/Cargo.toml @@ -14,7 +14,6 @@ tokio = { workspace = true, features = ["full"] } clap = { version = "4.5.6", features = ["derive"] } futures = { workspace = true } libp2p = { path = "../../libp2p", features = [ "tokio", "cbor", "dns", "kad", "noise", "macros", "request-response", "tcp", "websocket", "yamux"] } -tracing = { workspace = true } tracing-subscriber = { workspace = true, features = ["env-filter"] } [lints] diff --git a/examples/identify/Cargo.toml b/examples/identify/Cargo.toml index 8d12699afa7..c18f71a0386 100644 --- a/examples/identify/Cargo.toml +++ b/examples/identify/Cargo.toml @@ -12,7 +12,6 @@ release = false tokio = { version = "1.37.0", features = ["full"] } futures = { workspace = true } libp2p = { path = "../../libp2p", features = ["identify", "noise", "tcp", "tokio", "yamux"] } -tracing = { workspace = true } tracing-subscriber = { workspace = true, features = ["env-filter"] } [lints] diff --git a/examples/ipfs-kad/Cargo.toml b/examples/ipfs-kad/Cargo.toml index 115c604269f..fa04da4edcf 100644 --- a/examples/ipfs-kad/Cargo.toml +++ b/examples/ipfs-kad/Cargo.toml @@ -10,13 +10,10 @@ release = false [dependencies] tokio = { workspace = true, features = ["rt-multi-thread", "macros"] } -async-trait = "0.1" clap = { version = "4.5.6", features = ["derive"] } -env_logger = "0.10" futures = { workspace = true } anyhow = "1.0.86" libp2p = { path = "../../libp2p", features = [ "tokio", "dns", "kad", "noise", "tcp", "yamux", "rsa"] } -tracing = { workspace = true } tracing-subscriber = { workspace = true, features = ["env-filter"] } [lints] diff --git a/examples/ipfs-private/Cargo.toml b/examples/ipfs-private/Cargo.toml index 0813dba56e0..4dfe596d609 100644 --- a/examples/ipfs-private/Cargo.toml +++ b/examples/ipfs-private/Cargo.toml @@ -10,11 +10,9 @@ release = false [dependencies] tokio = { workspace = true, features = ["rt-multi-thread", "macros", "io-std"] } -async-trait = "0.1" either = "1.12" futures = { workspace = true } libp2p = { path = "../../libp2p", features = [ "tokio", "gossipsub", "dns", "identify", "kad", "macros", "noise", "ping", "pnet", "tcp", "websocket", "yamux"] } -tracing = { workspace = true } tracing-subscriber = { workspace = true, features = ["env-filter"] } [lints] diff --git a/examples/ping/Cargo.toml b/examples/ping/Cargo.toml index 633f043de56..acc3b2affed 100644 --- a/examples/ping/Cargo.toml +++ b/examples/ping/Cargo.toml @@ -12,7 +12,6 @@ release = false futures = { workspace = true } libp2p = { path = "../../libp2p", features = ["noise", "ping", "tcp", "tokio", "yamux"] } tokio = { workspace = true, features = ["full"] } -tracing = { workspace = true } tracing-subscriber = { workspace = true, features = ["env-filter"] } [lints] diff --git a/examples/relay-server/Cargo.toml b/examples/relay-server/Cargo.toml index 7385cf6c033..3bdaf89b04f 100644 --- a/examples/relay-server/Cargo.toml +++ b/examples/relay-server/Cargo.toml @@ -13,7 +13,6 @@ clap = { version = "4.5.6", features = ["derive"] } tokio = { version = "1.37.0", features = ["full"] } futures = { workspace = true } libp2p = { path = "../../libp2p", features = ["tokio", "noise", "macros", "ping", "tcp", "identify", "yamux", "relay", "quic"] } -tracing = { workspace = true } tracing-subscriber = { workspace = true, features = ["env-filter"] } [lints] diff --git a/hole-punching-tests/Cargo.toml b/hole-punching-tests/Cargo.toml index 79728f9535c..c4f36d2a990 100644 --- a/hole-punching-tests/Cargo.toml +++ b/hole-punching-tests/Cargo.toml @@ -7,7 +7,7 @@ license = "MIT" [dependencies] anyhow = "1" -env_logger = "0.10.2" +env_logger = { workspace = true } futures = { workspace = true } libp2p = { path = "../libp2p", features = ["tokio", "dcutr", "identify", "macros", "noise", "ping", "relay", "tcp", "yamux", "quic"] } tracing = { workspace = true } diff --git a/identity/Cargo.toml b/identity/Cargo.toml index cc41abb3e24..b13229c5826 100644 --- a/identity/Cargo.toml +++ b/identity/Cargo.toml @@ -41,7 +41,6 @@ rand = ["dep:rand", "ed25519-dalek?/rand_core"] [dev-dependencies] quickcheck = { workspace = true } -base64 = "0.22.1" serde_json = "1.0" rmp-serde = "1.3" criterion = "0.5" diff --git a/interop-tests/Cargo.toml b/interop-tests/Cargo.toml index 0eb32bb4975..8f12275668d 100644 --- a/interop-tests/Cargo.toml +++ b/interop-tests/Cargo.toml @@ -13,7 +13,6 @@ crate-type = ["cdylib", "rlib"] [dependencies] anyhow = "1" -either = "1.11.0" futures = { workspace = true } rand = "0.8.5" serde = { version = "1", features = ["derive"] } diff --git a/libp2p/Cargo.toml b/libp2p/Cargo.toml index 3d44e0bc43c..ae23dcf0db5 100644 --- a/libp2p/Cargo.toml +++ b/libp2p/Cargo.toml @@ -94,7 +94,7 @@ bytes = "1" either = "1.9.0" futures = { workspace = true } futures-timer = "3.0.2" # Explicit dependency to be used in `wasm-bindgen` feature -getrandom = "0.2.3" # Explicit dependency to be used in `wasm-bindgen` feature +getrandom = { workspace = true } # Explicit dependency to be used in `wasm-bindgen` feature # TODO feature flag? rw-stream-sink = { workspace = true } @@ -137,8 +137,6 @@ libp2p-websocket = { workspace = true, optional = true } [dev-dependencies] async-std = { version = "1.6.2", features = ["attributes"] } -async-trait = "0.1" -clap = { version = "4.1.6", features = ["derive"] } tokio = { workspace = true, features = [ "io-util", "io-std", "macros", "rt", "rt-multi-thread"] } libp2p-mplex = { workspace = true } diff --git a/misc/keygen/Cargo.toml b/misc/keygen/Cargo.toml index 003993a512c..c5e96553a5c 100644 --- a/misc/keygen/Cargo.toml +++ b/misc/keygen/Cargo.toml @@ -17,7 +17,6 @@ clap = { version = "4.5.6", features = ["derive"] } zeroize = "1" serde = { version = "1.0.203", features = ["derive"] } serde_json = "1.0.117" -libp2p-core = { workspace = true } base64 = "0.22.1" libp2p-identity = { workspace = true } diff --git a/misc/memory-connection-limits/Cargo.toml b/misc/memory-connection-limits/Cargo.toml index 2f6b6ea1544..2d04b6cf2ac 100644 --- a/misc/memory-connection-limits/Cargo.toml +++ b/misc/memory-connection-limits/Cargo.toml @@ -18,11 +18,9 @@ sysinfo = "0.33" tracing = { workspace = true } [dev-dependencies] -async-std = { version = "1.12.0", features = ["attributes"] } libp2p-identify = { workspace = true } libp2p-swarm-derive = { path = "../../swarm-derive" } libp2p-swarm-test = { path = "../../swarm-test" } -rand = "0.8.5" [lints] workspace = true diff --git a/misc/multistream-select/Cargo.toml b/misc/multistream-select/Cargo.toml index 1bbe3642477..d11ad4e2709 100644 --- a/misc/multistream-select/Cargo.toml +++ b/misc/multistream-select/Cargo.toml @@ -22,7 +22,6 @@ unsigned-varint = { workspace = true } async-std = { version = "1.6.2", features = ["attributes"] } futures_ringbuf = "0.4.0" quickcheck = { workspace = true } -rand = "0.8" rw-stream-sink = { workspace = true } tracing-subscriber = { workspace = true, features = ["env-filter"] } diff --git a/misc/server/Cargo.toml b/misc/server/Cargo.toml index 0954e2f38d8..02da0adb9ef 100644 --- a/misc/server/Cargo.toml +++ b/misc/server/Cargo.toml @@ -14,7 +14,6 @@ license = "MIT" base64 = "0.22" clap = { version = "4.5.6", features = ["derive"] } futures = { workspace = true } -futures-timer = "3" axum = "0.7" libp2p = { workspace = true, features = [ "autonat", @@ -34,8 +33,7 @@ libp2p = { workspace = true, features = [ "websocket", ] } prometheus-client = { workspace = true } -serde = "1.0.203" -serde_derive = "1.0.125" +serde = { version = "1", features = ["derive"] } serde_json = "1.0" tokio = { workspace = true, features = ["rt-multi-thread", "macros"] } tracing = { workspace = true } diff --git a/misc/server/src/config.rs b/misc/server/src/config.rs index 2e4b2746d09..8f8c71369b2 100644 --- a/misc/server/src/config.rs +++ b/misc/server/src/config.rs @@ -1,7 +1,7 @@ use std::{error::Error, path::Path}; use libp2p::Multiaddr; -use serde_derive::Deserialize; +use serde::Deserialize; #[derive(Clone, Deserialize)] #[serde(rename_all = "PascalCase")] diff --git a/misc/webrtc-utils/Cargo.toml b/misc/webrtc-utils/Cargo.toml index 287388a49e7..2c50a2f8ab7 100644 --- a/misc/webrtc-utils/Cargo.toml +++ b/misc/webrtc-utils/Cargo.toml @@ -23,7 +23,6 @@ quick-protobuf-codec = { workspace = true } rand = "0.8" serde = { version = "1.0", features = ["derive"] } sha2 = "0.10.8" -thiserror = { workspace = true } tinytemplate = "1.2" tracing = { workspace = true } diff --git a/protocols/autonat/Cargo.toml b/protocols/autonat/Cargo.toml index 88564b18541..8ef6f69d39a 100644 --- a/protocols/autonat/Cargo.toml +++ b/protocols/autonat/Cargo.toml @@ -18,7 +18,6 @@ categories = ["network-programming", "asynchronous"] [dependencies] async-trait = { version = "0.1", optional = true } asynchronous-codec = { workspace = true } -bytes = { version = "1", optional = true } either = { version = "1.9.0", optional = true } futures = { workspace = true } futures-bounded = { workspace = true, optional = true } @@ -45,7 +44,7 @@ libp2p-swarm = { workspace = true, features = ["macros"] } [features] default = ["v1", "v2"] v1 = ["dep:libp2p-request-response", "dep:web-time", "dep:async-trait"] -v2 = ["dep:bytes", "dep:either", "dep:futures-bounded", "dep:thiserror", "dep:rand_core"] +v2 = ["dep:either", "dep:futures-bounded", "dep:thiserror", "dep:rand_core"] # 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/protocols/dcutr/Cargo.toml b/protocols/dcutr/Cargo.toml index a47f5400488..31acb42f2af 100644 --- a/protocols/dcutr/Cargo.toml +++ b/protocols/dcutr/Cargo.toml @@ -27,18 +27,13 @@ lru = "0.12.3" futures-bounded = { workspace = true } [dev-dependencies] -clap = { version = "4.5.6", features = ["derive"] } -libp2p-dns = { workspace = true, features = ["async-std"] } libp2p-identify = { workspace = true } -libp2p-noise = { workspace = true } -libp2p-ping = { workspace = true } libp2p-plaintext = { workspace = true } libp2p-relay = { workspace = true } libp2p-swarm = { workspace = true, features = ["macros"] } libp2p-swarm-test = { path = "../../swarm-test" } libp2p-tcp = { workspace = true, features = ["async-io"] } libp2p-yamux = { workspace = true } -rand = "0.8" tracing-subscriber = { workspace = true, features = ["env-filter"] } tokio = { workspace = true, features = ["rt", "macros"] } diff --git a/protocols/gossipsub/Cargo.toml b/protocols/gossipsub/Cargo.toml index c09286c8aa0..d48993b331e 100644 --- a/protocols/gossipsub/Cargo.toml +++ b/protocols/gossipsub/Cargo.toml @@ -23,7 +23,7 @@ either = "1.11" fnv = "1.0.7" futures = { workspace = true } futures-timer = "3.0.2" -getrandom = "0.2.15" +getrandom = { workspace = true } hex_fmt = "0.3.0" web-time = { workspace = true } libp2p-core = { workspace = true } @@ -35,17 +35,13 @@ rand = "0.8" regex = "1.10.5" serde = { version = "1", optional = true, features = ["derive"] } sha2 = "0.10.8" -smallvec = "1.13.2" tracing = { workspace = true } # Metrics dependencies prometheus-client = { workspace = true } [dev-dependencies] -hex = "0.4.2" libp2p-core = { workspace = true } -libp2p-yamux = { workspace = true } -libp2p-noise = { workspace = true } libp2p-swarm-test = { path = "../../swarm-test" } quickcheck = { workspace = true } tracing-subscriber = { workspace = true, features = ["env-filter"] } diff --git a/protocols/identify/Cargo.toml b/protocols/identify/Cargo.toml index d2aeb74e626..e5bb445b7a5 100644 --- a/protocols/identify/Cargo.toml +++ b/protocols/identify/Cargo.toml @@ -18,7 +18,6 @@ futures-bounded = { workspace = true } libp2p-core = { workspace = true } libp2p-swarm = { workspace = true } libp2p-identity = { workspace = true } -lru = "0.12.3" quick-protobuf-codec = { workspace = true } quick-protobuf = "0.8" smallvec = "1.13.2" diff --git a/protocols/kad/Cargo.toml b/protocols/kad/Cargo.toml index dd93da2a01a..a9bc1a9a640 100644 --- a/protocols/kad/Cargo.toml +++ b/protocols/kad/Cargo.toml @@ -11,7 +11,6 @@ keywords = ["peer-to-peer", "libp2p", "networking"] categories = ["network-programming", "asynchronous"] [dependencies] -arrayvec = "0.7.4" bytes = "1" either = "1.11" fnv = "1.0" diff --git a/protocols/mdns/Cargo.toml b/protocols/mdns/Cargo.toml index 618d41e9b9d..2348252dc57 100644 --- a/protocols/mdns/Cargo.toml +++ b/protocols/mdns/Cargo.toml @@ -13,7 +13,6 @@ categories = ["network-programming", "asynchronous"] [dependencies] async-std = { version = "1.12.0", optional = true } async-io = { version = "2.3.3", optional = true } -data-encoding = "2.6.0" futures = { workspace = true } if-watch = "3.2.0" libp2p-core = { workspace = true } @@ -32,10 +31,7 @@ async-io = ["dep:async-io", "dep:async-std", "if-watch/smol"] [dev-dependencies] async-std = { version = "1.9.0", features = ["attributes"] } -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 = { workspace = true, features = ["macros", "rt", "rt-multi-thread", "time"] } libp2p-swarm-test = { path = "../../swarm-test" } tracing-subscriber = { workspace = true, features = ["env-filter"] } diff --git a/protocols/perf/Cargo.toml b/protocols/perf/Cargo.toml index cd499a8c949..645abc9bcfb 100644 --- a/protocols/perf/Cargo.toml +++ b/protocols/perf/Cargo.toml @@ -19,9 +19,7 @@ futures-timer = "3.0" web-time = { workspace = true } libp2p = { workspace = true, features = ["tokio", "tcp", "quic", "tls", "yamux", "dns"] } libp2p-core = { workspace = true } -libp2p-dns = { workspace = true, features = ["tokio"] } libp2p-identity = { workspace = true, features = ["rand"] } -libp2p-quic = { workspace = true, features = ["tokio"] } libp2p-swarm = { workspace = true, features = ["macros", "tokio"] } libp2p-tcp = { workspace = true, features = ["tokio"] } libp2p-tls = { workspace = true } @@ -34,7 +32,6 @@ tracing-subscriber = { workspace = true, features = ["env-filter"] } tokio = { workspace = true, features = ["macros", "rt", "rt-multi-thread"] } [dev-dependencies] -rand = "0.8" libp2p-swarm-test = { path = "../../swarm-test" } # Passing arguments to the docsrs builder in order to properly document cfg's. diff --git a/protocols/ping/Cargo.toml b/protocols/ping/Cargo.toml index 0fad9678aec..83f3b6460c9 100644 --- a/protocols/ping/Cargo.toml +++ b/protocols/ping/Cargo.toml @@ -11,7 +11,6 @@ keywords = ["peer-to-peer", "libp2p", "networking"] categories = ["network-programming", "asynchronous"] [dependencies] -either = "1.11.0" futures = { workspace = true } futures-timer = "3.0.3" web-time = { workspace = true } @@ -25,7 +24,6 @@ tracing = { workspace = true } libp2p-swarm = { workspace = true, features = ["macros"] } libp2p-swarm-test = { path = "../../swarm-test" } quickcheck = { workspace = true } -tracing-subscriber = { workspace = true, features = ["env-filter"] } tokio = {workspace = true, features = ["rt", "macros"]} # Passing arguments to the docsrs builder in order to properly document cfg's. diff --git a/protocols/rendezvous/Cargo.toml b/protocols/rendezvous/Cargo.toml index 53a579918c5..9521913cd30 100644 --- a/protocols/rendezvous/Cargo.toml +++ b/protocols/rendezvous/Cargo.toml @@ -29,12 +29,7 @@ tracing = { workspace = true } [dev-dependencies] libp2p-swarm = { workspace = true, features = ["macros", "tokio"] } -libp2p-noise = { workspace = true } -libp2p-ping = { workspace = true } -libp2p-identify = { workspace = true } libp2p-swarm-test = { path = "../../swarm-test" } -libp2p-tcp = { workspace = true, features = ["tokio"] } -libp2p-yamux = { workspace = true } rand = "0.8" tokio = { workspace = true, features = [ "rt-multi-thread", "time", "macros", "sync", "process", "fs", "net" ] } tracing-subscriber = { workspace = true, features = ["env-filter"] } diff --git a/protocols/request-response/Cargo.toml b/protocols/request-response/Cargo.toml index 48ef4c2c066..5cd711dd051 100644 --- a/protocols/request-response/Cargo.toml +++ b/protocols/request-response/Cargo.toml @@ -14,7 +14,6 @@ categories = ["network-programming", "asynchronous"] async-trait = "0.1" cbor4ii = { version = "0.3.2", features = ["serde1", "use_std"], optional = true } futures = { workspace = true } -web-time = { workspace = true } libp2p-core = { workspace = true } libp2p-swarm = { workspace = true } libp2p-identity = { workspace = true } @@ -23,7 +22,6 @@ serde = { version = "1.0", optional = true} serde_json = { version = "1.0.117", optional = true } smallvec = "1.13.2" tracing = { workspace = true } -futures-timer = "3.0.3" futures-bounded = { workspace = true } [features] @@ -33,9 +31,6 @@ cbor = ["dep:serde", "dep:cbor4ii", "libp2p-swarm/macros"] [dev-dependencies] anyhow = "1.0.86" async-std = { version = "1.6.2", features = ["attributes"] } -libp2p-noise = { workspace = true } -libp2p-tcp = { workspace = true, features = ["async-io"] } -libp2p-yamux = { workspace = true } rand = "0.8" libp2p-swarm-test = { path = "../../swarm-test" } futures_ringbuf = "0.4.0" diff --git a/swarm-derive/Cargo.toml b/swarm-derive/Cargo.toml index 91c643a459d..febd2a6455a 100644 --- a/swarm-derive/Cargo.toml +++ b/swarm-derive/Cargo.toml @@ -17,7 +17,6 @@ proc-macro = true heck = "0.5" quote = "1.0" syn = { version = "2.0.66", default-features = false, features = ["clone-impls", "derive", "parsing", "printing", "proc-macro"] } -proc-macro2 = "1.0" # 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/swarm-test/Cargo.toml b/swarm-test/Cargo.toml index 7ac7c900deb..4a0d5ee8c71 100644 --- a/swarm-test/Cargo.toml +++ b/swarm-test/Cargo.toml @@ -20,7 +20,6 @@ libp2p-swarm = { workspace = true } libp2p-tcp = { workspace = true } libp2p-yamux = { workspace = true } futures = { workspace = true } -rand = "0.8.5" tracing = { workspace = true } futures-timer = "3.0.3" diff --git a/swarm/Cargo.toml b/swarm/Cargo.toml index 4c3b8821ed6..cf027d96ec0 100644 --- a/swarm/Cargo.toml +++ b/swarm/Cargo.toml @@ -15,7 +15,7 @@ either = "1.11.0" fnv = "1.0" futures = { workspace = true } futures-timer = "3.0.3" -getrandom = { version = "0.2.15", features = ["js"], optional = true } # Explicit dependency to be used in `wasm-bindgen` feature +getrandom = { workspace = true, features = ["js"], optional = true } # Explicit dependency to be used in `wasm-bindgen` feature web-time = { workspace = true } libp2p-core = { workspace = true } libp2p-identity = { workspace = true } diff --git a/transports/noise/Cargo.toml b/transports/noise/Cargo.toml index 8824adcc50c..d0e2f9004ce 100644 --- a/transports/noise/Cargo.toml +++ b/transports/noise/Cargo.toml @@ -11,7 +11,6 @@ repository = "https://github.com/libp2p/rust-libp2p" [dependencies] asynchronous-codec = { workspace = true } bytes = "1" -curve25519-dalek = "4.1.2" futures = { workspace = true } libp2p-core = { workspace = true } libp2p-identity = { workspace = true, features = ["ed25519"] } @@ -20,7 +19,6 @@ multihash = { workspace = true } once_cell = "1.19.0" quick-protobuf = "0.8" rand = "0.8.3" -sha2 = "0.10.8" static_assertions = "1" thiserror = { workspace = true } tracing = { workspace = true } diff --git a/transports/plaintext/Cargo.toml b/transports/plaintext/Cargo.toml index 47a3191baa9..9e1e5449158 100644 --- a/transports/plaintext/Cargo.toml +++ b/transports/plaintext/Cargo.toml @@ -23,7 +23,6 @@ quick-protobuf-codec = { workspace = true } [dev-dependencies] libp2p-identity = { workspace = true, features = ["ed25519", "rand"] } quickcheck = { workspace = true } -rand = "0.8" futures_ringbuf = "0.4.0" tracing-subscriber = { workspace = true, features = ["env-filter"] } diff --git a/transports/quic/Cargo.toml b/transports/quic/Cargo.toml index 17d5014b974..5d709e122d2 100644 --- a/transports/quic/Cargo.toml +++ b/transports/quic/Cargo.toml @@ -10,14 +10,12 @@ license = "MIT" [dependencies] async-std = { version = "1.12.0", optional = true } -bytes = "1.6.0" futures = { workspace = true } futures-timer = "3.0.3" if-watch = "3.2.0" libp2p-core = { workspace = true } libp2p-tls = { workspace = true } libp2p-identity = { workspace = true } -parking_lot = "0.12.3" quinn = { version = "0.11.2", default-features = false, features = ["rustls", "futures-io"] } rand = "0.8.5" rustls = { version = "0.23.9", default-features = false } diff --git a/transports/tcp/Cargo.toml b/transports/tcp/Cargo.toml index 03e7fac491c..baa3b2f46dd 100644 --- a/transports/tcp/Cargo.toml +++ b/transports/tcp/Cargo.toml @@ -17,7 +17,6 @@ futures-timer = "3.0" if-watch = "3.2.0" libc = "0.2.155" libp2p-core = { workspace = true } -libp2p-identity = { workspace = true } socket2 = { version = "0.5.7", features = ["all"] } tokio = { workspace = true, default-features = false, features = ["net"], optional = true } tracing = { workspace = true } @@ -28,7 +27,6 @@ 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 = { workspace = true, features = ["full"] } tracing-subscriber = { workspace = true, features = ["env-filter"] } diff --git a/transports/tls/Cargo.toml b/transports/tls/Cargo.toml index fce76e2aa79..7702a4361b1 100644 --- a/transports/tls/Cargo.toml +++ b/transports/tls/Cargo.toml @@ -28,7 +28,6 @@ features = ["ring", "std"] # Must enable this to allow for custom verification c [dev-dependencies] -hex = "0.4.3" hex-literal = "0.4.1" libp2p-core = { workspace = true } libp2p-identity = { workspace = true, features = ["ed25519", "rsa", "secp256k1", "ecdsa", "rand"] } diff --git a/transports/webrtc-websys/Cargo.toml b/transports/webrtc-websys/Cargo.toml index 4663913c849..6d42d74f610 100644 --- a/transports/webrtc-websys/Cargo.toml +++ b/transports/webrtc-websys/Cargo.toml @@ -14,7 +14,7 @@ publish = true [dependencies] bytes = "1" futures = { workspace = true } -getrandom = { version = "0.2.15", features = ["js"] } +getrandom = { workspace = true, features = ["js"] } hex = "0.4.3" js-sys = { version = "0.3" } libp2p-core = { workspace = true } diff --git a/transports/webrtc/Cargo.toml b/transports/webrtc/Cargo.toml index 4197a9419d8..f3d2e57147e 100644 --- a/transports/webrtc/Cargo.toml +++ b/transports/webrtc/Cargo.toml @@ -12,7 +12,6 @@ categories = ["network-programming", "asynchronous"] [dependencies] async-trait = "0.1" -bytes = "1" futures = { workspace = true } futures-timer = "3" hex = "0.4" @@ -24,10 +23,8 @@ libp2p-webrtc-utils = { workspace = true } multihash = { workspace = true } rand = "0.8" rcgen = { workspace = true } -serde = { version = "1.0", features = ["derive"] } stun = "0.6" thiserror = { workspace = true } -tinytemplate = "1.2" tokio = { workspace = true, features = ["net"], optional = true } tokio-util = { version = "0.7", features = ["compat"], optional = true } tracing = { workspace = true } diff --git a/transports/websocket-websys/Cargo.toml b/transports/websocket-websys/Cargo.toml index 1e604ba0478..f33703c1884 100644 --- a/transports/websocket-websys/Cargo.toml +++ b/transports/websocket-websys/Cargo.toml @@ -16,7 +16,6 @@ futures = { workspace = true } js-sys = "0.3.69" libp2p-core = { workspace = true } tracing = { workspace = true } -parking_lot = "0.12.3" send_wrapper = "0.6.0" thiserror = { workspace = true } wasm-bindgen = "0.2.90" diff --git a/wasm-tests/webtransport-tests/Cargo.toml b/wasm-tests/webtransport-tests/Cargo.toml index d7db378ab1a..593743d1617 100644 --- a/wasm-tests/webtransport-tests/Cargo.toml +++ b/wasm-tests/webtransport-tests/Cargo.toml @@ -10,7 +10,7 @@ release = false [dependencies] futures = { workspace = true } -getrandom = { version = "0.2.15", features = ["js"] } +getrandom = { workspace = true, features = ["js"] } libp2p-core = { workspace = true } libp2p-identity = { workspace = true, features = ["rand"] } libp2p-noise = { workspace = true } From c40338d7d1ec01e151ada22d4c050e729d44fa72 Mon Sep 17 00:00:00 2001 From: Elena Frank Date: Tue, 24 Dec 2024 19:22:53 +0700 Subject: [PATCH 04/56] chore(mdns): revert version bump Revert version bump of #5753, because libp2p-mdns-0.46.1 isn't released yet. Pull-Request: #5762. --- Cargo.lock | 2 +- Cargo.toml | 2 +- protocols/mdns/CHANGELOG.md | 5 +---- protocols/mdns/Cargo.toml | 2 +- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a0303989154..f8988953e9e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2955,7 +2955,7 @@ dependencies = [ [[package]] name = "libp2p-mdns" -version = "0.46.2" +version = "0.46.1" dependencies = [ "async-io", "async-std", diff --git a/Cargo.toml b/Cargo.toml index 039281f5346..4e0652ce3d0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -84,7 +84,7 @@ libp2p-gossipsub = { version = "0.48.0", path = "protocols/gossipsub" } libp2p-identify = { version = "0.46.1", path = "protocols/identify" } libp2p-identity = { version = "0.2.10" } libp2p-kad = { version = "0.47.1", path = "protocols/kad" } -libp2p-mdns = { version = "0.46.2", path = "protocols/mdns" } +libp2p-mdns = { version = "0.46.1", path = "protocols/mdns" } libp2p-memory-connection-limits = { version = "0.3.1", path = "misc/memory-connection-limits" } libp2p-metrics = { version = "0.15.0", path = "misc/metrics" } libp2p-mplex = { version = "0.42.0", path = "muxers/mplex" } diff --git a/protocols/mdns/CHANGELOG.md b/protocols/mdns/CHANGELOG.md index 98dc3d55454..45a479bf4af 100644 --- a/protocols/mdns/CHANGELOG.md +++ b/protocols/mdns/CHANGELOG.md @@ -1,10 +1,7 @@ -## 0.46.2 +## 0.46.1 - Emit `ToSwarm::NewExternalAddrOfPeer` on discovery. See [PR 5753](https://github.com/libp2p/rust-libp2p/pull/5753) - -## 0.46.1 - - Upgrade `hickory-proto`. See [PR 5727](https://github.com/libp2p/rust-libp2p/pull/5727) diff --git a/protocols/mdns/Cargo.toml b/protocols/mdns/Cargo.toml index 2348252dc57..89d53c98a70 100644 --- a/protocols/mdns/Cargo.toml +++ b/protocols/mdns/Cargo.toml @@ -2,7 +2,7 @@ name = "libp2p-mdns" edition = "2021" rust-version = { workspace = true } -version = "0.46.2" +version = "0.46.1" description = "Implementation of the libp2p mDNS discovery method" authors = ["Parity Technologies "] license = "MIT" From 69cf073f7f2918591fb7c54e1320d1f02a49f262 Mon Sep 17 00:00:00 2001 From: Dzmitry Kalabuk Date: Wed, 25 Dec 2024 09:07:53 +0300 Subject: [PATCH 05/56] deps(quic): update quinn to 0.11.6 Among other changes, it includes a fix for this issue which often reproduces with libp2p: https://github.com/quinn-rs/quinn/issues/1889 Pull-Request: #5757. --- Cargo.lock | 40 +++++++++++++++++++++++--------------- transports/quic/Cargo.toml | 2 +- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f8988953e9e..308c3c45e5c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -855,6 +855,12 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + [[package]] name = "chacha20" version = "0.9.1" @@ -4637,9 +4643,9 @@ dependencies = [ [[package]] name = "quinn" -version = "0.11.2" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4ceeeeabace7857413798eb1ffa1e9c905a9946a57d81fb69b4b71c4d8eb3ad" +checksum = "62e96808277ec6f97351a2380e6c25114bc9e67037775464979f3037c92d05ef" dependencies = [ "async-io", "async-std", @@ -4648,36 +4654,41 @@ dependencies = [ "pin-project-lite", "quinn-proto", "quinn-udp", - "rustc-hash 1.1.0", + "rustc-hash", "rustls 0.23.11", - "thiserror 1.0.63", + "socket2", + "thiserror 2.0.3", "tokio", "tracing", ] [[package]] name = "quinn-proto" -version = "0.11.8" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fadfaed2cd7f389d0161bb73eeb07b7b78f8691047a6f3e73caaeae55310a4a6" +checksum = "a2fe5ef3495d7d2e377ff17b1a8ce2ee2ec2a18cde8b6ad6619d65d0701c135d" dependencies = [ "bytes", + "getrandom 0.2.15", "rand 0.8.5", "ring 0.17.8", - "rustc-hash 2.0.0", + "rustc-hash", "rustls 0.23.11", + "rustls-pki-types", "slab", - "thiserror 1.0.63", + "thiserror 2.0.3", "tinyvec", "tracing", + "web-time 1.1.0", ] [[package]] name = "quinn-udp" -version = "0.5.0" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7ad7bc932e4968523fa7d9c320ee135ff779de720e9350fee8728838551764" +checksum = "1c40286217b4ba3a71d644d752e6a0b71f13f1b6a2c5311acfcbe0c2418ed904" dependencies = [ + "cfg_aliases", "libc", "once_cell", "socket2", @@ -5134,12 +5145,6 @@ version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - [[package]] name = "rustc-hash" version = "2.0.0" @@ -5232,6 +5237,9 @@ name = "rustls-pki-types" version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" +dependencies = [ + "web-time 1.1.0", +] [[package]] name = "rustls-webpki" diff --git a/transports/quic/Cargo.toml b/transports/quic/Cargo.toml index 5d709e122d2..bff0a024bd4 100644 --- a/transports/quic/Cargo.toml +++ b/transports/quic/Cargo.toml @@ -16,7 +16,7 @@ if-watch = "3.2.0" libp2p-core = { workspace = true } libp2p-tls = { workspace = true } libp2p-identity = { workspace = true } -quinn = { version = "0.11.2", default-features = false, features = ["rustls", "futures-io"] } +quinn = { version = "0.11.6", default-features = false, features = ["rustls", "futures-io"] } rand = "0.8.5" rustls = { version = "0.23.9", default-features = false } thiserror = { workspace = true } From 644d7d06269b095090b3cfb8abbec8a8692f6062 Mon Sep 17 00:00:00 2001 From: Krishang Shah <93703995+kamuik16@users.noreply.github.com> Date: Fri, 27 Dec 2024 05:00:44 +0530 Subject: [PATCH 06/56] chore: introduce `libp2p-test-utils` Fixes #4992 Based on the conversation in #4992. Pull-Request: #5725. --- Cargo.lock | 60 +++++++++++-------- Cargo.toml | 6 +- examples/autonatv2/Cargo.toml | 2 +- misc/multistream-select/Cargo.toml | 2 +- misc/multistream-select/src/dialer_select.rs | 14 ++--- misc/test-utils/CHANGELOG.md | 4 ++ misc/test-utils/Cargo.toml | 17 ++++++ misc/test-utils/src/lib.rs | 15 +++++ muxers/mplex/Cargo.toml | 2 +- muxers/mplex/benches/split_send_size.rs | 5 +- muxers/mplex/src/io.rs | 10 +--- protocols/autonat/Cargo.toml | 2 +- protocols/autonat/tests/autonatv2.rs | 17 ++---- protocols/dcutr/Cargo.toml | 2 +- protocols/dcutr/tests/lib.rs | 5 +- protocols/gossipsub/Cargo.toml | 2 +- protocols/gossipsub/src/behaviour/tests.rs | 5 +- protocols/gossipsub/tests/smoke.rs | 5 +- protocols/identify/Cargo.toml | 2 +- protocols/identify/tests/smoke.rs | 33 +++------- protocols/kad/Cargo.toml | 2 +- protocols/kad/src/behaviour/test.rs | 4 +- protocols/kad/src/handler.rs | 5 +- protocols/kad/tests/client_mode.rs | 17 ++---- protocols/mdns/Cargo.toml | 2 +- protocols/mdns/tests/use-async-std.rs | 17 ++---- protocols/mdns/tests/use-tokio.rs | 13 +--- protocols/perf/Cargo.toml | 1 + protocols/perf/tests/lib.rs | 5 +- protocols/relay/Cargo.toml | 3 +- protocols/relay/tests/lib.rs | 29 +++------ protocols/rendezvous/Cargo.toml | 2 +- protocols/rendezvous/tests/rendezvous.rs | 37 +++--------- protocols/request-response/Cargo.toml | 2 +- .../request-response/tests/error_reporting.rs | 30 +++------- .../request-response/tests/peer_address.rs | 5 +- protocols/request-response/tests/ping.rs | 5 +- protocols/stream/Cargo.toml | 2 +- protocols/stream/tests/lib.rs | 17 +++--- rustfmt.toml | 2 +- swarm/Cargo.toml | 2 +- swarm/src/connection.rs | 13 +--- swarm/src/lib.rs | 4 +- transports/dns/Cargo.toml | 2 +- transports/dns/src/lib.rs | 4 +- transports/noise/Cargo.toml | 2 +- transports/noise/tests/smoke.rs | 5 +- transports/plaintext/Cargo.toml | 2 +- transports/plaintext/tests/smoke.rs | 5 +- transports/quic/Cargo.toml | 2 +- transports/quic/tests/smoke.rs | 41 ++++--------- transports/tcp/Cargo.toml | 2 +- transports/tcp/src/lib.rs | 28 +++------ transports/webrtc/Cargo.toml | 3 +- transports/webrtc/tests/smoke.rs | 9 +-- 55 files changed, 192 insertions(+), 342 deletions(-) create mode 100644 misc/test-utils/CHANGELOG.md create mode 100644 misc/test-utils/Cargo.toml create mode 100644 misc/test-utils/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 308c3c45e5c..7a5497c5701 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2724,6 +2724,7 @@ dependencies = [ "libp2p-request-response", "libp2p-swarm", "libp2p-swarm-test", + "libp2p-test-utils", "quick-protobuf", "quick-protobuf-codec", "rand 0.8.5", @@ -2731,7 +2732,6 @@ dependencies = [ "thiserror 2.0.3", "tokio", "tracing", - "tracing-subscriber", "web-time 1.1.0", ] @@ -2795,6 +2795,7 @@ dependencies = [ "libp2p-swarm", "libp2p-swarm-test", "libp2p-tcp", + "libp2p-test-utils", "libp2p-yamux", "lru", "quick-protobuf", @@ -2802,7 +2803,6 @@ dependencies = [ "thiserror 2.0.3", "tokio", "tracing", - "tracing-subscriber", "web-time 1.1.0", ] @@ -2817,11 +2817,11 @@ dependencies = [ "hickory-resolver", "libp2p-core", "libp2p-identity", + "libp2p-test-utils", "parking_lot", "smallvec", "tokio", "tracing", - "tracing-subscriber", ] [[package]] @@ -2863,6 +2863,7 @@ dependencies = [ "libp2p-identity", "libp2p-swarm", "libp2p-swarm-test", + "libp2p-test-utils", "prometheus-client", "quick-protobuf", "quick-protobuf-codec", @@ -2873,7 +2874,6 @@ dependencies = [ "sha2 0.10.8", "tokio", "tracing", - "tracing-subscriber", "web-time 1.1.0", ] @@ -2891,12 +2891,12 @@ dependencies = [ "libp2p-identity", "libp2p-swarm", "libp2p-swarm-test", + "libp2p-test-utils", "quick-protobuf", "quick-protobuf-codec", "smallvec", "thiserror 2.0.3", "tracing", - "tracing-subscriber", ] [[package]] @@ -2944,6 +2944,7 @@ dependencies = [ "libp2p-noise", "libp2p-swarm", "libp2p-swarm-test", + "libp2p-test-utils", "libp2p-yamux", "quick-protobuf", "quick-protobuf-codec", @@ -2954,7 +2955,6 @@ dependencies = [ "smallvec", "thiserror 2.0.3", "tracing", - "tracing-subscriber", "uint", "web-time 1.1.0", ] @@ -2972,12 +2972,12 @@ dependencies = [ "libp2p-identity", "libp2p-swarm", "libp2p-swarm-test", + "libp2p-test-utils", "rand 0.8.5", "smallvec", "socket2", "tokio", "tracing", - "tracing-subscriber", ] [[package]] @@ -3028,13 +3028,13 @@ dependencies = [ "libp2p-muxer-test-harness", "libp2p-plaintext", "libp2p-tcp", + "libp2p-test-utils", "nohash-hasher", "parking_lot", "quickcheck-ext", "rand 0.8.5", "smallvec", "tracing", - "tracing-subscriber", "unsigned-varint 0.8.0", ] @@ -3059,6 +3059,7 @@ dependencies = [ "futures_ringbuf", "libp2p-core", "libp2p-identity", + "libp2p-test-utils", "multiaddr", "multihash", "once_cell", @@ -3069,7 +3070,6 @@ dependencies = [ "static_assertions", "thiserror 2.0.3", "tracing", - "tracing-subscriber", "x25519-dalek", "zeroize", ] @@ -3089,6 +3089,7 @@ dependencies = [ "libp2p-swarm", "libp2p-swarm-test", "libp2p-tcp", + "libp2p-test-utils", "libp2p-tls", "libp2p-yamux", "serde", @@ -3127,11 +3128,11 @@ dependencies = [ "futures_ringbuf", "libp2p-core", "libp2p-identity", + "libp2p-test-utils", "quick-protobuf", "quick-protobuf-codec", "quickcheck-ext", "tracing", - "tracing-subscriber", ] [[package]] @@ -3168,6 +3169,7 @@ dependencies = [ "libp2p-muxer-test-harness", "libp2p-noise", "libp2p-tcp", + "libp2p-test-utils", "libp2p-tls", "libp2p-yamux", "quickcheck", @@ -3179,7 +3181,6 @@ dependencies = [ "thiserror 2.0.3", "tokio", "tracing", - "tracing-subscriber", ] [[package]] @@ -3198,6 +3199,7 @@ dependencies = [ "libp2p-plaintext", "libp2p-swarm", "libp2p-swarm-test", + "libp2p-test-utils", "libp2p-yamux", "quick-protobuf", "quick-protobuf-codec", @@ -3206,7 +3208,6 @@ dependencies = [ "static_assertions", "thiserror 2.0.3", "tracing", - "tracing-subscriber", "web-time 1.1.0", ] @@ -3224,13 +3225,13 @@ dependencies = [ "libp2p-request-response", "libp2p-swarm", "libp2p-swarm-test", + "libp2p-test-utils", "quick-protobuf", "quick-protobuf-codec", "rand 0.8.5", "thiserror 2.0.3", "tokio", "tracing", - "tracing-subscriber", "web-time 1.1.0", ] @@ -3249,12 +3250,12 @@ dependencies = [ "libp2p-identity", "libp2p-swarm", "libp2p-swarm-test", + "libp2p-test-utils", "rand 0.8.5", "serde", "serde_json", "smallvec", "tracing", - "tracing-subscriber", ] [[package]] @@ -3284,10 +3285,10 @@ dependencies = [ "libp2p-identity", "libp2p-swarm", "libp2p-swarm-test", + "libp2p-test-utils", "rand 0.8.5", "tokio", "tracing", - "tracing-subscriber", ] [[package]] @@ -3309,6 +3310,7 @@ dependencies = [ "libp2p-plaintext", "libp2p-swarm-derive", "libp2p-swarm-test", + "libp2p-test-utils", "libp2p-yamux", "lru", "multistream-select", @@ -3318,7 +3320,6 @@ dependencies = [ "smallvec", "tokio", "tracing", - "tracing-subscriber", "trybuild", "wasm-bindgen-futures", "web-time 1.1.0", @@ -3360,9 +3361,16 @@ dependencies = [ "if-watch", "libc", "libp2p-core", + "libp2p-test-utils", "socket2", "tokio", "tracing", +] + +[[package]] +name = "libp2p-test-utils" +version = "0.1.0" +dependencies = [ "tracing-subscriber", ] @@ -3424,6 +3432,7 @@ dependencies = [ "libp2p-core", "libp2p-identity", "libp2p-noise", + "libp2p-test-utils", "libp2p-webrtc-utils", "multihash", "quickcheck", @@ -3434,7 +3443,6 @@ dependencies = [ "tokio", "tokio-util", "tracing", - "tracing-subscriber", "webrtc", ] @@ -3849,12 +3857,12 @@ dependencies = [ "bytes", "futures", "futures_ringbuf", + "libp2p-test-utils", "pin-project", "quickcheck-ext", "rw-stream-sink", "smallvec", "tracing", - "tracing-subscriber", "unsigned-varint 0.8.0", ] @@ -6293,9 +6301,9 @@ checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" -version = "0.1.40" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ "log", "pin-project-lite", @@ -6305,9 +6313,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.27" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", @@ -6316,9 +6324,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.32" +version = "0.1.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" dependencies = [ "once_cell", "valuable", @@ -6373,9 +6381,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" dependencies = [ "matchers", "nu-ansi-term", diff --git a/Cargo.toml b/Cargo.toml index 4e0652ce3d0..1819e68edf4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,6 +30,7 @@ members = [ "misc/quickcheck-ext", "misc/rw-stream-sink", "misc/server", + "misc/test-utils", "misc/webrtc-utils", "muxers/mplex", "muxers/test-harness", @@ -113,6 +114,7 @@ libp2p-websocket = { version = "0.44.1", path = "transports/websocket" } libp2p-websocket-websys = { version = "0.4.1", path = "transports/websocket-websys" } libp2p-webtransport-websys = { version = "0.4.1", path = "transports/webtransport-websys" } libp2p-yamux = { version = "0.46.0", path = "muxers/yamux" } +libp2p-test-utils = { version = "0.1.0", path = "misc/test-utils" } # External dependencies async-std-resolver = { version = "0.25.0-alpha.4", default-features = false } @@ -135,8 +137,8 @@ ring = "0.17.8" rw-stream-sink = { version = "0.4.0", path = "misc/rw-stream-sink" } thiserror = "2" tokio = { version = "1.38", default-features = false } -tracing = "0.1.37" -tracing-subscriber = "0.3" +tracing = "0.1.41" +tracing-subscriber = "0.3.19" unsigned-varint = { version = "0.8.0" } web-time = "1.1.0" diff --git a/examples/autonatv2/Cargo.toml b/examples/autonatv2/Cargo.toml index 67e74d67a22..d400c53e7fd 100644 --- a/examples/autonatv2/Cargo.toml +++ b/examples/autonatv2/Cargo.toml @@ -19,7 +19,7 @@ libp2p = { workspace = true, features = ["macros", "tokio", "tcp", "noise", "yam clap = { version = "4.4.18", features = ["derive"] } tokio = { version = "1.35.1", features = ["macros", "rt-multi-thread"] } tracing = "0.1.40" -tracing-subscriber = { version = "0.3.18", features = ["env-filter"] } +tracing-subscriber = { workspace = true, features = ["env-filter"] } rand = "0.8.5" opentelemetry_sdk = { version = "0.21.1", optional = true, features = ["rt-tokio"] } tracing-opentelemetry = { version = "0.22.0", optional = true } diff --git a/misc/multistream-select/Cargo.toml b/misc/multistream-select/Cargo.toml index d11ad4e2709..66ab434b613 100644 --- a/misc/multistream-select/Cargo.toml +++ b/misc/multistream-select/Cargo.toml @@ -23,7 +23,7 @@ async-std = { version = "1.6.2", features = ["attributes"] } futures_ringbuf = "0.4.0" quickcheck = { workspace = true } rw-stream-sink = { workspace = true } -tracing-subscriber = { workspace = true, features = ["env-filter"] } +libp2p-test-utils = { workspace = true } # 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/misc/multistream-select/src/dialer_select.rs b/misc/multistream-select/src/dialer_select.rs index 1d13e94910d..bd537e7fc7b 100644 --- a/misc/multistream-select/src/dialer_select.rs +++ b/misc/multistream-select/src/dialer_select.rs @@ -214,9 +214,9 @@ mod tests { future::timeout, net::{TcpListener, TcpStream}, }; + use libp2p_test_utils::EnvFilter; use quickcheck::{Arbitrary, Gen, GenRange}; use tracing::metadata::LevelFilter; - use tracing_subscriber::EnvFilter; use super::*; use crate::listener_select_proto; @@ -275,13 +275,11 @@ mod tests { ListenerProtos(listen_protos): ListenerProtos, DialPayload(dial_payload): DialPayload, ) { - let _ = tracing_subscriber::fmt() - .with_env_filter( - EnvFilter::builder() - .with_default_directive(LevelFilter::DEBUG.into()) - .from_env_lossy(), - ) - .try_init(); + libp2p_test_utils::with_env_filter( + EnvFilter::builder() + .with_default_directive(LevelFilter::DEBUG.into()) + .from_env_lossy(), + ); async_std::task::block_on(async move { let listener = TcpListener::bind("0.0.0.0:0").await.unwrap(); diff --git a/misc/test-utils/CHANGELOG.md b/misc/test-utils/CHANGELOG.md new file mode 100644 index 00000000000..0b8ed3ab931 --- /dev/null +++ b/misc/test-utils/CHANGELOG.md @@ -0,0 +1,4 @@ +## 0.1.0 + +- Introduce 'test-utils` crate. + See [PR 5725](https://github.com/libp2p/rust-libp2p/pull/5725). \ No newline at end of file diff --git a/misc/test-utils/Cargo.toml b/misc/test-utils/Cargo.toml new file mode 100644 index 00000000000..438bcabcf2a --- /dev/null +++ b/misc/test-utils/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "libp2p-test-utils" +version = "0.1.0" +edition = "2021" +authors = ["Krishang Shah "] +license = "MIT" +repository = "https://github.com/libp2p/rust-libp2p" +publish = false + +[package.metadata.release] +release = false + +[dependencies] +tracing-subscriber = { workspace = true, features = ["env-filter"] } + +[lints] +workspace = true diff --git a/misc/test-utils/src/lib.rs b/misc/test-utils/src/lib.rs new file mode 100644 index 00000000000..1155c79b614 --- /dev/null +++ b/misc/test-utils/src/lib.rs @@ -0,0 +1,15 @@ +pub use tracing_subscriber::EnvFilter; + +/// Initializes logging with the default environment filter (`RUST_LOG`). +pub fn with_default_env_filter() { + with_env_filter(EnvFilter::from_default_env()); +} + +/// Initializes logging with a custom environment filter. +/// Logs are written to standard error (`stderr`). +pub fn with_env_filter(filter: impl Into) { + let _ = tracing_subscriber::fmt() + .with_env_filter(filter) + .with_writer(std::io::stderr) + .try_init(); +} diff --git a/muxers/mplex/Cargo.toml b/muxers/mplex/Cargo.toml index 7f887c8b3b8..78650218f4b 100644 --- a/muxers/mplex/Cargo.toml +++ b/muxers/mplex/Cargo.toml @@ -32,7 +32,7 @@ libp2p-muxer-test-harness = { path = "../test-harness" } libp2p-plaintext = { workspace = true } libp2p-tcp = { workspace = true, features = ["async-io"] } quickcheck = { workspace = true } -tracing-subscriber = { workspace = true, features = ["env-filter"] } +libp2p-test-utils = { workspace = true } [[bench]] name = "split_send_size" diff --git a/muxers/mplex/benches/split_send_size.rs b/muxers/mplex/benches/split_send_size.rs index b0dd4babff7..7a0e9780ca7 100644 --- a/muxers/mplex/benches/split_send_size.rs +++ b/muxers/mplex/benches/split_send_size.rs @@ -38,7 +38,6 @@ use libp2p_identity as identity; use libp2p_identity::PeerId; use libp2p_mplex as mplex; use libp2p_plaintext as plaintext; -use tracing_subscriber::EnvFilter; type BenchTransport = transport::Boxed<(PeerId, muxing::StreamMuxerBox)>; @@ -55,9 +54,7 @@ const BENCH_SIZES: [usize; 8] = [ ]; fn prepare(c: &mut Criterion) { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let payload: Vec = vec![1; 1024 * 1024]; diff --git a/muxers/mplex/src/io.rs b/muxers/mplex/src/io.rs index ac93fd3865e..eeea4ce734f 100644 --- a/muxers/mplex/src/io.rs +++ b/muxers/mplex/src/io.rs @@ -1231,10 +1231,7 @@ mod tests { #[test] fn max_buffer_behaviour() { - use tracing_subscriber::EnvFilter; - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); fn prop(cfg: MplexConfig, overflow: NonZeroU8) { let mut r_buf = BytesMut::new(); @@ -1369,10 +1366,7 @@ mod tests { #[test] fn close_on_error() { - use tracing_subscriber::EnvFilter; - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); fn prop(cfg: MplexConfig, num_streams: NonZeroU8) { let num_streams = cmp::min(cfg.max_substreams, num_streams.get() as usize); diff --git a/protocols/autonat/Cargo.toml b/protocols/autonat/Cargo.toml index 8ef6f69d39a..5f5d18562fd 100644 --- a/protocols/autonat/Cargo.toml +++ b/protocols/autonat/Cargo.toml @@ -37,7 +37,7 @@ thiserror = { workspace = true, optional = true } [dev-dependencies] tokio = { workspace = true, features = ["macros", "rt", "sync"] } libp2p-swarm-test = { path = "../../swarm-test" } -tracing-subscriber = { version = "0.3", features = ["env-filter"] } +libp2p-test-utils = { workspace = true } libp2p-identify = { workspace = true } libp2p-swarm = { workspace = true, features = ["macros"] } diff --git a/protocols/autonat/tests/autonatv2.rs b/protocols/autonat/tests/autonatv2.rs index 49866a9adb5..1e278f5554f 100644 --- a/protocols/autonat/tests/autonatv2.rs +++ b/protocols/autonat/tests/autonatv2.rs @@ -11,13 +11,10 @@ use libp2p_swarm::{ use libp2p_swarm_test::SwarmExt; use rand_core::OsRng; use tokio::sync::oneshot; -use tracing_subscriber::EnvFilter; #[tokio::test] async fn confirm_successful() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let (mut alice, mut bob) = start_and_connect().await; let cor_server_peer = *alice.local_peer_id(); @@ -128,9 +125,7 @@ async fn confirm_successful() { #[tokio::test] async fn dial_back_to_unsupported_protocol() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let (mut alice, mut bob) = bootstrap().await; let alice_peer_id = *alice.local_peer_id(); @@ -226,9 +221,7 @@ async fn dial_back_to_unsupported_protocol() { #[tokio::test] async fn dial_back_to_non_libp2p() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let (mut alice, mut bob) = bootstrap().await; let alice_peer_id = *alice.local_peer_id(); @@ -314,9 +307,7 @@ async fn dial_back_to_non_libp2p() { #[tokio::test] async fn dial_back_to_not_supporting() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let (mut alice, mut bob) = bootstrap().await; let alice_peer_id = *alice.local_peer_id(); diff --git a/protocols/dcutr/Cargo.toml b/protocols/dcutr/Cargo.toml index 31acb42f2af..7bc05671aa2 100644 --- a/protocols/dcutr/Cargo.toml +++ b/protocols/dcutr/Cargo.toml @@ -34,7 +34,7 @@ libp2p-swarm = { workspace = true, features = ["macros"] } libp2p-swarm-test = { path = "../../swarm-test" } libp2p-tcp = { workspace = true, features = ["async-io"] } libp2p-yamux = { workspace = true } -tracing-subscriber = { workspace = true, features = ["env-filter"] } +libp2p-test-utils = { workspace = true } tokio = { workspace = true, features = ["rt", "macros"] } # Passing arguments to the docsrs builder in order to properly document cfg's. diff --git a/protocols/dcutr/tests/lib.rs b/protocols/dcutr/tests/lib.rs index a35c9a50cfe..ce7119cebcf 100644 --- a/protocols/dcutr/tests/lib.rs +++ b/protocols/dcutr/tests/lib.rs @@ -32,13 +32,10 @@ use libp2p_plaintext as plaintext; use libp2p_relay as relay; use libp2p_swarm::{Config, NetworkBehaviour, Swarm, SwarmEvent}; use libp2p_swarm_test::SwarmExt as _; -use tracing_subscriber::EnvFilter; #[tokio::test] async fn connect() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let mut relay = build_relay(); let mut dst = build_client(); diff --git a/protocols/gossipsub/Cargo.toml b/protocols/gossipsub/Cargo.toml index d48993b331e..298cdee21e9 100644 --- a/protocols/gossipsub/Cargo.toml +++ b/protocols/gossipsub/Cargo.toml @@ -44,7 +44,7 @@ prometheus-client = { workspace = true } libp2p-core = { workspace = true } libp2p-swarm-test = { path = "../../swarm-test" } quickcheck = { workspace = true } -tracing-subscriber = { workspace = true, features = ["env-filter"] } +libp2p-test-utils = { workspace = true } tokio = { workspace = true, features = ["rt", "rt-multi-thread", "time", "macros"] } # Passing arguments to the docsrs builder in order to properly document cfg's. diff --git a/protocols/gossipsub/src/behaviour/tests.rs b/protocols/gossipsub/src/behaviour/tests.rs index eaa983d214d..bf3046da78b 100644 --- a/protocols/gossipsub/src/behaviour/tests.rs +++ b/protocols/gossipsub/src/behaviour/tests.rs @@ -4761,10 +4761,7 @@ fn test_limit_number_of_message_ids_inside_ihave() { #[test] fn test_iwant_penalties() { - // use tracing_subscriber::EnvFilter; - // let _ = tracing_subscriber::fmt() - // .with_env_filter(EnvFilter::from_default_env()) - // .try_init(); + libp2p_test_utils::with_default_env_filter(); let config = ConfigBuilder::default() .iwant_followup_time(Duration::from_secs(4)) .build() diff --git a/protocols/gossipsub/tests/smoke.rs b/protocols/gossipsub/tests/smoke.rs index 85038665b4d..d5fec2c1985 100644 --- a/protocols/gossipsub/tests/smoke.rs +++ b/protocols/gossipsub/tests/smoke.rs @@ -31,7 +31,6 @@ use libp2p_swarm_test::SwarmExt as _; use quickcheck::{QuickCheck, TestResult}; use rand::{seq::SliceRandom, SeedableRng}; use tokio::{runtime::Runtime, time}; -use tracing_subscriber::EnvFilter; struct Graph { nodes: SelectAll>, @@ -132,9 +131,7 @@ async fn build_node() -> Swarm { #[test] fn multi_hop_propagation() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); fn prop(num_nodes: u8, seed: u64) -> TestResult { if !(2..=50).contains(&num_nodes) { diff --git a/protocols/identify/Cargo.toml b/protocols/identify/Cargo.toml index e5bb445b7a5..4ce2a0c1bd9 100644 --- a/protocols/identify/Cargo.toml +++ b/protocols/identify/Cargo.toml @@ -29,7 +29,7 @@ either = "1.12.0" async-std = { version = "1.6.2", features = ["attributes"] } libp2p-swarm-test = { path = "../../swarm-test" } libp2p-swarm = { workspace = true, features = ["macros"] } -tracing-subscriber = { workspace = true, features = ["env-filter"] } +libp2p-test-utils = { workspace = true } # 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/protocols/identify/tests/smoke.rs b/protocols/identify/tests/smoke.rs index 0d2818df0a4..a152bd75b19 100644 --- a/protocols/identify/tests/smoke.rs +++ b/protocols/identify/tests/smoke.rs @@ -9,13 +9,10 @@ use libp2p_identify as identify; use libp2p_identity::Keypair; use libp2p_swarm::{Swarm, SwarmEvent}; use libp2p_swarm_test::SwarmExt; -use tracing_subscriber::EnvFilter; #[async_std::test] async fn periodic_identify() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let mut swarm1 = Swarm::new_ephemeral(|identity| { identify::Behaviour::new( @@ -84,9 +81,7 @@ async fn periodic_identify() { } #[async_std::test] async fn only_emits_address_candidate_once_per_connection() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let mut swarm1 = Swarm::new_ephemeral(|identity| { identify::Behaviour::new( @@ -156,9 +151,7 @@ async fn only_emits_address_candidate_once_per_connection() { #[async_std::test] async fn emits_unique_listen_addresses() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let mut swarm1 = Swarm::new_ephemeral(|identity| { identify::Behaviour::new( @@ -228,9 +221,7 @@ async fn emits_unique_listen_addresses() { #[async_std::test] async fn hides_listen_addresses() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let mut swarm1 = Swarm::new_ephemeral(|identity| { identify::Behaviour::new( @@ -299,9 +290,7 @@ async fn hides_listen_addresses() { #[async_std::test] async fn identify_push() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let mut swarm1 = Swarm::new_ephemeral(|identity| { identify::Behaviour::new(identify::Config::new("a".to_string(), identity.public())) @@ -351,9 +340,7 @@ async fn identify_push() { #[async_std::test] async fn discover_peer_after_disconnect() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let mut swarm1 = Swarm::new_ephemeral(|identity| { identify::Behaviour::new(identify::Config::new("a".to_string(), identity.public())) @@ -404,9 +391,7 @@ async fn discover_peer_after_disconnect() { #[async_std::test] async fn configured_interval_starts_after_first_identify() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let identify_interval = Duration::from_secs(5); @@ -444,9 +429,7 @@ async fn configured_interval_starts_after_first_identify() { #[async_std::test] async fn reject_mismatched_public_key() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let mut honest_swarm = Swarm::new_ephemeral(|identity| { identify::Behaviour::new( diff --git a/protocols/kad/Cargo.toml b/protocols/kad/Cargo.toml index a9bc1a9a640..9b8ec64205a 100644 --- a/protocols/kad/Cargo.toml +++ b/protocols/kad/Cargo.toml @@ -41,7 +41,7 @@ libp2p-swarm = { path = "../../swarm", features = ["macros"] } libp2p-swarm-test = { path = "../../swarm-test" } libp2p-yamux = { workspace = true } quickcheck = { workspace = true } -tracing-subscriber = { workspace = true, features = ["env-filter"] } +libp2p-test-utils = { workspace = true } [features] serde = ["dep:serde", "bytes/serde"] diff --git a/protocols/kad/src/behaviour/test.rs b/protocols/kad/src/behaviour/test.rs index 467865dd225..ab8c980c30c 100644 --- a/protocols/kad/src/behaviour/test.rs +++ b/protocols/kad/src/behaviour/test.rs @@ -323,9 +323,7 @@ fn query_iter() { #[test] fn unresponsive_not_returned_direct() { - let _ = tracing_subscriber::fmt() - .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); // Build one node. It contains fake addresses to non-existing nodes. We ask it to find a // random peer. We make sure that no fake address is returned. diff --git a/protocols/kad/src/handler.rs b/protocols/kad/src/handler.rs index 6b4e944e2b0..6837e3d499e 100644 --- a/protocols/kad/src/handler.rs +++ b/protocols/kad/src/handler.rs @@ -1068,7 +1068,6 @@ fn process_kad_response(event: KadResponseMsg, query_id: QueryId) -> HandlerEven #[cfg(test)] mod tests { use quickcheck::{Arbitrary, Gen}; - use tracing_subscriber::EnvFilter; use super::*; @@ -1083,9 +1082,7 @@ mod tests { #[test] fn compute_next_protocol_status_test() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); fn prop(now_supported: bool, current: Option) { let new = compute_new_protocol_status(now_supported, current); diff --git a/protocols/kad/tests/client_mode.rs b/protocols/kad/tests/client_mode.rs index 3275c525890..09e24c6f6ea 100644 --- a/protocols/kad/tests/client_mode.rs +++ b/protocols/kad/tests/client_mode.rs @@ -3,15 +3,12 @@ use libp2p_identity as identity; use libp2p_kad::{store::MemoryStore, Behaviour, Config, Event, Mode}; use libp2p_swarm::{Swarm, SwarmEvent}; use libp2p_swarm_test::SwarmExt; -use tracing_subscriber::EnvFilter; use Event::*; use MyBehaviourEvent::*; #[async_std::test] async fn server_gets_added_to_routing_table_by_client() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let mut client = Swarm::new_ephemeral(MyBehaviour::new); let mut server = Swarm::new_ephemeral(MyBehaviour::new); @@ -41,9 +38,7 @@ async fn server_gets_added_to_routing_table_by_client() { #[async_std::test] async fn two_servers_add_each_other_to_routing_table() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let mut server1 = Swarm::new_ephemeral(MyBehaviour::new); let mut server2 = Swarm::new_ephemeral(MyBehaviour::new); @@ -82,9 +77,7 @@ async fn two_servers_add_each_other_to_routing_table() { #[async_std::test] async fn adding_an_external_addresses_activates_server_mode_on_existing_connections() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let mut client = Swarm::new_ephemeral(MyBehaviour::new); let mut server = Swarm::new_ephemeral(MyBehaviour::new); @@ -120,9 +113,7 @@ async fn adding_an_external_addresses_activates_server_mode_on_existing_connecti #[async_std::test] async fn set_client_to_server_mode() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let mut client = Swarm::new_ephemeral(MyBehaviour::new); client.behaviour_mut().kad.set_mode(Some(Mode::Client)); diff --git a/protocols/mdns/Cargo.toml b/protocols/mdns/Cargo.toml index 89d53c98a70..ba86a82d5bb 100644 --- a/protocols/mdns/Cargo.toml +++ b/protocols/mdns/Cargo.toml @@ -34,7 +34,7 @@ async-std = { version = "1.9.0", features = ["attributes"] } libp2p-swarm = { workspace = true, features = ["tokio", "async-std"] } tokio = { workspace = true, features = ["macros", "rt", "rt-multi-thread", "time"] } libp2p-swarm-test = { path = "../../swarm-test" } -tracing-subscriber = { workspace = true, features = ["env-filter"] } +libp2p-test-utils = { workspace = true } [[test]] name = "use-async-std" diff --git a/protocols/mdns/tests/use-async-std.rs b/protocols/mdns/tests/use-async-std.rs index df08b39af07..9ee2b7659ea 100644 --- a/protocols/mdns/tests/use-async-std.rs +++ b/protocols/mdns/tests/use-async-std.rs @@ -24,22 +24,17 @@ use futures::future::Either; use libp2p_mdns::{async_io::Behaviour, Config, Event}; use libp2p_swarm::{Swarm, SwarmEvent}; use libp2p_swarm_test::SwarmExt as _; -use tracing_subscriber::EnvFilter; #[async_std::test] async fn test_discovery_async_std_ipv4() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); run_discovery_test(Config::default()).await } #[async_std::test] async fn test_discovery_async_std_ipv6() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let config = Config { enable_ipv6: true, @@ -50,9 +45,7 @@ async fn test_discovery_async_std_ipv6() { #[async_std::test] async fn test_expired_async_std() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let config = Config { ttl: Duration::from_secs(1), @@ -85,9 +78,7 @@ async fn test_expired_async_std() { #[async_std::test] async fn test_no_expiration_on_close_async_std() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let config = Config { ttl: Duration::from_secs(120), query_interval: Duration::from_secs(10), diff --git a/protocols/mdns/tests/use-tokio.rs b/protocols/mdns/tests/use-tokio.rs index 0ec90a52b90..a48f84217a3 100644 --- a/protocols/mdns/tests/use-tokio.rs +++ b/protocols/mdns/tests/use-tokio.rs @@ -23,22 +23,17 @@ use futures::future::Either; use libp2p_mdns::{tokio::Behaviour, Config, Event}; use libp2p_swarm::{Swarm, SwarmEvent}; use libp2p_swarm_test::SwarmExt as _; -use tracing_subscriber::EnvFilter; #[tokio::test] async fn test_discovery_tokio_ipv4() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); run_discovery_test(Config::default()).await } #[tokio::test] async fn test_discovery_tokio_ipv6() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let config = Config { enable_ipv6: true, @@ -49,9 +44,7 @@ async fn test_discovery_tokio_ipv6() { #[tokio::test] async fn test_expired_tokio() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let config = Config { ttl: Duration::from_secs(1), diff --git a/protocols/perf/Cargo.toml b/protocols/perf/Cargo.toml index 645abc9bcfb..0b994447525 100644 --- a/protocols/perf/Cargo.toml +++ b/protocols/perf/Cargo.toml @@ -29,6 +29,7 @@ serde_json = "1.0" thiserror = { workspace = true } tracing = { workspace = true } tracing-subscriber = { workspace = true, features = ["env-filter"] } +libp2p-test-utils = { workspace = true } tokio = { workspace = true, features = ["macros", "rt", "rt-multi-thread"] } [dev-dependencies] diff --git a/protocols/perf/tests/lib.rs b/protocols/perf/tests/lib.rs index 017d475befd..c265b0e2e61 100644 --- a/protocols/perf/tests/lib.rs +++ b/protocols/perf/tests/lib.rs @@ -24,13 +24,10 @@ use libp2p_perf::{ }; use libp2p_swarm::{Swarm, SwarmEvent}; use libp2p_swarm_test::SwarmExt; -use tracing_subscriber::EnvFilter; #[tokio::test] async fn perf() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let mut server = Swarm::new_ephemeral(|_| server::Behaviour::new()); let server_peer_id = *server.local_peer_id(); diff --git a/protocols/relay/Cargo.toml b/protocols/relay/Cargo.toml index 6c2c7b90304..e7e447e7d16 100644 --- a/protocols/relay/Cargo.toml +++ b/protocols/relay/Cargo.toml @@ -36,8 +36,7 @@ libp2p-swarm = { workspace = true, features = ["macros", "async-std"] } libp2p-swarm-test = { workspace = true } libp2p-yamux = { workspace = true } quickcheck = { workspace = true } -tracing-subscriber = { workspace = true, features = ["env-filter"] } - +libp2p-test-utils = { workspace = true } # 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/protocols/relay/tests/lib.rs b/protocols/relay/tests/lib.rs index 3181e60db74..da6f549c091 100644 --- a/protocols/relay/tests/lib.rs +++ b/protocols/relay/tests/lib.rs @@ -40,13 +40,10 @@ use libp2p_plaintext as plaintext; use libp2p_relay as relay; use libp2p_swarm::{dial_opts::DialOpts, Config, DialError, NetworkBehaviour, Swarm, SwarmEvent}; use libp2p_swarm_test::SwarmExt; -use tracing_subscriber::EnvFilter; #[test] fn reservation() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let mut pool = LocalPool::new(); let relay_addr = Multiaddr::empty().with(Protocol::Memory(rand::random::())); @@ -87,9 +84,7 @@ fn reservation() { #[test] fn new_reservation_to_same_relay_replaces_old() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let mut pool = LocalPool::new(); let relay_addr = Multiaddr::empty().with(Protocol::Memory(rand::random::())); @@ -186,9 +181,7 @@ fn new_reservation_to_same_relay_replaces_old() { #[test] fn connect() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let mut pool = LocalPool::new(); let relay_addr = Multiaddr::empty().with(Protocol::Memory(rand::random::())); @@ -272,9 +265,7 @@ async fn connection_established_to( #[test] fn handle_dial_failure() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let mut pool = LocalPool::new(); let relay_addr = Multiaddr::empty().with(Protocol::Memory(rand::random::())); @@ -293,9 +284,7 @@ fn handle_dial_failure() { #[test] fn propagate_reservation_error_to_listener() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let mut pool = LocalPool::new(); let relay_addr = Multiaddr::empty().with(Protocol::Memory(rand::random::())); @@ -342,9 +331,7 @@ fn propagate_reservation_error_to_listener() { #[test] fn propagate_connect_error_to_unknown_peer_to_dialer() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let mut pool = LocalPool::new(); let relay_addr = Multiaddr::empty().with(Protocol::Memory(rand::random::())); @@ -398,9 +385,7 @@ fn propagate_connect_error_to_unknown_peer_to_dialer() { #[test] fn reuse_connection() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let mut pool = LocalPool::new(); let relay_addr = Multiaddr::empty().with(Protocol::Memory(rand::random::())); diff --git a/protocols/rendezvous/Cargo.toml b/protocols/rendezvous/Cargo.toml index 9521913cd30..104dc6ad1d4 100644 --- a/protocols/rendezvous/Cargo.toml +++ b/protocols/rendezvous/Cargo.toml @@ -32,7 +32,7 @@ libp2p-swarm = { workspace = true, features = ["macros", "tokio"] } libp2p-swarm-test = { path = "../../swarm-test" } rand = "0.8" tokio = { workspace = true, features = [ "rt-multi-thread", "time", "macros", "sync", "process", "fs", "net" ] } -tracing-subscriber = { workspace = true, features = ["env-filter"] } +libp2p-test-utils = { workspace = true } # 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/protocols/rendezvous/tests/rendezvous.rs b/protocols/rendezvous/tests/rendezvous.rs index 2305c2ef412..98aa9dab62d 100644 --- a/protocols/rendezvous/tests/rendezvous.rs +++ b/protocols/rendezvous/tests/rendezvous.rs @@ -27,13 +27,10 @@ use libp2p_rendezvous as rendezvous; use libp2p_rendezvous::client::RegisterError; use libp2p_swarm::{DialError, Swarm, SwarmEvent}; use libp2p_swarm_test::SwarmExt; -use tracing_subscriber::EnvFilter; #[tokio::test] async fn given_successful_registration_then_successful_discovery() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let namespace = rendezvous::Namespace::from_static("some-namespace"); let ([mut alice, mut bob], mut robert) = new_server_with_connected_clients(rendezvous::server::Config::default()).await; @@ -86,9 +83,7 @@ async fn given_successful_registration_then_successful_discovery() { #[tokio::test] async fn should_return_error_when_no_external_addresses() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let namespace = rendezvous::Namespace::from_static("some-namespace"); let server = new_server(rendezvous::server::Config::default()).await; let mut client = Swarm::new_ephemeral(rendezvous::client::Behaviour::new); @@ -103,9 +98,7 @@ async fn should_return_error_when_no_external_addresses() { #[tokio::test] async fn given_successful_registration_then_refresh_ttl() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let namespace = rendezvous::Namespace::from_static("some-namespace"); let ([mut alice, mut bob], mut robert) = new_server_with_connected_clients(rendezvous::server::Config::default()).await; @@ -171,9 +164,7 @@ async fn given_successful_registration_then_refresh_ttl() { #[tokio::test] async fn given_successful_registration_then_refresh_external_addrs() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let namespace = rendezvous::Namespace::from_static("some-namespace"); let ([mut alice], mut robert) = new_server_with_connected_clients(rendezvous::server::Config::default()).await; @@ -224,9 +215,7 @@ async fn given_successful_registration_then_refresh_external_addrs() { #[tokio::test] async fn given_invalid_ttl_then_unsuccessful_registration() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let namespace = rendezvous::Namespace::from_static("some-namespace"); let ([mut alice], mut robert) = new_server_with_connected_clients(rendezvous::server::Config::default()).await; @@ -253,9 +242,7 @@ async fn given_invalid_ttl_then_unsuccessful_registration() { #[tokio::test] async fn discover_allows_for_dial_by_peer_id() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let namespace = rendezvous::Namespace::from_static("some-namespace"); let ([mut alice, mut bob], robert) = new_server_with_connected_clients(rendezvous::server::Config::default()).await; @@ -310,9 +297,7 @@ async fn discover_allows_for_dial_by_peer_id() { #[tokio::test] async fn eve_cannot_register() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let namespace = rendezvous::Namespace::from_static("some-namespace"); let mut robert = new_server(rendezvous::server::Config::default()).await; let mut eve = new_impersonating_client().await; @@ -338,9 +323,7 @@ async fn eve_cannot_register() { // test if charlie can operate as client and server simultaneously #[tokio::test] async fn can_combine_client_and_server() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let namespace = rendezvous::Namespace::from_static("some-namespace"); let ([mut alice], mut robert) = new_server_with_connected_clients(rendezvous::server::Config::default()).await; @@ -376,9 +359,7 @@ async fn can_combine_client_and_server() { #[tokio::test] async fn registration_on_clients_expire() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let namespace = rendezvous::Namespace::from_static("some-namespace"); let ([mut alice, mut bob], robert) = new_server_with_connected_clients(rendezvous::server::Config::default().with_min_ttl(1)) diff --git a/protocols/request-response/Cargo.toml b/protocols/request-response/Cargo.toml index 5cd711dd051..cb78f536ae4 100644 --- a/protocols/request-response/Cargo.toml +++ b/protocols/request-response/Cargo.toml @@ -35,7 +35,7 @@ rand = "0.8" libp2p-swarm-test = { path = "../../swarm-test" } futures_ringbuf = "0.4.0" serde = { version = "1.0", features = ["derive"] } -tracing-subscriber = { workspace = true, features = ["env-filter"] } +libp2p-test-utils = { workspace = true } # 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/protocols/request-response/tests/error_reporting.rs b/protocols/request-response/tests/error_reporting.rs index 2108b6006c5..281701f5cc3 100644 --- a/protocols/request-response/tests/error_reporting.rs +++ b/protocols/request-response/tests/error_reporting.rs @@ -12,13 +12,10 @@ use libp2p_swarm_test::SwarmExt; use request_response::{ Codec, InboundFailure, InboundRequestId, OutboundFailure, OutboundRequestId, ResponseChannel, }; -use tracing_subscriber::EnvFilter; #[async_std::test] async fn report_outbound_failure_on_read_response() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let (peer1_id, mut swarm1) = new_swarm(); let (peer2_id, mut swarm2) = new_swarm(); @@ -72,10 +69,7 @@ async fn report_outbound_failure_on_read_response() { #[async_std::test] async fn report_outbound_failure_on_write_request() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); - + libp2p_test_utils::with_default_env_filter(); let (peer1_id, mut swarm1) = new_swarm(); let (_peer2_id, mut swarm2) = new_swarm(); @@ -115,9 +109,7 @@ async fn report_outbound_failure_on_write_request() { #[async_std::test] async fn report_outbound_timeout_on_read_response() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); // `swarm1` needs to have a bigger timeout to avoid racing let (peer1_id, mut swarm1) = new_swarm_with_timeout(Duration::from_millis(200)); @@ -162,9 +154,7 @@ async fn report_outbound_timeout_on_read_response() { #[async_std::test] async fn report_outbound_failure_on_max_streams() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); // `swarm2` will be able to handle only 1 stream per time. let swarm2_config = request_response::Config::default() @@ -214,9 +204,7 @@ async fn report_outbound_failure_on_max_streams() { #[async_std::test] async fn report_inbound_failure_on_read_request() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let (peer1_id, mut swarm1) = new_swarm(); let (_peer2_id, mut swarm2) = new_swarm(); @@ -251,9 +239,7 @@ async fn report_inbound_failure_on_read_request() { #[async_std::test] async fn report_inbound_failure_on_write_response() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let (peer1_id, mut swarm1) = new_swarm(); let (peer2_id, mut swarm2) = new_swarm(); @@ -317,9 +303,7 @@ async fn report_inbound_failure_on_write_response() { #[async_std::test] async fn report_inbound_timeout_on_write_response() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); // `swarm2` needs to have a bigger timeout to avoid racing let (peer1_id, mut swarm1) = new_swarm_with_timeout(Duration::from_millis(100)); diff --git a/protocols/request-response/tests/peer_address.rs b/protocols/request-response/tests/peer_address.rs index 603e2d09dc0..714091fc682 100644 --- a/protocols/request-response/tests/peer_address.rs +++ b/protocols/request-response/tests/peer_address.rs @@ -6,14 +6,11 @@ use libp2p_request_response::ProtocolSupport; use libp2p_swarm::{StreamProtocol, Swarm, SwarmEvent}; use libp2p_swarm_test::SwarmExt; use serde::{Deserialize, Serialize}; -use tracing_subscriber::EnvFilter; #[async_std::test] #[cfg(feature = "cbor")] async fn dial_succeeds_after_adding_peers_address() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let protocols = iter::once((StreamProtocol::new("/ping/1"), ProtocolSupport::Full)); let config = request_response::Config::default(); diff --git a/protocols/request-response/tests/ping.rs b/protocols/request-response/tests/ping.rs index 94adedac2d7..12458a0e5e7 100644 --- a/protocols/request-response/tests/ping.rs +++ b/protocols/request-response/tests/ping.rs @@ -30,14 +30,11 @@ use libp2p_swarm::{StreamProtocol, Swarm, SwarmEvent}; use libp2p_swarm_test::SwarmExt; use rand::Rng; use serde::{Deserialize, Serialize}; -use tracing_subscriber::EnvFilter; #[async_std::test] #[cfg(feature = "cbor")] async fn is_response_outbound() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let ping = Ping("ping".to_string().into_bytes()); let offline_peer = PeerId::random(); diff --git a/protocols/stream/Cargo.toml b/protocols/stream/Cargo.toml index d9c9276cb12..adb7a797794 100644 --- a/protocols/stream/Cargo.toml +++ b/protocols/stream/Cargo.toml @@ -20,7 +20,7 @@ rand = "0.8" [dev-dependencies] libp2p-swarm-test = { workspace = true } tokio = { workspace = true, features = ["full"] } -tracing-subscriber = { workspace = true, features = ["env-filter"] } +libp2p-test-utils = { workspace = true } [lints] workspace = true diff --git a/protocols/stream/tests/lib.rs b/protocols/stream/tests/lib.rs index cd6caaced5e..425b49adfaf 100644 --- a/protocols/stream/tests/lib.rs +++ b/protocols/stream/tests/lib.rs @@ -5,23 +5,20 @@ use libp2p_identity::PeerId; use libp2p_stream as stream; use libp2p_swarm::{StreamProtocol, Swarm}; use libp2p_swarm_test::SwarmExt as _; +use libp2p_test_utils::EnvFilter; use stream::OpenStreamError; use tracing::level_filters::LevelFilter; -use tracing_subscriber::EnvFilter; const PROTOCOL: StreamProtocol = StreamProtocol::new("/test"); #[tokio::test] async fn dropping_incoming_streams_deregisters() { - let _ = tracing_subscriber::fmt() - .with_env_filter( - EnvFilter::builder() - .with_default_directive(LevelFilter::DEBUG.into()) - .from_env() - .unwrap(), - ) - .with_test_writer() - .try_init(); + libp2p_test_utils::with_env_filter( + EnvFilter::builder() + .with_default_directive(LevelFilter::DEBUG.into()) + .from_env() + .unwrap(), + ); let mut swarm1 = Swarm::new_ephemeral(|_| stream::Behaviour::new()); let mut swarm2 = Swarm::new_ephemeral(|_| stream::Behaviour::new()); diff --git a/rustfmt.toml b/rustfmt.toml index 1e61bc16abf..fe1850ee986 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1,5 +1,5 @@ # Imports -reorder_imports = true +reorder_imports = true imports_granularity = "Crate" group_imports = "StdExternalCrate" diff --git a/swarm/Cargo.toml b/swarm/Cargo.toml index cf027d96ec0..b7e0fd73b5e 100644 --- a/swarm/Cargo.toml +++ b/swarm/Cargo.toml @@ -55,7 +55,7 @@ criterion = { version = "0.5", features = ["async_tokio"] } once_cell = "1.19.0" trybuild = "1.0.95" tokio = { workspace = true, features = ["time", "rt", "macros", "rt-multi-thread"] } -tracing-subscriber = { workspace = true, features = ["env-filter"] } +libp2p-test-utils = { workspace = true } [[test]] name = "swarm_derive" diff --git a/swarm/src/connection.rs b/swarm/src/connection.rs index 32cae54a5ef..a1c7b2a2f20 100644 --- a/swarm/src/connection.rs +++ b/swarm/src/connection.rs @@ -797,16 +797,13 @@ mod tests { StreamMuxer, }; use quickcheck::*; - use tracing_subscriber::EnvFilter; use super::*; use crate::dummy; #[test] fn max_negotiating_inbound_streams() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); fn prop(max_negotiating_inbound_streams: u8) { let max_negotiating_inbound_streams: usize = max_negotiating_inbound_streams.into(); @@ -974,9 +971,7 @@ mod tests { #[test] fn checked_add_fraction_can_add_u64_max() { - let _ = tracing_subscriber::fmt() - .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let start = Instant::now(); let duration = checked_add_fraction(start, Duration::from_secs(u64::MAX)); @@ -986,9 +981,7 @@ mod tests { #[test] fn compute_new_shutdown_does_not_panic() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); #[derive(Debug)] struct ArbitraryShutdown(Shutdown); diff --git a/swarm/src/lib.rs b/swarm/src/lib.rs index 91513c83559..f9c4c71c76f 100644 --- a/swarm/src/lib.rs +++ b/swarm/src/lib.rs @@ -2303,9 +2303,7 @@ mod tests { #[tokio::test] async fn aborting_pending_connection_surfaces_error() { - let _ = tracing_subscriber::fmt() - .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let mut dialer = new_test_swarm(Config::with_tokio_executor()); let mut listener = new_test_swarm(Config::with_tokio_executor()); diff --git a/transports/dns/Cargo.toml b/transports/dns/Cargo.toml index 2a12c34a383..a07e795397b 100644 --- a/transports/dns/Cargo.toml +++ b/transports/dns/Cargo.toml @@ -25,7 +25,7 @@ tracing = { workspace = true } libp2p-identity = { workspace = true, features = ["rand"] } tokio = { workspace = true, features = ["rt", "time"] } async-std-crate = { package = "async-std", version = "1.6" } -tracing-subscriber = { workspace = true, features = ["env-filter"] } +libp2p-test-utils = { workspace = true } [features] async-std = ["async-std-resolver"] diff --git a/transports/dns/src/lib.rs b/transports/dns/src/lib.rs index 7e3cf5d3c37..581942b8b7e 100644 --- a/transports/dns/src/lib.rs +++ b/transports/dns/src/lib.rs @@ -629,9 +629,7 @@ mod tests { #[test] fn basic_resolve() { - let _ = tracing_subscriber::fmt() - .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); #[derive(Clone)] struct CustomTransport; diff --git a/transports/noise/Cargo.toml b/transports/noise/Cargo.toml index d0e2f9004ce..a1b712dbdaf 100644 --- a/transports/noise/Cargo.toml +++ b/transports/noise/Cargo.toml @@ -34,7 +34,7 @@ snow = { version = "0.9.5", features = ["default-resolver"], default-features = [dev-dependencies] futures_ringbuf = "0.4.0" quickcheck = { workspace = true } -tracing-subscriber = { workspace = true, features = ["env-filter"] } +libp2p-test-utils = { workspace = true } libp2p-identity = { workspace = true, features = ["rand"] } # Passing arguments to the docsrs builder in order to properly document cfg's. diff --git a/transports/noise/tests/smoke.rs b/transports/noise/tests/smoke.rs index abc5a038f93..cd9702b1c2f 100644 --- a/transports/noise/tests/smoke.rs +++ b/transports/noise/tests/smoke.rs @@ -29,7 +29,6 @@ use libp2p_core::{ use libp2p_identity as identity; use libp2p_noise as noise; use quickcheck::*; -use tracing_subscriber::EnvFilter; #[allow(dead_code)] fn core_upgrade_compat() { @@ -44,9 +43,7 @@ fn core_upgrade_compat() { #[test] fn xx() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); fn prop(mut messages: Vec) -> bool { messages.truncate(5); let server_id = identity::Keypair::generate_ed25519(); diff --git a/transports/plaintext/Cargo.toml b/transports/plaintext/Cargo.toml index 9e1e5449158..95f8f5af065 100644 --- a/transports/plaintext/Cargo.toml +++ b/transports/plaintext/Cargo.toml @@ -24,7 +24,7 @@ quick-protobuf-codec = { workspace = true } libp2p-identity = { workspace = true, features = ["ed25519", "rand"] } quickcheck = { workspace = true } futures_ringbuf = "0.4.0" -tracing-subscriber = { workspace = true, features = ["env-filter"] } +libp2p-test-utils = { workspace = true } # 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/plaintext/tests/smoke.rs b/transports/plaintext/tests/smoke.rs index f77f23d3ad3..ee8cec46c0b 100644 --- a/transports/plaintext/tests/smoke.rs +++ b/transports/plaintext/tests/smoke.rs @@ -23,13 +23,10 @@ use libp2p_core::upgrade::InboundConnectionUpgrade; use libp2p_identity as identity; use libp2p_plaintext as plaintext; use quickcheck::QuickCheck; -use tracing_subscriber::EnvFilter; #[test] fn variable_msg_length() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); fn prop(msg: Vec) { let msg_to_send = msg.clone(); diff --git a/transports/quic/Cargo.toml b/transports/quic/Cargo.toml index bff0a024bd4..1c35b293049 100644 --- a/transports/quic/Cargo.toml +++ b/transports/quic/Cargo.toml @@ -43,7 +43,7 @@ libp2p-tcp = { workspace = true, features = ["async-io"] } libp2p-yamux = { workspace = true } quickcheck = "1" tokio = { workspace = true, features = ["macros", "rt-multi-thread", "time"] } -tracing-subscriber = { workspace = true, features = ["env-filter"] } +libp2p-test-utils = { workspace = true } [[test]] name = "stream_compliance" diff --git a/transports/quic/tests/smoke.rs b/transports/quic/tests/smoke.rs index 5fbef84649e..f0a8bd97d70 100644 --- a/transports/quic/tests/smoke.rs +++ b/transports/quic/tests/smoke.rs @@ -33,7 +33,6 @@ use libp2p_tcp as tcp; use libp2p_yamux as yamux; use quic::Provider; use rand::RngCore; -use tracing_subscriber::EnvFilter; #[cfg(feature = "tokio")] #[tokio::test] @@ -50,9 +49,7 @@ async fn async_std_smoke() { #[cfg(feature = "tokio")] #[tokio::test] async fn endpoint_reuse() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let (_, mut a_transport) = create_default_transport::(); let (_, mut b_transport) = create_default_transport::(); @@ -77,9 +74,7 @@ async fn endpoint_reuse() { #[cfg(feature = "async-std")] #[async_std::test] async fn ipv4_dial_ipv6() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let (a_peer_id, mut a_transport) = create_default_transport::(); let (b_peer_id, mut b_transport) = create_default_transport::(); @@ -99,9 +94,7 @@ async fn ipv4_dial_ipv6() { async fn wrapped_with_delay() { use libp2p_core::transport::DialOpts; - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); struct DialDelay(Arc>>); @@ -271,9 +264,7 @@ async fn tcp_and_quic() { #[cfg(feature = "async-std")] #[test] fn concurrent_connections_and_streams_async_std() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); quickcheck::QuickCheck::new() .min_tests_passed(1) @@ -284,9 +275,7 @@ fn concurrent_connections_and_streams_async_std() { #[cfg(feature = "tokio")] #[test] fn concurrent_connections_and_streams_tokio() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let rt = tokio::runtime::Runtime::new().unwrap(); let _guard = rt.enter(); @@ -303,9 +292,7 @@ async fn draft_29_support() { use futures::{future::poll_fn, select}; use libp2p_core::transport::TransportError; - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let (_, mut a_transport) = create_transport::(|cfg| cfg.support_draft_29 = true); @@ -380,9 +367,7 @@ async fn draft_29_support() { #[cfg(feature = "async-std")] #[async_std::test] async fn backpressure() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let max_stream_data = quic::Config::new(&generate_tls_keypair()).max_stream_data; let (mut stream_a, mut stream_b) = build_streams::().await; @@ -406,9 +391,7 @@ async fn backpressure() { #[cfg(feature = "async-std")] #[async_std::test] async fn read_after_peer_dropped_stream() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let (mut stream_a, mut stream_b) = build_streams::().await; let data = vec![0; 10]; @@ -428,9 +411,7 @@ async fn read_after_peer_dropped_stream() { #[async_std::test] #[should_panic] async fn write_after_peer_dropped_stream() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let (stream_a, mut stream_b) = build_streams::().await; drop(stream_a); futures_timer::Delay::new(Duration::from_millis(100)).await; @@ -484,9 +465,7 @@ async fn test_local_listener_reuse() { } async fn smoke() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let (a_peer_id, mut a_transport) = create_default_transport::

(); let (b_peer_id, mut b_transport) = create_default_transport::

(); diff --git a/transports/tcp/Cargo.toml b/transports/tcp/Cargo.toml index baa3b2f46dd..61c31e49639 100644 --- a/transports/tcp/Cargo.toml +++ b/transports/tcp/Cargo.toml @@ -28,7 +28,7 @@ async-io = ["dep:async-io", "if-watch/smol"] [dev-dependencies] async-std = { version = "1.6.5", features = ["attributes"] } tokio = { workspace = true, features = ["full"] } -tracing-subscriber = { workspace = true, features = ["env-filter"] } +libp2p-test-utils = { workspace = true } # 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/tcp/src/lib.rs b/transports/tcp/src/lib.rs index fefa18fb431..5d3e46bcb09 100644 --- a/transports/tcp/src/lib.rs +++ b/transports/tcp/src/lib.rs @@ -762,9 +762,7 @@ mod tests { #[test] fn communicating_between_dialer_and_listener() { - let _ = tracing_subscriber::fmt() - .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); async fn listener(addr: Multiaddr, mut ready_tx: mpsc::Sender) { let mut tcp = Transport::::default().boxed(); @@ -843,9 +841,7 @@ mod tests { #[test] fn wildcard_expansion() { - let _ = tracing_subscriber::fmt() - .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); async fn listener(addr: Multiaddr, mut ready_tx: mpsc::Sender) { let mut tcp = Transport::::default().boxed(); @@ -923,9 +919,7 @@ mod tests { #[test] fn port_reuse_dialing() { - let _ = tracing_subscriber::fmt() - .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); async fn listener( addr: Multiaddr, @@ -1042,9 +1036,7 @@ mod tests { #[test] fn port_reuse_listening() { - let _ = tracing_subscriber::fmt() - .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); async fn listen_twice(addr: Multiaddr) { let mut tcp = Transport::::new(Config::new()); @@ -1098,9 +1090,7 @@ mod tests { #[test] fn listen_port_0() { - let _ = tracing_subscriber::fmt() - .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); async fn listen(addr: Multiaddr) -> Multiaddr { let mut tcp = Transport::::default().boxed(); @@ -1135,9 +1125,7 @@ mod tests { #[test] fn listen_invalid_addr() { - let _ = tracing_subscriber::fmt() - .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); fn test(addr: Multiaddr) { #[cfg(feature = "async-io")] @@ -1158,9 +1146,7 @@ mod tests { #[test] fn test_remove_listener() { - let _ = tracing_subscriber::fmt() - .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); async fn cycle_listeners() -> bool { let mut tcp = Transport::::default().boxed(); diff --git a/transports/webrtc/Cargo.toml b/transports/webrtc/Cargo.toml index f3d2e57147e..d010d4c1044 100644 --- a/transports/webrtc/Cargo.toml +++ b/transports/webrtc/Cargo.toml @@ -38,8 +38,7 @@ pem = ["webrtc?/pem"] libp2p-identity = { workspace = true, features = ["rand"] } tokio = { workspace = true, features = ["full"] } quickcheck = "1.0.3" -tracing-subscriber = { workspace = true, features = ["env-filter"] } - +libp2p-test-utils = { workspace = true } [[test]] name = "smoke" diff --git a/transports/webrtc/tests/smoke.rs b/transports/webrtc/tests/smoke.rs index 5f67c09d962..e27e3cee672 100644 --- a/transports/webrtc/tests/smoke.rs +++ b/transports/webrtc/tests/smoke.rs @@ -42,13 +42,10 @@ use libp2p_core::{ use libp2p_identity::PeerId; use libp2p_webrtc as webrtc; use rand::{thread_rng, RngCore}; -use tracing_subscriber::EnvFilter; #[tokio::test] async fn smoke() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let (a_peer_id, mut a_transport) = create_transport(); let (b_peer_id, mut b_transport) = create_transport(); @@ -65,9 +62,7 @@ async fn smoke() { // Note: This test should likely be ported to the muxer compliance test suite. #[test] fn concurrent_connections_and_streams_tokio() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); + libp2p_test_utils::with_default_env_filter(); let rt = tokio::runtime::Runtime::new().unwrap(); let _guard = rt.enter(); From 0ad6c9aa28716bfa8386846721c9ae7df5c5abcc Mon Sep 17 00:00:00 2001 From: hopinheimer <48147533+hopinheimer@users.noreply.github.com> Date: Fri, 27 Dec 2024 15:56:36 -0500 Subject: [PATCH 07/56] feat(gossipsub): implement gossipsub 1.2 beta This PR implements gossipsub 1.2 beta bringing changes over from lighthouse ref PR: https://github.com/sigp/lighthouse/pull/5422 Please include any relevant issues in here, for example: https://github.com/libp2p/specs/pull/548 Pull-Request: #5697. --- Cargo.lock | 10 + Cargo.toml | 1 + protocols/gossipsub/CHANGELOG.md | 3 + protocols/gossipsub/Cargo.toml | 1 + protocols/gossipsub/src/behaviour.rs | 198 ++++++++++---- protocols/gossipsub/src/behaviour/tests.rs | 246 +++++++++++++++++- .../gossipsub/src/generated/gossipsub/pb.rs | 36 +++ protocols/gossipsub/src/generated/rpc.proto | 9 +- protocols/gossipsub/src/gossip_promises.rs | 8 + protocols/gossipsub/src/handler.rs | 2 +- protocols/gossipsub/src/metrics.rs | 35 +++ protocols/gossipsub/src/protocol.rs | 30 ++- protocols/gossipsub/src/rpc.rs | 2 +- protocols/gossipsub/src/types.rs | 56 +++- 14 files changed, 571 insertions(+), 66 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7a5497c5701..5d9a22cf579 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1926,6 +1926,15 @@ dependencies = [ "allocator-api2", ] +[[package]] +name = "hashlink" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ba4ff7128dee98c7dc9794b6a411377e1404dba1c97deb8d1a55297bd25d8af" +dependencies = [ + "hashbrown 0.14.3", +] + [[package]] name = "heck" version = "0.4.1" @@ -2858,6 +2867,7 @@ dependencies = [ "futures", "futures-timer", "getrandom 0.2.15", + "hashlink", "hex_fmt", "libp2p-core", "libp2p-identity", diff --git a/Cargo.toml b/Cargo.toml index 1819e68edf4..8c5c4c320c1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -141,6 +141,7 @@ tracing = "0.1.41" tracing-subscriber = "0.3.19" unsigned-varint = { version = "0.8.0" } web-time = "1.1.0" +hashlink = "0.9.0" [patch.crates-io] diff --git a/protocols/gossipsub/CHANGELOG.md b/protocols/gossipsub/CHANGELOG.md index e9663c4c39c..5e18f284fc4 100644 --- a/protocols/gossipsub/CHANGELOG.md +++ b/protocols/gossipsub/CHANGELOG.md @@ -1,5 +1,8 @@ ## 0.48.0 +- Introduce Gossipsub v1.2 [spec](https://github.com/libp2p/specs/blob/master/pubsub/gossipsub/gossipsub-v1.2.md). + See [PR 5697](https://github.com/libp2p/rust-libp2p/pull/5697) + - Correct state inconsistencies with the mesh and fanout when unsubscribing. See [PR 5690](https://github.com/libp2p/rust-libp2p/pull/5690) diff --git a/protocols/gossipsub/Cargo.toml b/protocols/gossipsub/Cargo.toml index 298cdee21e9..328d4367204 100644 --- a/protocols/gossipsub/Cargo.toml +++ b/protocols/gossipsub/Cargo.toml @@ -24,6 +24,7 @@ fnv = "1.0.7" futures = { workspace = true } futures-timer = "3.0.2" getrandom = { workspace = true } +hashlink = { workspace = true} hex_fmt = "0.3.0" web-time = { workspace = true } libp2p-core = { workspace = true } diff --git a/protocols/gossipsub/src/behaviour.rs b/protocols/gossipsub/src/behaviour.rs index 954e87ee470..4643f2bd97f 100644 --- a/protocols/gossipsub/src/behaviour.rs +++ b/protocols/gossipsub/src/behaviour.rs @@ -30,6 +30,7 @@ use std::{ use futures::FutureExt; use futures_timer::Delay; +use hashlink::LinkedHashMap; use libp2p_core::{ multiaddr::Protocol::{Ip4, Ip6}, transport::PortUse, @@ -63,8 +64,9 @@ use crate::{ topic::{Hasher, Topic, TopicHash}, transform::{DataTransform, IdentityTransform}, types::{ - ControlAction, Graft, IHave, IWant, Message, MessageAcceptance, MessageId, PeerConnections, - PeerInfo, PeerKind, Prune, RawMessage, RpcOut, Subscription, SubscriptionAction, + ControlAction, Graft, IDontWant, IHave, IWant, Message, MessageAcceptance, MessageId, + PeerConnections, PeerInfo, PeerKind, Prune, RawMessage, RpcOut, Subscription, + SubscriptionAction, }, FailedMessages, PublishError, SubscriptionError, TopicScoreParams, ValidationError, }; @@ -72,6 +74,12 @@ use crate::{ #[cfg(test)] mod tests; +/// IDONTWANT cache capacity. +const IDONTWANT_CAP: usize = 10_000; + +/// IDONTWANT timeout before removal. +const IDONTWANT_TIMEOUT: Duration = Duration::new(3, 0); + /// Determines if published messages should be signed or not. /// /// Without signing, a number of privacy preserving modes can be selected. @@ -306,7 +314,7 @@ pub struct Behaviour { /// Stores optional peer score data together with thresholds, decay interval and gossip /// promises. - peer_score: Option<(PeerScore, PeerScoreThresholds, Delay, GossipPromises)>, + peer_score: Option<(PeerScore, PeerScoreThresholds, Delay)>, /// Counts the number of `IHAVE` received from each peer since the last heartbeat. count_received_ihave: HashMap, @@ -331,6 +339,9 @@ pub struct Behaviour { /// Tracks the numbers of failed messages per peer-id. failed_messages: HashMap, + + /// Tracks recently sent `IWANT` messages and checks if peers respond to them. + gossip_promises: GossipPromises, } impl Behaviour @@ -464,6 +475,7 @@ where subscription_filter, data_transform, failed_messages: Default::default(), + gossip_promises: Default::default(), }) } } @@ -897,7 +909,7 @@ where let interval = Delay::new(params.decay_interval); let peer_score = PeerScore::new_with_message_delivery_time_callback(params, callback); - self.peer_score = Some((peer_score, threshold, interval, GossipPromises::default())); + self.peer_score = Some((peer_score, threshold, interval)); Ok(()) } @@ -1161,7 +1173,7 @@ where } fn score_below_threshold_from_scores( - peer_score: &Option<(PeerScore, PeerScoreThresholds, Delay, GossipPromises)>, + peer_score: &Option<(PeerScore, PeerScoreThresholds, Delay)>, peer_id: &PeerId, threshold: impl Fn(&PeerScoreThresholds) -> f64, ) -> (bool, f64) { @@ -1222,10 +1234,7 @@ where return false; } - self.peer_score - .as_ref() - .map(|(_, _, _, promises)| !promises.contains(id)) - .unwrap_or(true) + !self.gossip_promises.contains(id) }; for (topic, ids) in ihave_msgs { @@ -1272,13 +1281,11 @@ where iwant_ids_vec.truncate(iask); *iasked += iask; - if let Some((_, _, _, gossip_promises)) = &mut self.peer_score { - gossip_promises.add_promise( - *peer_id, - &iwant_ids_vec, - Instant::now() + self.config.iwant_followup_time(), - ); - } + self.gossip_promises.add_promise( + *peer_id, + &iwant_ids_vec, + Instant::now() + self.config.iwant_followup_time(), + ); tracing::trace!( peer=%peer_id, "IHAVE: Asking for the following messages from peer: {:?}", @@ -1642,14 +1649,15 @@ where peer=%propagation_source, "Rejecting message from blacklisted peer" ); - if let Some((peer_score, .., gossip_promises)) = &mut self.peer_score { + self.gossip_promises + .reject_message(msg_id, &RejectReason::BlackListedPeer); + if let Some((peer_score, ..)) = &mut self.peer_score { peer_score.reject_message( propagation_source, msg_id, &raw_message.topic, RejectReason::BlackListedPeer, ); - gossip_promises.reject_message(msg_id, &RejectReason::BlackListedPeer); } return false; } @@ -1731,6 +1739,9 @@ where // Calculate the message id on the transformed data. let msg_id = self.config.message_id(&message); + // Broadcast IDONTWANT messages. + self.send_idontwant(&raw_message, &msg_id, propagation_source); + // Check the validity of the message // Peers get penalized if this message is invalid. We don't add it to the duplicate cache // and instead continually penalize peers that repeatedly send this message. @@ -1758,9 +1769,11 @@ where // Tells score that message arrived (but is maybe not fully validated yet). // Consider the message as delivered for gossip promises. - if let Some((peer_score, .., gossip_promises)) = &mut self.peer_score { + self.gossip_promises.message_delivered(&msg_id); + + // Tells score that message arrived (but is maybe not fully validated yet). + if let Some((peer_score, ..)) = &mut self.peer_score { peer_score.validate_message(propagation_source, &msg_id, &message.topic); - gossip_promises.message_delivered(&msg_id); } // Add the message to our memcache @@ -1802,12 +1815,14 @@ where raw_message: &RawMessage, reject_reason: RejectReason, ) { - if let Some((peer_score, .., gossip_promises)) = &mut self.peer_score { - if let Some(metrics) = self.metrics.as_mut() { - metrics.register_invalid_message(&raw_message.topic); - } + if let Some(metrics) = self.metrics.as_mut() { + metrics.register_invalid_message(&raw_message.topic); + } - if let Ok(message) = self.data_transform.inbound_transform(raw_message.clone()) { + let message = self.data_transform.inbound_transform(raw_message.clone()); + + match (&mut self.peer_score, message) { + (Some((peer_score, ..)), Ok(message)) => { let message_id = self.config.message_id(&message); peer_score.reject_message( @@ -1817,13 +1832,22 @@ where reject_reason, ); - gossip_promises.reject_message(&message_id, &reject_reason); - } else { + self.gossip_promises + .reject_message(&message_id, &reject_reason); + } + (Some((peer_score, ..)), Err(_)) => { // The message is invalid, we reject it ignoring any gossip promises. If a peer is // advertising this message via an IHAVE and it's invalid it will be double // penalized, one for sending us an invalid and again for breaking a promise. peer_score.reject_invalid_message(propagation_source, &raw_message.topic); } + (None, Ok(message)) => { + // Valid transformation without peer scoring + let message_id = self.config.message_id(&message); + self.gossip_promises + .reject_message(&message_id, &reject_reason); + } + (None, Err(_)) => {} } } @@ -1890,7 +1914,7 @@ where // if the mesh needs peers add the peer to the mesh if !self.explicit_peers.contains(propagation_source) - && matches!(peer.kind, PeerKind::Gossipsubv1_1 | PeerKind::Gossipsub) + && peer.kind.is_gossipsub() && !Self::score_below_threshold_from_scores( &self.peer_score, propagation_source, @@ -1994,8 +2018,8 @@ where /// Applies penalties to peers that did not respond to our IWANT requests. fn apply_iwant_penalties(&mut self) { - if let Some((peer_score, .., gossip_promises)) = &mut self.peer_score { - for (peer, count) in gossip_promises.get_broken_promises() { + if let Some((peer_score, ..)) = &mut self.peer_score { + for (peer, count) in self.gossip_promises.get_broken_promises() { peer_score.add_penalty(&peer, count); if let Some(metrics) = self.metrics.as_mut() { metrics.register_score_penalty(Penalty::BrokenPromise); @@ -2216,7 +2240,7 @@ where && peers.len() > 1 && self.peer_score.is_some() { - if let Some((_, thresholds, _, _)) = &self.peer_score { + if let Some((_, thresholds, _)) = &self.peer_score { // Opportunistic grafting works as follows: we check the median score of peers // in the mesh; if this score is below the opportunisticGraftThreshold, we // select a few peers at random with score over the median. @@ -2309,7 +2333,7 @@ where for (topic_hash, peers) in self.fanout.iter_mut() { let mut to_remove_peers = Vec::new(); let publish_threshold = match &self.peer_score { - Some((_, thresholds, _, _)) => thresholds.publish_threshold, + Some((_, thresholds, _)) => thresholds.publish_threshold, _ => 0.0, }; for peer_id in peers.iter() { @@ -2402,6 +2426,17 @@ where } self.failed_messages.shrink_to_fit(); + // Flush stale IDONTWANTs. + for peer in self.connected_peers.values_mut() { + while let Some((_front, instant)) = peer.dont_send.front() { + if (*instant + IDONTWANT_TIMEOUT) >= Instant::now() { + break; + } else { + peer.dont_send.pop_front(); + } + } + } + tracing::debug!("Completed Heartbeat"); if let Some(metrics) = self.metrics.as_mut() { let duration = u64::try_from(start.elapsed().as_millis()).unwrap_or(u64::MAX); @@ -2557,6 +2592,49 @@ where } } + /// Helper function which sends an IDONTWANT message to mesh\[topic\] peers. + fn send_idontwant( + &mut self, + message: &RawMessage, + msg_id: &MessageId, + propagation_source: &PeerId, + ) { + let Some(mesh_peers) = self.mesh.get(&message.topic) else { + return; + }; + + let iwant_peers = self.gossip_promises.peers_for_message(msg_id); + + let recipient_peers: Vec = mesh_peers + .iter() + .chain(iwant_peers.iter()) + .filter(|peer_id| { + *peer_id != propagation_source && Some(*peer_id) != message.source.as_ref() + }) + .cloned() + .collect(); + + for peer_id in recipient_peers { + let Some(peer) = self.connected_peers.get_mut(&peer_id) else { + tracing::error!(peer = %peer_id, + "Could not IDONTWANT, peer doesn't exist in connected peer list"); + continue; + }; + + // Only gossipsub 1.2 peers support IDONTWANT. + if peer.kind != PeerKind::Gossipsubv1_2 { + continue; + } + + self.send_message( + peer_id, + RpcOut::IDontWant(IDontWant { + message_ids: vec![msg_id.clone()], + }), + ); + } + } + /// Helper function which forwards a message to mesh\[topic\] peers. /// /// Returns true if at least one peer was messaged. @@ -2612,13 +2690,23 @@ where } // forward the message to peers - for peer in recipient_peers.iter() { - let event = RpcOut::Forward { - message: message.clone(), - timeout: Delay::new(self.config.forward_queue_duration()), - }; - tracing::debug!(%peer, message=%msg_id, "Sending message to peer"); - self.send_message(*peer, event); + for peer_id in recipient_peers.iter() { + if let Some(peer) = self.connected_peers.get_mut(peer_id) { + if peer.dont_send.contains_key(msg_id) { + tracing::debug!(%peer_id, message=%msg_id, "Peer doesn't want message"); + continue; + } + + tracing::debug!(%peer_id, message=%msg_id, "Sending message to peer"); + + self.send_message( + *peer_id, + RpcOut::Forward { + message: message.clone(), + timeout: Delay::new(self.config.forward_queue_duration()), + }, + ); + } } tracing::debug!("Completed forwarding message"); true @@ -2754,7 +2842,7 @@ where failed_messages.non_priority += 1; failed_messages.forward += 1; } - RpcOut::IWant(_) | RpcOut::IHave(_) => { + RpcOut::IWant(_) | RpcOut::IHave(_) | RpcOut::IDontWant(_) => { failed_messages.non_priority += 1; } RpcOut::Graft(_) @@ -2914,7 +3002,7 @@ where // If metrics are enabled, register the disconnection of a peer based on its protocol. if let Some(metrics) = self.metrics.as_mut() { - metrics.peer_protocol_disconnected(connected_peer.kind.clone()); + metrics.peer_protocol_disconnected(connected_peer.kind); } self.connected_peers.remove(&peer_id); @@ -2994,6 +3082,7 @@ where connections: vec![], sender: Sender::new(self.config.connection_handler_queue_len()), topics: Default::default(), + dont_send: LinkedHashMap::new(), }); // Add the new connection connected_peer.connections.push(connection_id); @@ -3020,6 +3109,7 @@ where connections: vec![], sender: Sender::new(self.config.connection_handler_queue_len()), topics: Default::default(), + dont_send: LinkedHashMap::new(), }); // Add the new connection connected_peer.connections.push(connection_id); @@ -3041,7 +3131,7 @@ where // We have identified the protocol this peer is using if let Some(metrics) = self.metrics.as_mut() { - metrics.peer_protocol_connected(kind.clone()); + metrics.peer_protocol_connected(kind); } if let PeerKind::NotSupported = kind { @@ -3069,7 +3159,7 @@ where } HandlerEvent::MessageDropped(rpc) => { // Account for this in the scoring logic - if let Some((peer_score, _, _, _)) = &mut self.peer_score { + if let Some((peer_score, _, _)) = &mut self.peer_score { peer_score.failed_message_slow_peer(&propagation_source); } @@ -3177,6 +3267,24 @@ where peers, backoff, }) => prune_msgs.push((topic_hash, peers, backoff)), + ControlAction::IDontWant(IDontWant { message_ids }) => { + let Some(peer) = self.connected_peers.get_mut(&propagation_source) + else { + tracing::error!(peer = %propagation_source, + "Could not handle IDONTWANT, peer doesn't exist in connected peer list"); + continue; + }; + if let Some(metrics) = self.metrics.as_mut() { + metrics.register_idontwant(message_ids.len()); + } + for message_id in message_ids { + peer.dont_send.insert(message_id, Instant::now()); + // Don't exceed capacity. + if peer.dont_send.len() > IDONTWANT_CAP { + peer.dont_send.pop_front(); + } + } + } } } if !ihave_msgs.is_empty() { @@ -3202,7 +3310,7 @@ where } // update scores - if let Some((peer_score, _, delay, _)) = &mut self.peer_score { + if let Some((peer_score, _, delay)) = &mut self.peer_score { if delay.poll_unpin(cx).is_ready() { peer_score.refresh_scores(); delay.reset(peer_score.params.decay_interval); @@ -3329,7 +3437,7 @@ fn get_random_peers_dynamic( .iter() .filter(|(_, p)| p.topics.contains(topic_hash)) .filter(|(peer_id, _)| f(peer_id)) - .filter(|(_, p)| p.kind == PeerKind::Gossipsub || p.kind == PeerKind::Gossipsubv1_1) + .filter(|(_, p)| p.kind.is_gossipsub()) .map(|(peer_id, _)| *peer_id) .collect::>(); diff --git a/protocols/gossipsub/src/behaviour/tests.rs b/protocols/gossipsub/src/behaviour/tests.rs index bf3046da78b..f3d24897b0c 100644 --- a/protocols/gossipsub/src/behaviour/tests.rs +++ b/protocols/gossipsub/src/behaviour/tests.rs @@ -33,13 +33,7 @@ use crate::{ }; #[derive(Default, Debug)] -struct InjectNodes -// TODO: remove trait bound Default when this issue is fixed: -// https://github.com/colin-kiegel/rust-derive-builder/issues/93 -where - D: DataTransform + Default + Clone + Send + 'static, - F: TopicSubscriptionFilter + Clone + Default + Send + 'static, -{ +struct InjectNodes { peer_no: usize, topics: Vec, to_subscribe: bool, @@ -49,6 +43,7 @@ where scoring: Option<(PeerScoreParams, PeerScoreThresholds)>, data_transform: D, subscription_filter: F, + peer_kind: Option, } impl InjectNodes @@ -96,7 +91,7 @@ where let empty = vec![]; for i in 0..self.peer_no { - let (peer, receiver) = add_peer( + let (peer, receiver) = add_peer_with_addr_and_kind( &mut gs, if self.to_subscribe { &topic_hashes @@ -105,6 +100,8 @@ where }, i < self.outbound, i < self.explicit, + Multiaddr::empty(), + self.peer_kind.or(Some(PeerKind::Gossipsubv1_1)), ); peers.push(peer); receivers.insert(peer, receiver); @@ -153,6 +150,11 @@ where self.subscription_filter = subscription_filter; self } + + fn peer_kind(mut self, peer_kind: PeerKind) -> Self { + self.peer_kind = Some(peer_kind); + self + } } fn inject_nodes() -> InjectNodes @@ -235,10 +237,11 @@ where gs.connected_peers.insert( peer, PeerConnections { - kind: kind.clone().unwrap_or(PeerKind::Floodsub), + kind: kind.unwrap_or(PeerKind::Floodsub), connections: vec![connection_id], topics: Default::default(), sender, + dont_send: LinkedHashMap::new(), }, ); @@ -625,6 +628,7 @@ fn test_join() { connections: vec![connection_id], topics: Default::default(), sender, + dont_send: LinkedHashMap::new(), }, ); receivers.insert(random_peer, receiver); @@ -1020,6 +1024,7 @@ fn test_get_random_peers() { connections: vec![ConnectionId::new_unchecked(0)], topics: topics.clone(), sender: Sender::new(gs.config.connection_handler_queue_len()), + dont_send: LinkedHashMap::new(), }, ); } @@ -4614,9 +4619,9 @@ fn test_ignore_too_many_messages_in_ihave() { let (peer, receiver) = add_peer(&mut gs, &topics, false, false); receivers.insert(peer, receiver); - // peer has 20 messages + // peer has 30 messages let mut seq = 0; - let message_ids: Vec<_> = (0..20) + let message_ids: Vec<_> = (0..30) .map(|_| random_message(&mut seq, &topics)) .map(|msg| gs.data_transform.inbound_transform(msg).unwrap()) .map(|msg| config.message_id(&msg)) @@ -4658,7 +4663,7 @@ fn test_ignore_too_many_messages_in_ihave() { gs.heartbeat(); gs.handle_ihave( &peer, - vec![(topics[0].clone(), message_ids[10..20].to_vec())], + vec![(topics[0].clone(), message_ids[20..30].to_vec())], ); // we sent 10 iwant messages ids via a IWANT rpc. @@ -5266,6 +5271,194 @@ fn test_graft_without_subscribe() { let _ = gs.unsubscribe(&Topic::new(topic)); } +/// Test that a node sends IDONTWANT messages to the mesh peers +/// that run Gossipsub v1.2. +#[test] +fn sends_idontwant() { + let (mut gs, peers, receivers, topic_hashes) = inject_nodes1() + .peer_no(5) + .topics(vec![String::from("topic1")]) + .to_subscribe(true) + .gs_config(Config::default()) + .explicit(1) + .peer_kind(PeerKind::Gossipsubv1_2) + .create_network(); + + let local_id = PeerId::random(); + + let message = RawMessage { + source: Some(peers[1]), + data: vec![12], + sequence_number: Some(0), + topic: topic_hashes[0].clone(), + signature: None, + key: None, + validated: true, + }; + gs.handle_received_message(message.clone(), &local_id); + assert_eq!( + receivers + .into_iter() + .fold(0, |mut idontwants, (peer_id, c)| { + let non_priority = c.non_priority.get_ref(); + while !non_priority.is_empty() { + if let Ok(RpcOut::IDontWant(_)) = non_priority.try_recv() { + assert_ne!(peer_id, peers[1]); + idontwants += 1; + } + } + idontwants + }), + 3, + "IDONTWANT was not sent" + ); +} + +/// Test that a node doesn't send IDONTWANT messages to the mesh peers +/// that don't run Gossipsub v1.2. +#[test] +fn doesnt_send_idontwant() { + let (mut gs, peers, receivers, topic_hashes) = inject_nodes1() + .peer_no(5) + .topics(vec![String::from("topic1")]) + .to_subscribe(true) + .gs_config(Config::default()) + .explicit(1) + .peer_kind(PeerKind::Gossipsubv1_1) + .create_network(); + + let local_id = PeerId::random(); + + let message = RawMessage { + source: Some(peers[1]), + data: vec![12], + sequence_number: Some(0), + topic: topic_hashes[0].clone(), + signature: None, + key: None, + validated: true, + }; + gs.handle_received_message(message.clone(), &local_id); + assert_eq!( + receivers + .into_iter() + .fold(0, |mut idontwants, (peer_id, c)| { + let non_priority = c.non_priority.get_ref(); + while !non_priority.is_empty() { + if matches!(non_priority.try_recv(), Ok(RpcOut::IDontWant(_)) if peer_id != peers[1]) { + idontwants += 1; + } + } + idontwants + }), + 0, + "IDONTWANT were sent" + ); +} + +/// Test that a node doesn't forward a messages to the mesh peers +/// that sent IDONTWANT. +#[test] +fn doesnt_forward_idontwant() { + let (mut gs, peers, receivers, topic_hashes) = inject_nodes1() + .peer_no(4) + .topics(vec![String::from("topic1")]) + .to_subscribe(true) + .gs_config(Config::default()) + .explicit(1) + .peer_kind(PeerKind::Gossipsubv1_2) + .create_network(); + + let local_id = PeerId::random(); + + let raw_message = RawMessage { + source: Some(peers[1]), + data: vec![12], + sequence_number: Some(0), + topic: topic_hashes[0].clone(), + signature: None, + key: None, + validated: true, + }; + let message = gs + .data_transform + .inbound_transform(raw_message.clone()) + .unwrap(); + let message_id = gs.config.message_id(&message); + let peer = gs.connected_peers.get_mut(&peers[2]).unwrap(); + peer.dont_send.insert(message_id, Instant::now()); + + gs.handle_received_message(raw_message.clone(), &local_id); + assert_eq!( + receivers.into_iter().fold(0, |mut fwds, (peer_id, c)| { + let non_priority = c.non_priority.get_ref(); + while !non_priority.is_empty() { + if let Ok(RpcOut::Forward { .. }) = non_priority.try_recv() { + assert_ne!(peer_id, peers[2]); + fwds += 1; + } + } + fwds + }), + 2, + "IDONTWANT was not sent" + ); +} + +/// Test that a node parses an +/// IDONTWANT message to the respective peer. +#[test] +fn parses_idontwant() { + let (mut gs, peers, _receivers, _topic_hashes) = inject_nodes1() + .peer_no(2) + .topics(vec![String::from("topic1")]) + .to_subscribe(true) + .gs_config(Config::default()) + .explicit(1) + .peer_kind(PeerKind::Gossipsubv1_2) + .create_network(); + + let message_id = MessageId::new(&[0, 1, 2, 3]); + let rpc = Rpc { + messages: vec![], + subscriptions: vec![], + control_msgs: vec![ControlAction::IDontWant(IDontWant { + message_ids: vec![message_id.clone()], + })], + }; + gs.on_connection_handler_event( + peers[1], + ConnectionId::new_unchecked(0), + HandlerEvent::Message { + rpc, + invalid_messages: vec![], + }, + ); + let peer = gs.connected_peers.get_mut(&peers[1]).unwrap(); + assert!(peer.dont_send.get(&message_id).is_some()); +} + +/// Test that a node clears stale IDONTWANT messages. +#[test] +fn clear_stale_idontwant() { + let (mut gs, peers, _receivers, _topic_hashes) = inject_nodes1() + .peer_no(4) + .topics(vec![String::from("topic1")]) + .to_subscribe(true) + .gs_config(Config::default()) + .explicit(1) + .peer_kind(PeerKind::Gossipsubv1_2) + .create_network(); + + let peer = gs.connected_peers.get_mut(&peers[2]).unwrap(); + peer.dont_send + .insert(MessageId::new(&[1, 2, 3, 4]), Instant::now()); + std::thread::sleep(Duration::from_secs(3)); + gs.heartbeat(); + let peer = gs.connected_peers.get_mut(&peers[2]).unwrap(); + assert!(peer.dont_send.is_empty()); +} + #[test] fn test_all_queues_full() { let gs_config = ConfigBuilder::default() @@ -5289,6 +5482,7 @@ fn test_all_queues_full() { connections: vec![ConnectionId::new_unchecked(0)], topics: topics.clone(), sender: Sender::new(2), + dont_send: LinkedHashMap::new(), }, ); @@ -5323,6 +5517,7 @@ fn test_slow_peer_returns_failed_publish() { connections: vec![ConnectionId::new_unchecked(0)], topics: topics.clone(), sender: Sender::new(2), + dont_send: LinkedHashMap::new(), }, ); let peer_id = PeerId::random(); @@ -5334,6 +5529,7 @@ fn test_slow_peer_returns_failed_publish() { connections: vec![ConnectionId::new_unchecked(0)], topics: topics.clone(), sender: Sender::new(gs.config.connection_handler_queue_len()), + dont_send: LinkedHashMap::new(), }, ); @@ -5386,7 +5582,6 @@ fn test_slow_peer_returns_failed_ihave_handling() { topics.insert(topic_hash.clone()); let slow_peer_id = PeerId::random(); - peers.push(slow_peer_id); gs.connected_peers.insert( slow_peer_id, PeerConnections { @@ -5394,6 +5589,7 @@ fn test_slow_peer_returns_failed_ihave_handling() { connections: vec![ConnectionId::new_unchecked(0)], topics: topics.clone(), sender: Sender::new(2), + dont_send: LinkedHashMap::new(), }, ); peers.push(slow_peer_id); @@ -5409,9 +5605,11 @@ fn test_slow_peer_returns_failed_ihave_handling() { connections: vec![ConnectionId::new_unchecked(0)], topics: topics.clone(), sender: Sender::new(gs.config.connection_handler_queue_len()), + dont_send: LinkedHashMap::new(), }, ); + // First message. let publish_data = vec![1; 59]; let transformed = gs .data_transform @@ -5431,6 +5629,22 @@ fn test_slow_peer_returns_failed_ihave_handling() { &slow_peer_id, vec![(topic_hash.clone(), vec![msg_id.clone()])], ); + + // Second message. + let publish_data = vec![2; 59]; + let transformed = gs + .data_transform + .outbound_transform(&topic_hash, publish_data.clone()) + .unwrap(); + let raw_message = gs + .build_raw_message(topic_hash.clone(), transformed) + .unwrap(); + let msg_id = gs.config.message_id(&Message { + source: raw_message.source, + data: publish_data, + sequence_number: raw_message.sequence_number, + topic: raw_message.topic.clone(), + }); gs.handle_ihave(&slow_peer_id, vec![(topic_hash, vec![msg_id.clone()])]); gs.heartbeat(); @@ -5487,6 +5701,7 @@ fn test_slow_peer_returns_failed_iwant_handling() { connections: vec![ConnectionId::new_unchecked(0)], topics: topics.clone(), sender: Sender::new(2), + dont_send: LinkedHashMap::new(), }, ); peers.push(slow_peer_id); @@ -5502,6 +5717,7 @@ fn test_slow_peer_returns_failed_iwant_handling() { connections: vec![ConnectionId::new_unchecked(0)], topics: topics.clone(), sender: Sender::new(gs.config.connection_handler_queue_len()), + dont_send: LinkedHashMap::new(), }, ); @@ -5577,6 +5793,7 @@ fn test_slow_peer_returns_failed_forward() { connections: vec![ConnectionId::new_unchecked(0)], topics: topics.clone(), sender: Sender::new(2), + dont_send: LinkedHashMap::new(), }, ); peers.push(slow_peer_id); @@ -5592,6 +5809,7 @@ fn test_slow_peer_returns_failed_forward() { connections: vec![ConnectionId::new_unchecked(0)], topics: topics.clone(), sender: Sender::new(gs.config.connection_handler_queue_len()), + dont_send: LinkedHashMap::new(), }, ); @@ -5672,6 +5890,7 @@ fn test_slow_peer_is_downscored_on_publish() { connections: vec![ConnectionId::new_unchecked(0)], topics: topics.clone(), sender: Sender::new(2), + dont_send: LinkedHashMap::new(), }, ); gs.peer_score.as_mut().unwrap().0.add_peer(slow_peer_id); @@ -5684,6 +5903,7 @@ fn test_slow_peer_is_downscored_on_publish() { connections: vec![ConnectionId::new_unchecked(0)], topics: topics.clone(), sender: Sender::new(gs.config.connection_handler_queue_len()), + dont_send: LinkedHashMap::new(), }, ); diff --git a/protocols/gossipsub/src/generated/gossipsub/pb.rs b/protocols/gossipsub/src/generated/gossipsub/pb.rs index 9a074fd61fc..24ac80d2755 100644 --- a/protocols/gossipsub/src/generated/gossipsub/pb.rs +++ b/protocols/gossipsub/src/generated/gossipsub/pb.rs @@ -154,6 +154,7 @@ pub struct ControlMessage { pub iwant: Vec, pub graft: Vec, pub prune: Vec, + pub idontwant: Vec, } impl<'a> MessageRead<'a> for ControlMessage { @@ -165,6 +166,7 @@ impl<'a> MessageRead<'a> for ControlMessage { Ok(18) => msg.iwant.push(r.read_message::(bytes)?), Ok(26) => msg.graft.push(r.read_message::(bytes)?), Ok(34) => msg.prune.push(r.read_message::(bytes)?), + Ok(42) => msg.idontwant.push(r.read_message::(bytes)?), Ok(t) => { r.read_unknown(bytes, t)?; } Err(e) => return Err(e), } @@ -180,6 +182,7 @@ impl MessageWrite for ControlMessage { + self.iwant.iter().map(|s| 1 + sizeof_len((s).get_size())).sum::() + self.graft.iter().map(|s| 1 + sizeof_len((s).get_size())).sum::() + self.prune.iter().map(|s| 1 + sizeof_len((s).get_size())).sum::() + + self.idontwant.iter().map(|s| 1 + sizeof_len((s).get_size())).sum::() } fn write_message(&self, w: &mut Writer) -> Result<()> { @@ -187,6 +190,7 @@ impl MessageWrite for ControlMessage { for s in &self.iwant { w.write_with_tag(18, |w| w.write_message(s))?; } for s in &self.graft { w.write_with_tag(26, |w| w.write_message(s))?; } for s in &self.prune { w.write_with_tag(34, |w| w.write_message(s))?; } + for s in &self.idontwant { w.write_with_tag(42, |w| w.write_message(s))?; } Ok(()) } } @@ -331,6 +335,38 @@ impl MessageWrite for ControlPrune { } } +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Debug, Default, PartialEq, Clone)] +pub struct ControlIDontWant { + pub message_ids: Vec>, +} + +impl<'a> MessageRead<'a> for ControlIDontWant { + fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result { + let mut msg = Self::default(); + while !r.is_eof() { + match r.next_tag(bytes) { + Ok(10) => msg.message_ids.push(r.read_bytes(bytes)?.to_owned()), + Ok(t) => { r.read_unknown(bytes, t)?; } + Err(e) => return Err(e), + } + } + Ok(msg) + } +} + +impl MessageWrite for ControlIDontWant { + fn get_size(&self) -> usize { + 0 + + self.message_ids.iter().map(|s| 1 + sizeof_len((s).len())).sum::() + } + + fn write_message(&self, w: &mut Writer) -> Result<()> { + for s in &self.message_ids { w.write_with_tag(10, |w| w.write_bytes(&**s))?; } + Ok(()) + } +} + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Debug, Default, PartialEq, Clone)] pub struct PeerInfo { diff --git a/protocols/gossipsub/src/generated/rpc.proto b/protocols/gossipsub/src/generated/rpc.proto index 2ce12f3f37f..fe4d3bc9366 100644 --- a/protocols/gossipsub/src/generated/rpc.proto +++ b/protocols/gossipsub/src/generated/rpc.proto @@ -19,8 +19,8 @@ message Message { optional bytes data = 2; optional bytes seqno = 3; required string topic = 4; - optional bytes signature = 5; - optional bytes key = 6; + optional bytes signature = 5; + optional bytes key = 6; } message ControlMessage { @@ -28,6 +28,7 @@ message ControlMessage { repeated ControlIWant iwant = 2; repeated ControlGraft graft = 3; repeated ControlPrune prune = 4; + repeated ControlIDontWant idontwant = 5; } message ControlIHave { @@ -49,6 +50,10 @@ message ControlPrune { optional uint64 backoff = 3; // gossipsub v1.1 backoff time (in seconds) } +message ControlIDontWant { + repeated bytes message_ids = 1; +} + message PeerInfo { optional bytes peer_id = 1; optional bytes signed_peer_record = 2; diff --git a/protocols/gossipsub/src/gossip_promises.rs b/protocols/gossipsub/src/gossip_promises.rs index b64811bb062..284ba7cab01 100644 --- a/protocols/gossipsub/src/gossip_promises.rs +++ b/protocols/gossipsub/src/gossip_promises.rs @@ -41,6 +41,14 @@ impl GossipPromises { self.promises.contains_key(message) } + /// Get the peers we sent IWANT the input message id. + pub(crate) fn peers_for_message(&self, message_id: &MessageId) -> Vec { + self.promises + .get(message_id) + .map(|peers| peers.keys().copied().collect()) + .unwrap_or_default() + } + /// Track a promise to deliver a message from a list of [`MessageId`]s we are requesting. pub(crate) fn add_promise(&mut self, peer: PeerId, messages: &[MessageId], expires: Instant) { for message_id in messages { diff --git a/protocols/gossipsub/src/handler.rs b/protocols/gossipsub/src/handler.rs index 2936182c3f8..e66b606896b 100644 --- a/protocols/gossipsub/src/handler.rs +++ b/protocols/gossipsub/src/handler.rs @@ -229,7 +229,7 @@ impl EnabledHandler { if let Some(peer_kind) = self.peer_kind.as_ref() { self.peer_kind_sent = true; return Poll::Ready(ConnectionHandlerEvent::NotifyBehaviour( - HandlerEvent::PeerKind(peer_kind.clone()), + HandlerEvent::PeerKind(*peer_kind), )); } } diff --git a/protocols/gossipsub/src/metrics.rs b/protocols/gossipsub/src/metrics.rs index 2519da64b73..42dedc000b7 100644 --- a/protocols/gossipsub/src/metrics.rs +++ b/protocols/gossipsub/src/metrics.rs @@ -187,6 +187,12 @@ pub(crate) struct Metrics { /// topic. A very high metric might indicate an underperforming network. topic_iwant_msgs: Family, + /// The number of times we have received an IDONTWANT control message. + idontwant_msgs: Counter, + + /// The number of msg_id's we have received in every IDONTWANT control message. + idontwant_msgs_ids: Counter, + /// The size of the priority queue. priority_queue_size: Histogram, /// The size of the non-priority queue. @@ -324,6 +330,27 @@ impl Metrics { "topic_iwant_msgs", "Number of times we have decided an IWANT is required for this topic" ); + + let idontwant_msgs = { + let metric = Counter::default(); + registry.register( + "idontwant_msgs", + "The number of times we have received an IDONTWANT control message", + metric.clone(), + ); + metric + }; + + let idontwant_msgs_ids = { + let metric = Counter::default(); + registry.register( + "idontwant_msgs_ids", + "The number of msg_id's we have received in every total of all IDONTWANT control message.", + metric.clone(), + ); + metric + }; + let memcache_misses = { let metric = Counter::default(); registry.register( @@ -376,6 +403,8 @@ impl Metrics { heartbeat_duration, memcache_misses, topic_iwant_msgs, + idontwant_msgs, + idontwant_msgs_ids, priority_queue_size, non_priority_queue_size, } @@ -574,6 +603,12 @@ impl Metrics { } } + /// Register receiving an IDONTWANT msg for this topic. + pub(crate) fn register_idontwant(&mut self, msgs: usize) { + self.idontwant_msgs.inc(); + self.idontwant_msgs_ids.inc_by(msgs as u64); + } + /// Observes a heartbeat duration. pub(crate) fn observe_heartbeat_duration(&mut self, millis: u64) { self.heartbeat_duration.observe(millis as f64); diff --git a/protocols/gossipsub/src/protocol.rs b/protocols/gossipsub/src/protocol.rs index e4272737342..7ee6d5c8245 100644 --- a/protocols/gossipsub/src/protocol.rs +++ b/protocols/gossipsub/src/protocol.rs @@ -35,14 +35,19 @@ use crate::{ rpc_proto::proto, topic::TopicHash, types::{ - ControlAction, Graft, IHave, IWant, MessageId, PeerInfo, PeerKind, Prune, RawMessage, Rpc, - Subscription, SubscriptionAction, + ControlAction, Graft, IDontWant, IHave, IWant, MessageId, PeerInfo, PeerKind, Prune, + RawMessage, Rpc, Subscription, SubscriptionAction, }, ValidationError, }; pub(crate) const SIGNING_PREFIX: &[u8] = b"libp2p-pubsub:"; +pub(crate) const GOSSIPSUB_1_2_0_PROTOCOL: ProtocolId = ProtocolId { + protocol: StreamProtocol::new("/meshsub/1.2.0"), + kind: PeerKind::Gossipsubv1_2, +}; + pub(crate) const GOSSIPSUB_1_1_0_PROTOCOL: ProtocolId = ProtocolId { protocol: StreamProtocol::new("/meshsub/1.1.0"), kind: PeerKind::Gossipsubv1_1, @@ -72,7 +77,11 @@ impl Default for ProtocolConfig { Self { max_transmit_size: 65536, validation_mode: ValidationMode::Strict, - protocol_ids: vec![GOSSIPSUB_1_1_0_PROTOCOL, GOSSIPSUB_1_0_0_PROTOCOL], + protocol_ids: vec![ + GOSSIPSUB_1_2_0_PROTOCOL, + GOSSIPSUB_1_1_0_PROTOCOL, + GOSSIPSUB_1_0_0_PROTOCOL, + ], } } } @@ -479,10 +488,25 @@ impl Decoder for GossipsubCodec { })); } + let idontwant_msgs: Vec = rpc_control + .idontwant + .into_iter() + .map(|idontwant| { + ControlAction::IDontWant(IDontWant { + message_ids: idontwant + .message_ids + .into_iter() + .map(MessageId::from) + .collect::>(), + }) + }) + .collect(); + control_msgs.extend(ihave_msgs); control_msgs.extend(iwant_msgs); control_msgs.extend(graft_msgs); control_msgs.extend(prune_msgs); + control_msgs.extend(idontwant_msgs); } Ok(Some(HandlerEvent::Message { diff --git a/protocols/gossipsub/src/rpc.rs b/protocols/gossipsub/src/rpc.rs index b5f05c7b2e5..41b338267e9 100644 --- a/protocols/gossipsub/src/rpc.rs +++ b/protocols/gossipsub/src/rpc.rs @@ -89,7 +89,7 @@ impl Sender { | RpcOut::Prune(_) | RpcOut::Subscribe(_) | RpcOut::Unsubscribe(_) => &self.priority_sender, - RpcOut::Forward { .. } | RpcOut::IHave(_) | RpcOut::IWant(_) => { + RpcOut::Forward { .. } | RpcOut::IHave(_) | RpcOut::IWant(_) | RpcOut::IDontWant(_) => { &self.non_priority_sender } }; diff --git a/protocols/gossipsub/src/types.rs b/protocols/gossipsub/src/types.rs index bcb1f279ae5..6681eca1d93 100644 --- a/protocols/gossipsub/src/types.rs +++ b/protocols/gossipsub/src/types.rs @@ -22,12 +22,14 @@ use std::{collections::BTreeSet, fmt, fmt::Debug}; use futures_timer::Delay; +use hashlink::LinkedHashMap; use libp2p_identity::PeerId; use libp2p_swarm::ConnectionId; use prometheus_client::encoding::EncodeLabelValue; use quick_protobuf::MessageWrite; #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; +use web_time::Instant; use crate::{rpc::Sender, rpc_proto::proto, TopicHash}; @@ -109,11 +111,15 @@ pub(crate) struct PeerConnections { pub(crate) topics: BTreeSet, /// The rpc sender to the connection handler(s). pub(crate) sender: Sender, + /// Don't send messages. + pub(crate) dont_send: LinkedHashMap, } /// Describes the types of peers that can exist in the gossipsub context. -#[derive(Debug, Clone, PartialEq, Hash, EncodeLabelValue, Eq)] +#[derive(Debug, Clone, Copy, PartialEq, Hash, EncodeLabelValue, Eq)] pub enum PeerKind { + /// A gossipsub 1.2 peer. + Gossipsubv1_2, /// A gossipsub 1.1 peer. Gossipsubv1_1, /// A gossipsub 1.0 peer. @@ -149,6 +155,16 @@ pub struct RawMessage { pub validated: bool, } +impl PeerKind { + /// Returns true if peer speaks any gossipsub version. + pub(crate) fn is_gossipsub(&self) -> bool { + matches!( + self, + Self::Gossipsubv1_2 | Self::Gossipsubv1_1 | Self::Gossipsub + ) + } +} + impl RawMessage { /// Calculates the encoded length of this message (used for calculating metrics). pub fn raw_protobuf_len(&self) -> usize { @@ -246,6 +262,9 @@ pub enum ControlAction { Graft(Graft), /// The node has been removed from the mesh - Prune control message. Prune(Prune), + /// The node requests us to not forward message ids (peer_id + sequence _number) - IDontWant + /// control message. + IDontWant(IDontWant), } /// Node broadcasts known messages per topic - IHave control message. @@ -282,6 +301,13 @@ pub struct Prune { pub(crate) backoff: Option, } +/// The node requests us to not forward message ids - IDontWant control message. +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct IDontWant { + /// A list of known message ids. + pub(crate) message_ids: Vec, +} + /// A Gossipsub RPC message sent. #[derive(Debug)] pub enum RpcOut { @@ -303,6 +329,9 @@ pub enum RpcOut { IHave(IHave), /// Send a IWant control message. IWant(IWant), + /// The node requests us to not forward message ids (peer_id + sequence _number) - IDontWant + /// control message. + IDontWant(IDontWant), } impl RpcOut { @@ -363,6 +392,7 @@ impl From for proto::RPC { iwant: vec![], graft: vec![], prune: vec![], + idontwant: vec![], }), }, RpcOut::IWant(IWant { message_ids }) => proto::RPC { @@ -375,6 +405,7 @@ impl From for proto::RPC { }], graft: vec![], prune: vec![], + idontwant: vec![], }), }, RpcOut::Graft(Graft { topic_hash }) => proto::RPC { @@ -387,6 +418,7 @@ impl From for proto::RPC { topic_id: Some(topic_hash.into_string()), }], prune: vec![], + idontwant: vec![], }), }, RpcOut::Prune(Prune { @@ -413,9 +445,23 @@ impl From for proto::RPC { .collect(), backoff, }], + idontwant: vec![], }), } } + RpcOut::IDontWant(IDontWant { message_ids }) => proto::RPC { + publish: Vec::new(), + subscriptions: Vec::new(), + control: Some(proto::ControlMessage { + ihave: vec![], + iwant: vec![], + graft: vec![], + prune: vec![], + idontwant: vec![proto::ControlIDontWant { + message_ids: message_ids.into_iter().map(|msg_id| msg_id.0).collect(), + }], + }), + }, } } } @@ -474,6 +520,7 @@ impl From for proto::RPC { iwant: Vec::new(), graft: Vec::new(), prune: Vec::new(), + idontwant: Vec::new(), }; let empty_control_msg = rpc.control_msgs.is_empty(); @@ -522,6 +569,12 @@ impl From for proto::RPC { }; control.prune.push(rpc_prune); } + ControlAction::IDontWant(IDontWant { message_ids }) => { + let rpc_idontwant = proto::ControlIDontWant { + message_ids: message_ids.into_iter().map(|msg_id| msg_id.0).collect(), + }; + control.idontwant.push(rpc_idontwant); + } } } @@ -560,6 +613,7 @@ impl PeerKind { Self::Floodsub => "Floodsub", Self::Gossipsub => "Gossipsub v1.0", Self::Gossipsubv1_1 => "Gossipsub v1.1", + Self::Gossipsubv1_2 => "Gossipsub v1.2", } } } From 1ab46587d4178c00d12f336c15be73e8ae41602f Mon Sep 17 00:00:00 2001 From: hanabi1224 Date: Sat, 28 Dec 2024 06:26:22 +0800 Subject: [PATCH 08/56] chore(deps): update Cargo.lock - run `cargo update` - lock `webrtc-ice = "=0.10.0"` to not break webrtc smoke tests - fix `cargo clippy` warnings - update `deny.toml` accordingly Pull-Request: #5755. --- Cargo.lock | 1714 +++++++++++----------- transports/webrtc/Cargo.toml | 3 +- wasm-tests/webtransport-tests/src/lib.rs | 32 +- 3 files changed, 888 insertions(+), 861 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5d9a22cf579..e6f00ab4c9f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,18 +4,18 @@ version = 3 [[package]] name = "addr2line" -version = "0.20.0" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" dependencies = [ "gimli", ] [[package]] -name = "adler" -version = "1.0.2" +name = "adler2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" [[package]] name = "aead" @@ -29,9 +29,9 @@ dependencies = [ [[package]] name = "aes" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" dependencies = [ "cfg-if", "cipher", @@ -54,9 +54,9 @@ dependencies = [ [[package]] name = "ahash" -version = "0.8.7" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if", "once_cell", @@ -66,18 +66,18 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.0.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] [[package]] name = "allocator-api2" -version = "0.2.16" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] name = "anes" @@ -87,9 +87,9 @@ checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" [[package]] name = "anstream" -version = "0.6.15" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" +checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" dependencies = [ "anstyle", "anstyle-parse", @@ -108,55 +108,55 @@ checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" [[package]] name = "anstyle-parse" -version = "0.2.1" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" +checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.0.0" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.1" +version = "3.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" +checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125" dependencies = [ "anstyle", - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04" [[package]] name = "arbitrary" -version = "1.3.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2d098ff73c1ca148721f37baad5ea6a465a13f9573aba8641fbbbae8164a54e" +checksum = "dde20b3d026af13f561bdd0f15edf01fc734f0dafcedbaf42bba506a9517f223" [[package]] name = "arc-swap" -version = "1.6.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6" +checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457" [[package]] name = "arrayref" -version = "0.3.7" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" +checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" [[package]] name = "asn1-rs" @@ -170,23 +170,23 @@ dependencies = [ "nom", "num-traits", "rusticata-macros", - "thiserror 1.0.63", + "thiserror 1.0.69", "time", ] [[package]] name = "asn1-rs" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22ad1373757efa0f70ec53939aabc7152e1591cb485208052993070ac8d2429d" +checksum = "5493c3bedbacf7fd7382c6346bbd66687d12bbaad3a89a2d2c303ee6cf20b048" dependencies = [ - "asn1-rs-derive 0.5.0", + "asn1-rs-derive 0.5.1", "asn1-rs-impl 0.2.0", "displaydoc", "nom", "num-traits", "rusticata-macros", - "thiserror 1.0.63", + "thiserror 1.0.69", "time", ] @@ -204,13 +204,13 @@ dependencies = [ [[package]] name = "asn1-rs-derive" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7378575ff571966e99a744addeff0bff98b8ada0dedf1956d59e634db95eaac1" +checksum = "965c2d33e53cb6b267e148a4cb0760bc01f4904c1cd4bb4002a085bb016d1490" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.92", "synstructure 0.13.1", ] @@ -233,7 +233,7 @@ checksum = "7b18050c2cd6fe86c3a76584ef5e0baf286d038cda203eb6223df2cc413565f7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.92", ] [[package]] @@ -270,7 +270,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "89b47800b0be77592da0afd425cc03468052844aff33b84e33cc696f64e77b6a" dependencies = [ "concurrent-queue", - "event-listener-strategy 0.5.2", + "event-listener-strategy", "futures-core", "pin-project-lite", ] @@ -294,21 +294,21 @@ version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebcd09b382f40fcd159c2d695175b2ae620ffa5f3bd6f664131efff4e8b9e04a" dependencies = [ - "async-lock 3.1.0", + "async-lock", "blocking", "futures-lite", ] [[package]] name = "async-global-executor" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b4353121d5644cdf2beb5726ab752e79a8db1ebb52031770ec47db31d245526" +checksum = "05b1b633a2115cd122d73b955eadd9916c18c8f510ec9cd1686404c60ad1c29c" dependencies = [ "async-channel 2.3.1", "async-executor", "async-io", - "async-lock 3.1.0", + "async-lock", "blocking", "futures-lite", "once_cell", @@ -316,11 +316,11 @@ dependencies = [ [[package]] name = "async-io" -version = "2.3.3" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d6baa8f0178795da0e71bc42c9e5d13261aac7ee549853162e66a241ba17964" +checksum = "43a2b323ccce0a1d90b449fd71f2a06ca7faa7c54c2751f06c9bd851fc061059" dependencies = [ - "async-lock 3.1.0", + "async-lock", "cfg-if", "concurrent-queue", "futures-io", @@ -330,26 +330,17 @@ dependencies = [ "rustix", "slab", "tracing", - "windows-sys 0.52.0", -] - -[[package]] -name = "async-lock" -version = "2.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa24f727524730b077666307f2734b4a1a1c57acb79193127dcc8914d5242dd7" -dependencies = [ - "event-listener 2.5.3", + "windows-sys 0.59.0", ] [[package]] name = "async-lock" -version = "3.1.0" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "deb2ab2aa8a746e221ab826c73f48bc6ba41be6763f0855cb249eb6d154cf1d7" +checksum = "ff6e472cdea888a4bd64f342f09b3f50e1886d32afe8df3d663c01140b811b18" dependencies = [ - "event-listener 3.1.0", - "event-listener-strategy 0.3.0", + "event-listener 5.3.1", + "event-listener-strategy", "pin-project-lite", ] @@ -366,20 +357,21 @@ dependencies = [ [[package]] name = "async-process" -version = "2.1.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "451e3cf68011bd56771c79db04a9e333095ab6349f7e47592b788e9b98720cc8" +checksum = "63255f1dc2381611000436537bbedfe83183faa303a5a0edaf191edef06526bb" dependencies = [ "async-channel 2.3.1", "async-io", - "async-lock 3.1.0", + "async-lock", "async-signal", + "async-task", "blocking", "cfg-if", "event-listener 5.3.1", "futures-lite", "rustix", - "windows-sys 0.52.0", + "tracing", ] [[package]] @@ -390,17 +382,17 @@ checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.92", ] [[package]] name = "async-signal" -version = "0.2.5" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e47d90f65a225c4527103a8d747001fc56e375203592b25ad103e1ca13124c5" +checksum = "637e00349800c0bdf8bfc21ebbc0b6524abea702b0da4168ac00d070d0c0b9f3" dependencies = [ "async-io", - "async-lock 2.7.0", + "async-lock", "atomic-waker", "cfg-if", "futures-core", @@ -408,7 +400,7 @@ dependencies = [ "rustix", "signal-hook-registry", "slab", - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] @@ -421,7 +413,7 @@ dependencies = [ "async-channel 1.9.0", "async-global-executor", "async-io", - "async-lock 3.1.0", + "async-lock", "async-process", "crossbeam-utils", "futures-channel", @@ -456,9 +448,9 @@ dependencies = [ [[package]] name = "async-stream" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" +checksum = "0b5a71a6f37880a80d1d7f19efd781e4b5de42c88f0722cc13bcb6cc2cfe8476" dependencies = [ "async-stream-impl", "futures-core", @@ -467,30 +459,30 @@ dependencies = [ [[package]] name = "async-stream-impl" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" +checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.92", ] [[package]] name = "async-task" -version = "4.4.0" +version = "4.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecc7ab41815b3c653ccd2978ec3255c81349336702dfdf62ee6f7069b12a3aae" +checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" [[package]] name = "async-trait" -version = "0.1.80" +version = "0.1.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" +checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.92", ] [[package]] @@ -508,9 +500,9 @@ dependencies = [ [[package]] name = "atomic-waker" -version = "1.1.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1181e1e0d1fce796a03db1ae795d67167da795f9cf4a39c37589e85ef57f26d3" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" [[package]] name = "attohttpc" @@ -518,16 +510,16 @@ version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d9a9bf8b79a749ee0b911b91b671cc2b6c670bdbc7e3dfd537576ddc94bb2a2" dependencies = [ - "http 0.2.9", + "http 0.2.12", "log", "url", ] [[package]] name = "autocfg" -version = "1.1.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "autonat-example" @@ -558,15 +550,15 @@ dependencies = [ [[package]] name = "axum" -version = "0.7.5" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a6c9af12842a67734c9a2e355436e5d03b22383ed60cf13cd0c18fbfe3dcbcf" +checksum = "edca88bc138befd0323b20752846e6587272d3b03b0343c8ea28a6f819e6e71f" dependencies = [ "async-trait", "axum-core", "bytes", "futures-util", - "http 1.1.0", + "http 1.2.0", "http-body", "http-body-util", "hyper", @@ -582,9 +574,9 @@ dependencies = [ "serde_json", "serde_path_to_error", "serde_urlencoded", - "sync_wrapper 1.0.0", + "sync_wrapper", "tokio", - "tower", + "tower 0.5.2", "tower-layer", "tower-service", "tracing", @@ -592,20 +584,20 @@ dependencies = [ [[package]] name = "axum-core" -version = "0.4.3" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a15c63fd72d41492dc4f497196f5da1fb04fb7529e631d73630d1b491e47a2e3" +checksum = "09f2bd6146b97ae3359fa0cc6d6b376d9539582c7b4220f041a33ec24c226199" dependencies = [ "async-trait", "bytes", "futures-util", - "http 1.1.0", + "http 1.2.0", "http-body", "http-body-util", "mime", "pin-project-lite", "rustversion", - "sync_wrapper 0.1.2", + "sync_wrapper", "tower-layer", "tower-service", "tracing", @@ -613,17 +605,17 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.68" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" dependencies = [ "addr2line", - "cc", "cfg-if", "libc", "miniz_oxide", "object", "rustc-demangle", + "windows-targets 0.52.6", ] [[package]] @@ -685,9 +677,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.1" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "blake2" @@ -754,7 +746,7 @@ dependencies = [ "rust-embed", "tokio", "tokio-util", - "tower", + "tower 0.4.13", "tower-http", "tracing", "tracing-subscriber", @@ -775,9 +767,9 @@ dependencies = [ [[package]] name = "bstr" -version = "1.6.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6798148dccfbff0fae41c7574d2fa8f1ef3492fba0face179de5d8d447d67b05" +checksum = "786a307d683a5bf92e6fd5fd69a7eb613751668d1d8d67d802846dfe367c62c8" dependencies = [ "memchr", "serde", @@ -785,9 +777,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.13.0" +version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "byteorder" @@ -821,20 +813,20 @@ dependencies = [ [[package]] name = "cbor4ii" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59b4c883b9cc4757b061600d39001d4d0232bece4a3174696cf8f58a14db107d" +checksum = "472931dd4dfcc785075b09be910147f9c6258883fc4591d0dac6116392b2daa6" dependencies = [ "serde", ] [[package]] name = "cc" -version = "1.0.83" +version = "1.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +checksum = "8d6dbb628b8f8555f86d0323c2eb39e3ec81901f4b83e091db8a6a76d316a333" dependencies = [ - "libc", + "shlex", ] [[package]] @@ -897,9 +889,9 @@ dependencies = [ [[package]] name = "ciborium" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "effd91f6c78e5a4ace8a5d3c0b6bfaec9e2baaef55f3efc00e45fb2e477ee926" +checksum = "42e69ffd6f0917f5c029256a24d0161db17cea3997d185db0d35926308770f0e" dependencies = [ "ciborium-io", "ciborium-ll", @@ -908,15 +900,15 @@ dependencies = [ [[package]] name = "ciborium-io" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdf919175532b369853f5d5e20b26b43112613fd6fe7aee757e35f7a44642656" +checksum = "05afea1e0a06c9be33d539b876f1ce3692f4afea2cb41f740e7743225ed1c757" [[package]] name = "ciborium-ll" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "defaa24ecc093c77630e6c15e17c51f5e187bf35ee514f4e2d67baaa96dae22b" +checksum = "57663b653d948a338bfb3eeba9bb2fd5fcfaecb9e199e87e1eda4d9e8b240fd9" dependencies = [ "ciborium-io", "half", @@ -935,9 +927,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.6" +version = "4.5.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9689a29b593160de5bc4aacab7b5d54fb52231de70122626c178e6a368994c7" +checksum = "3135e7ec2ef7b10c6ed8950f0f792ed96ee093fa088608f1c76e569722700c84" dependencies = [ "clap_builder", "clap_derive", @@ -945,9 +937,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.6" +version = "4.5.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e5387378c84f6faa26890ebf9f0a92989f8873d4d380467bcd0d8d8620424df" +checksum = "30582fc632330df2bd26877bde0c1f4470d57c582bbc070376afcd04d8cb4838" dependencies = [ "anstream", "anstyle", @@ -957,33 +949,33 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.5" +version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c780290ccf4fb26629baa7a1081e68ced113f1d3ec302fa5948f1c381ebf06c6" +checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" dependencies = [ - "heck 0.5.0", + "heck", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.92", ] [[package]] name = "clap_lex" -version = "0.7.0" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" +checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" [[package]] name = "colorchoice" -version = "1.0.0" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" +checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" [[package]] name = "combine" -version = "4.6.6" +version = "4.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4" +checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" dependencies = [ "bytes", "futures-core", @@ -1014,15 +1006,15 @@ dependencies = [ [[package]] name = "const-oid" -version = "0.9.4" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "795bc6e66a8e340f075fcf6227e417a2dc976b92b91f3cdc778bb858778b6747" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" [[package]] name = "core-foundation" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" dependencies = [ "core-foundation-sys", "libc", @@ -1045,27 +1037,27 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.9" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" +checksum = "16b80225097f2e5ae4e7179dd2266824648f3e2f49d9134d584b76389d31c4c3" dependencies = [ "libc", ] [[package]] name = "crc" -version = "3.0.1" +version = "3.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86ec7a15cbe22e59248fc7eadb1907dab5ba09372595da4d73dd805ed4417dfe" +checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636" dependencies = [ "crc-catalog", ] [[package]] name = "crc-catalog" -version = "2.2.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cace84e55f07e7301bae1c519df89cdad8cc3cd868413d3fdbdeca9ff3db484" +checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" [[package]] name = "criterion" @@ -1080,7 +1072,7 @@ dependencies = [ "criterion-plot", "futures", "is-terminal", - "itertools", + "itertools 0.10.5", "num-traits", "once_cell", "oorandom", @@ -1102,47 +1094,42 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6b50826342786a51a89e2da3a28f1c32b06e387201bc2d19791f622c673706b1" dependencies = [ "cast", - "itertools", + "itertools 0.10.5", ] [[package]] name = "crossbeam-channel" -version = "0.5.13" +version = "0.5.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" +checksum = "06ba6d68e24814cb8de6bb986db8222d3a027d15872cabc0d18817bc3c0e4471" dependencies = [ "crossbeam-utils", ] [[package]] name = "crossbeam-deque" -version = "0.8.3" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" dependencies = [ - "cfg-if", "crossbeam-epoch", "crossbeam-utils", ] [[package]] name = "crossbeam-epoch" -version = "0.9.15" +version = "0.9.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" dependencies = [ - "autocfg", - "cfg-if", "crossbeam-utils", - "memoffset 0.9.0", - "scopeguard", ] [[package]] name = "crossbeam-utils" -version = "0.8.20" +version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" [[package]] name = "crunchy" @@ -1152,9 +1139,9 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "crypto-bigint" -version = "0.5.2" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4c2f4e1afd912bc40bfd6fed5d9dc1f288e0ba01bfcc835cc5bc3eb13efe15" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ "generic-array", "rand_core 0.6.4", @@ -1221,13 +1208,13 @@ dependencies = [ [[package]] name = "curve25519-dalek-derive" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83fdaf97f4804dcebfa5862639bc9ce4121e82140bec2a987ac5140294865b5b" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.92", ] [[package]] @@ -1238,9 +1225,9 @@ checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" [[package]] name = "data-encoding-macro" -version = "0.1.13" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c904b33cc60130e1aeea4956ab803d08a3f4a0ca82d64ed757afac3891f2bb99" +checksum = "f1559b6cba622276d6d63706db152618eeb15b89b3e4041446b05876e352e639" dependencies = [ "data-encoding", "data-encoding-macro-internal", @@ -1248,9 +1235,9 @@ dependencies = [ [[package]] name = "data-encoding-macro-internal" -version = "0.1.11" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fdf3fce3ce863539ec1d7fd1b6dcc3c645663376b43ed376bbf887733e4f772" +checksum = "332d754c0af53bc87c108fed664d121ecf59207ec4196041f04d6ab9002ad33f" dependencies = [ "data-encoding", "syn 1.0.109", @@ -1271,9 +1258,9 @@ dependencies = [ [[package]] name = "der" -version = "0.7.7" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c7ed52955ce76b1554f509074bb357d3fb8ac9b51288a65a3fd480d1dfba946" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" dependencies = [ "const-oid", "pem-rfc7468", @@ -1300,7 +1287,7 @@ version = "9.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5cd0a5c643689626bec213c4d8bd4d96acc8ffdb4ad4bb6bc16abf27d5f4b553" dependencies = [ - "asn1-rs 0.6.1", + "asn1-rs 0.6.2", "displaydoc", "nom", "num-bigint", @@ -1340,33 +1327,34 @@ dependencies = [ [[package]] name = "dirs" -version = "4.0.0" +version = "5.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" +checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" dependencies = [ "dirs-sys", ] [[package]] name = "dirs-sys" -version = "0.3.7" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" +checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" dependencies = [ "libc", + "option-ext", "redox_users", - "winapi", + "windows-sys 0.48.0", ] [[package]] name = "displaydoc" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.92", ] [[package]] @@ -1387,9 +1375,9 @@ checksum = "dcbb2bf8e87535c23f7a8a321e364ce21462d0ff10cb6407820e8e96dfff6653" [[package]] name = "ecdsa" -version = "0.16.8" +version = "0.16.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4b1e0c257a9e9f25f90ff76d7a68360ed497ee519c8e428d1825ef0000799d4" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" dependencies = [ "der", "digest 0.10.7", @@ -1401,9 +1389,9 @@ dependencies = [ [[package]] name = "ed25519" -version = "2.2.2" +version = "2.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60f6d271ca33075c88028be6f04d502853d63a5ece419d269c15315d4fc1cf1d" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" dependencies = [ "pkcs8", "signature", @@ -1426,9 +1414,9 @@ dependencies = [ [[package]] name = "either" -version = "1.12.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[package]] name = "elliptic-curve" @@ -1453,30 +1441,30 @@ dependencies = [ [[package]] name = "encoding_rs" -version = "0.8.32" +version = "0.8.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" dependencies = [ "cfg-if", ] [[package]] name = "enum-as-inner" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ffccbb6966c05b32ef8fbac435df276c4ae4d3dc55a8cd0eb9745e6c12f546a" +checksum = "a1e6a265c649f3f5979b601d26f1d05ada116434c87741c9493cb56218f76cbc" dependencies = [ - "heck 0.4.1", + "heck", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.92", ] [[package]] name = "env_filter" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f2c92ceda6ceec50f43169f9ee8424fe2db276791afde7b2cd8bc084cb376ab" +checksum = "186e05a59d4c50738528153b83b0b0194d3a29507dfec16eccd4b342903397d0" dependencies = [ "log", "regex", @@ -1494,9 +1482,9 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.11.5" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13fa619b91fb2381732789fc5de83b45675e882f66623b7d8cb4f643017018d" +checksum = "dcaee3d8e3cfc3fd92428d477bc97fc29ec8716d180c0d74c643bb26166660e0" dependencies = [ "anstream", "anstyle", @@ -1513,12 +1501,12 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.8" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" +checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -1527,17 +1515,6 @@ 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" version = "5.3.1" @@ -1551,19 +1528,9 @@ dependencies = [ [[package]] name = "event-listener-strategy" -version = "0.3.0" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d96b852f1345da36d551b9473fa1e2b1eb5c5195585c6c018118bc92a8d91160" -dependencies = [ - "event-listener 3.1.0", - "pin-project-lite", -] - -[[package]] -name = "event-listener-strategy" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f214dc438f977e6d4e3500aaa277f5ad94ca83fbbd9b1a15713ce2344ccc5a1" +checksum = "3c3e4e0dd3673c1139bf041f3008816d9cf2946bbfac2945c09e523b8d7b05b2" dependencies = [ "event-listener 5.3.1", "pin-project-lite", @@ -1571,9 +1538,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.0.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" [[package]] name = "ff" @@ -1587,9 +1554,9 @@ dependencies = [ [[package]] name = "fiat-crypto" -version = "0.2.1" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0870c84016d4b481be5c9f323c24f65e31e901ae618f0e80f4308fb00de1d2d" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" [[package]] name = "file-sharing-example" @@ -1609,6 +1576,12 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foldhash" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0d2fde1f7b3d48b8395d5f2de76c18a528bd6a9cdde438df747bfcba3e05d6f" + [[package]] name = "foreign-types" version = "0.3.2" @@ -1694,14 +1667,13 @@ checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-lite" -version = "2.0.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3831c2651acb5177cbd83943f3d9c8912c5ad03c76afcc0e9511ba568ec5ebb" +checksum = "cef40d21ae2c515b51041df9ed313ed21e572df340ea58a922a0aefe7e8891a1" dependencies = [ "fastrand", "futures-core", "futures-io", - "memchr", "parking", "pin-project-lite", ] @@ -1714,7 +1686,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.92", ] [[package]] @@ -1724,7 +1696,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f2f12607f92c69b12ed746fabf9ca4f5c482cba46679c1a75b874ed7c26adb" dependencies = [ "futures-io", - "rustls 0.23.11", + "rustls 0.23.20", "rustls-pki-types", ] @@ -1817,9 +1789,9 @@ dependencies = [ [[package]] name = "ghash" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d930750de5717d2dd0b8c0d42c076c0e884c81a73e6cab859bbd2339c71e3e40" +checksum = "f0d8a4362ccb29cb0b265253fb0a2728f592895ee6854fd9bc13f2ffda266ff1" dependencies = [ "opaque-debug", "polyval", @@ -1827,9 +1799,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.27.3" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "glob" @@ -1839,15 +1811,15 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "globset" -version = "0.4.11" +version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1391ab1f92ffcc08911957149833e682aa3fe252b9f45f966d2ef972274c97df" +checksum = "15f1ce686646e7f1e19bf7d5533fe443a45dbfb990e00629110797578b42fb19" dependencies = [ "aho-corasick", "bstr", - "fnv", "log", - "regex", + "regex-automata 0.4.9", + "regex-syntax 0.8.5", ] [[package]] @@ -1887,17 +1859,17 @@ dependencies = [ [[package]] name = "h2" -version = "0.4.4" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "816ec7294445779408f36fe57bc5b7fc1cf59664059096c65f905c1c61f58069" +checksum = "ccae279728d634d083c00f6099cb58f01cc99c145b84b8be2f6c74618d79922e" dependencies = [ + "atomic-waker", "bytes", "fnv", "futures-core", "futures-sink", - "futures-util", - "http 1.1.0", - "indexmap 2.2.1", + "http 1.2.0", + "indexmap 2.7.0", "slab", "tokio", "tokio-util", @@ -1906,9 +1878,13 @@ dependencies = [ [[package]] name = "half" -version = "1.8.2" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" +checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888" +dependencies = [ + "cfg-if", + "crunchy", +] [[package]] name = "hashbrown" @@ -1918,12 +1894,22 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hashbrown" -version = "0.14.3" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" dependencies = [ "ahash", +] + +[[package]] +name = "hashbrown" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" +dependencies = [ "allocator-api2", + "equivalent", + "foldhash", ] [[package]] @@ -1932,26 +1918,26 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ba4ff7128dee98c7dc9794b6a411377e1404dba1c97deb8d1a55297bd25d8af" dependencies = [ - "hashbrown 0.14.3", + "hashbrown 0.14.5", ] [[package]] name = "heck" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] -name = "heck" -version = "0.5.0" +name = "hermit-abi" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] name = "hermit-abi" -version = "0.3.2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" +checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc" [[package]] name = "hex" @@ -1990,7 +1976,7 @@ dependencies = [ "once_cell", "rand 0.8.5", "socket2", - "thiserror 2.0.3", + "thiserror 2.0.9", "tinyvec", "tokio", "tracing", @@ -2013,7 +1999,7 @@ dependencies = [ "rand 0.8.5", "resolv-conf", "smallvec", - "thiserror 2.0.3", + "thiserror 2.0.9", "tokio", "tracing", ] @@ -2063,7 +2049,7 @@ version = "0.1.0" dependencies = [ "anyhow", "either", - "env_logger 0.11.5", + "env_logger 0.11.6", "futures", "libp2p", "redis", @@ -2086,9 +2072,9 @@ dependencies = [ [[package]] name = "http" -version = "0.2.9" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" dependencies = [ "bytes", "fnv", @@ -2097,9 +2083,9 @@ dependencies = [ [[package]] name = "http" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +checksum = "f16ca2af56261c99fba8bac40a10251ce8188205a4c448fbb745a2e4daa76fea" dependencies = [ "bytes", "fnv", @@ -2108,44 +2094,44 @@ dependencies = [ [[package]] name = "http-body" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ "bytes", - "http 1.1.0", + "http 1.2.0", ] [[package]] name = "http-body-util" -version = "0.1.0" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cb79eb393015dadd30fc252023adb0b2400a0caee0fa2a077e6e21a551e840" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" dependencies = [ "bytes", "futures-util", - "http 1.1.0", + "http 1.2.0", "http-body", "pin-project-lite", ] [[package]] name = "http-range-header" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ce4ef31cda248bbdb6e6820603b82dfcd9e833db65a43e997a0ccec777d11fe" +checksum = "9171a2ea8a68358193d15dd5d70c1c10a2afc3e7e4c5bc92bc9f025cebd7359c" [[package]] name = "httparse" -version = "1.8.0" +version = "1.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" +checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" [[package]] name = "httpdate" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "humantime" @@ -2155,15 +2141,15 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "1.4.1" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" +checksum = "256fb8d4bd6413123cc9d91832d78325c48ff41677595be797d90f42969beae0" dependencies = [ "bytes", "futures-channel", "futures-util", "h2", - "http 1.1.0", + "http 1.2.0", "http-body", "httparse", "httpdate", @@ -2176,26 +2162,27 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.26.0" +version = "0.27.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0bea761b46ae2b24eb4aef630d8d1c398157b6fc29e6350ecf090a0b70c952c" +checksum = "2d191583f3da1305256f22463b9bb0471acad48a4e534a5218b9963e9c1f59b2" dependencies = [ "futures-util", - "http 1.1.0", + "http 1.2.0", "hyper", "hyper-util", - "rustls 0.22.4", + "rustls 0.23.20", "rustls-pki-types", "tokio", "tokio-rustls", "tower-service", + "webpki-roots 0.26.7", ] [[package]] name = "hyper-timeout" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3203a961e5c83b6f5498933e78b6b263e208c197b63e9c6c53cc82ffd3f63793" +checksum = "2b90d566bffbce6a75bd8b09a05aa8c2cb1fabb6cb348f8840c9e4c90a0d83b0" dependencies = [ "hyper", "hyper-util", @@ -2222,14 +2209,14 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41296eb09f183ac68eec06e03cdbea2e759633d4067b2f6552fc2e009bcad08b" +checksum = "df2dcfbe0677734ab2f3ffa7fa7bfd4706bfdc1ef393f2ee30184aed67e631b4" dependencies = [ "bytes", "futures-channel", "futures-util", - "http 1.1.0", + "http 1.2.0", "http-body", "hyper", "pin-project-lite", @@ -2354,7 +2341,7 @@ checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.92", ] [[package]] @@ -2417,9 +2404,9 @@ dependencies = [ "netlink-sys", "rtnetlink", "smol", - "system-configuration 0.6.1", + "system-configuration", "tokio", - "windows 0.52.0", + "windows 0.53.0", ] [[package]] @@ -2432,7 +2419,7 @@ dependencies = [ "attohttpc", "bytes", "futures", - "http 1.1.0", + "http 1.2.0", "http-body-util", "hyper", "hyper-util", @@ -2455,12 +2442,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.1" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "433de089bd45971eecf4668ee0ee8f4cec17db4f8bd8f7bc3197a6ce37aa7d9b" +checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" dependencies = [ "equivalent", - "hashbrown 0.14.3", + "hashbrown 0.15.2", ] [[package]] @@ -2490,8 +2477,8 @@ dependencies = [ "log", "rand 0.8.5", "rtcp", - "rtp", - "thiserror 1.0.63", + "rtp 0.9.0", + "thiserror 1.0.69", "tokio", "waitgroup", "webrtc-srtp", @@ -2540,7 +2527,7 @@ dependencies = [ "socket2", "widestring", "windows-sys 0.48.0", - "winreg 0.50.0", + "winreg", ] [[package]] @@ -2568,19 +2555,19 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.8.0" +version = "2.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" +checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" [[package]] name = "is-terminal" -version = "0.4.9" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +checksum = "261f68e344040fbd0edea105bef17c66edf46f984ddb1115b775ce31be948f4b" dependencies = [ - "hermit-abi", - "rustix", - "windows-sys 0.48.0", + "hermit-abi 0.4.0", + "libc", + "windows-sys 0.52.0", ] [[package]] @@ -2598,26 +2585,36 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + [[package]] name = "itoa" -version = "1.0.9" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" [[package]] name = "js-sys" -version = "0.3.70" +version = "0.3.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" +checksum = "6717b6b5b077764fb5966237269cb3c64edddde4b14ce42647430a78ced9e7b7" dependencies = [ + "once_cell", "wasm-bindgen", ] [[package]] name = "keccak" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" dependencies = [ "cpufeatures", ] @@ -2645,15 +2642,15 @@ dependencies = [ [[package]] name = "lazy_static" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.168" +version = "0.2.169" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aaeb2981e0606ca11d79718f8bb01164f1d6ed75080182d3abf017e6d244b6d" +checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" [[package]] name = "libp2p" @@ -2700,7 +2697,7 @@ dependencies = [ "multiaddr", "pin-project", "rw-stream-sink", - "thiserror 2.0.3", + "thiserror 2.0.9", "tokio", "tracing-subscriber", ] @@ -2738,7 +2735,7 @@ dependencies = [ "quick-protobuf-codec", "rand 0.8.5", "rand_core 0.6.4", - "thiserror 2.0.3", + "thiserror 2.0.9", "tokio", "tracing", "web-time 1.1.0", @@ -2781,9 +2778,9 @@ dependencies = [ "quick-protobuf", "rand 0.8.5", "rw-stream-sink", - "thiserror 2.0.3", + "thiserror 2.0.9", "tracing", - "unsigned-varint 0.8.0", + "unsigned-varint", "web-time 1.1.0", ] @@ -2809,7 +2806,7 @@ dependencies = [ "lru", "quick-protobuf", "quick-protobuf-codec", - "thiserror 2.0.3", + "thiserror 2.0.9", "tokio", "tracing", "web-time 1.1.0", @@ -2849,7 +2846,7 @@ dependencies = [ "quick-protobuf-codec", "rand 0.8.5", "smallvec", - "thiserror 2.0.3", + "thiserror 2.0.9", "tracing", ] @@ -2905,7 +2902,7 @@ dependencies = [ "quick-protobuf", "quick-protobuf-codec", "smallvec", - "thiserror 2.0.3", + "thiserror 2.0.9", "tracing", ] @@ -2931,7 +2928,7 @@ dependencies = [ "serde", "serde_json", "sha2 0.10.8", - "thiserror 2.0.3", + "thiserror 2.0.9", "tracing", "zeroize", ] @@ -2963,7 +2960,7 @@ dependencies = [ "serde", "sha2 0.10.8", "smallvec", - "thiserror 2.0.3", + "thiserror 2.0.9", "tracing", "uint", "web-time 1.1.0", @@ -3045,7 +3042,7 @@ dependencies = [ "rand 0.8.5", "smallvec", "tracing", - "unsigned-varint 0.8.0", + "unsigned-varint", ] [[package]] @@ -3078,7 +3075,7 @@ dependencies = [ "rand 0.8.5", "snow", "static_assertions", - "thiserror 2.0.3", + "thiserror 2.0.9", "tracing", "x25519-dalek", "zeroize", @@ -3104,7 +3101,7 @@ dependencies = [ "libp2p-yamux", "serde", "serde_json", - "thiserror 2.0.3", + "thiserror 2.0.9", "tokio", "tracing", "tracing-subscriber", @@ -3186,9 +3183,9 @@ dependencies = [ "quinn", "rand 0.8.5", "ring 0.17.8", - "rustls 0.23.11", + "rustls 0.23.20", "socket2", - "thiserror 2.0.3", + "thiserror 2.0.9", "tokio", "tracing", ] @@ -3216,7 +3213,7 @@ dependencies = [ "quickcheck-ext", "rand 0.8.5", "static_assertions", - "thiserror 2.0.3", + "thiserror 2.0.9", "tracing", "web-time 1.1.0", ] @@ -3239,7 +3236,7 @@ dependencies = [ "quick-protobuf", "quick-protobuf-codec", "rand 0.8.5", - "thiserror 2.0.3", + "thiserror 2.0.9", "tokio", "tracing", "web-time 1.1.0", @@ -3339,9 +3336,9 @@ dependencies = [ name = "libp2p-swarm-derive" version = "0.35.0" dependencies = [ - "heck 0.5.0", + "heck", "quote", - "syn 2.0.89", + "syn 2.0.92", ] [[package]] @@ -3397,9 +3394,9 @@ dependencies = [ "libp2p-yamux", "rcgen", "ring 0.17.8", - "rustls 0.23.11", + "rustls 0.23.20", "rustls-webpki 0.101.7", - "thiserror 2.0.3", + "thiserror 2.0.9", "tokio", "x509-parser 0.16.0", "yasna", @@ -3448,12 +3445,13 @@ dependencies = [ "quickcheck", "rand 0.8.5", "rcgen", - "stun 0.6.0", - "thiserror 2.0.3", + "stun 0.7.0", + "thiserror 2.0.9", "tokio", "tokio-util", "tracing", "webrtc", + "webrtc-ice", ] [[package]] @@ -3490,7 +3488,7 @@ dependencies = [ "libp2p-identity", "libp2p-webrtc-utils", "send_wrapper 0.6.0", - "thiserror 2.0.3", + "thiserror 2.0.9", "tracing", "wasm-bindgen", "wasm-bindgen-futures", @@ -3514,10 +3512,10 @@ dependencies = [ "rcgen", "rw-stream-sink", "soketto", - "thiserror 2.0.3", + "thiserror 2.0.9", "tracing", "url", - "webpki-roots 0.25.2", + "webpki-roots 0.25.4", ] [[package]] @@ -3532,7 +3530,7 @@ dependencies = [ "libp2p-noise", "libp2p-yamux", "send_wrapper 0.6.0", - "thiserror 2.0.3", + "thiserror 2.0.9", "tracing", "wasm-bindgen", "web-sys", @@ -3552,7 +3550,7 @@ dependencies = [ "multihash", "once_cell", "send_wrapper 0.6.0", - "thiserror 2.0.3", + "thiserror 2.0.9", "tracing", "wasm-bindgen", "wasm-bindgen-futures", @@ -3568,10 +3566,20 @@ dependencies = [ "futures", "libp2p-core", "libp2p-muxer-test-harness", - "thiserror 2.0.3", + "thiserror 2.0.9", "tracing", "yamux 0.12.1", - "yamux 0.13.3", + "yamux 0.13.4", +] + +[[package]] +name = "libredox" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" +dependencies = [ + "bitflags 2.6.0", + "libc", ] [[package]] @@ -3624,9 +3632,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.4.12" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "litemap" @@ -3636,9 +3644,9 @@ checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104" [[package]] name = "lock_api" -version = "0.4.10" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" dependencies = [ "autocfg", "scopeguard", @@ -3646,20 +3654,20 @@ dependencies = [ [[package]] name = "log" -version = "0.4.21" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" dependencies = [ "value-bag", ] [[package]] name = "lru" -version = "0.12.3" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3262e75e648fce39813cb56ac41f3c3e3f65217ebf3844d818d1f9398cfb0dc" +checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38" dependencies = [ - "hashbrown 0.14.3", + "hashbrown 0.15.2", ] [[package]] @@ -3679,24 +3687,25 @@ dependencies = [ [[package]] name = "matchit" -version = "0.7.1" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67827e6ea8ee8a7c4a72227ef4fc08957040acffdb5f122733b24fa12daff41b" +checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" [[package]] name = "md-5" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6365506850d44bff6e2fbcb5176cf63650e48bd45ef2fe2665ae1570e0f4b9ca" +checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" dependencies = [ + "cfg-if", "digest 0.10.7", ] [[package]] name = "memchr" -version = "2.6.3" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "memoffset" @@ -3707,23 +3716,14 @@ dependencies = [ "autocfg", ] -[[package]] -name = "memoffset" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" -dependencies = [ - "autocfg", -] - [[package]] name = "memory-stats" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34f79cf9964c5c9545493acda1263f1912f8d2c56c8a2ffee2606cb960acaacc" +checksum = "c73f5c649995a115e1a0220b35e4df0a1294500477f97a91d0660fb5abeb574a" dependencies = [ "libc", - "winapi", + "windows-sys 0.52.0", ] [[package]] @@ -3751,9 +3751,9 @@ checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "mime_guess" -version = "2.0.4" +version = "2.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef" +checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" dependencies = [ "mime", "unicase", @@ -3761,9 +3761,9 @@ dependencies = [ [[package]] name = "minicov" -version = "0.3.5" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c71e683cd655513b99affab7d317deb690528255a0d5f717f1024093c12b169" +checksum = "f27fe9f1cc3c22e1687f9446c2083c4c5fc7f0bcf1c7a86bdbded14985895b4b" dependencies = [ "cc", "walkdir", @@ -3777,11 +3777,11 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.7.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "4ffbe83022cedc1d264172192511ae958937694cd57ce297164951b8b3568394" dependencies = [ - "adler", + "adler2", ] [[package]] @@ -3810,16 +3810,16 @@ dependencies = [ "rustc_version", "smallvec", "tagptr", - "thiserror 1.0.63", + "thiserror 1.0.69", "triomphe", "uuid", ] [[package]] name = "multiaddr" -version = "0.18.1" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b852bc02a2da5feed68cd14fa50d0774b92790a5bdbfa932a813926c8472070" +checksum = "fe6351f60b488e04c1d21bc69e56b89cb3f5e8f5d22557d6e8031bdfd79b6961" dependencies = [ "arrayref", "byteorder", @@ -3830,7 +3830,7 @@ dependencies = [ "percent-encoding", "serde", "static_assertions", - "unsigned-varint 0.7.2", + "unsigned-varint", "url", ] @@ -3847,16 +3847,16 @@ dependencies = [ [[package]] name = "multihash" -version = "0.19.1" +version = "0.19.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "076d548d76a0e2a0d4ab471d0b1c36c577786dfc4471242035d97a12a735c492" +checksum = "6b430e7953c29dd6a09afc29ff0bb69c6e306329ee6794700aee27b76a1aea8d" dependencies = [ "arbitrary", "core2", "quickcheck", "rand 0.8.5", "serde", - "unsigned-varint 0.7.2", + "unsigned-varint", ] [[package]] @@ -3873,16 +3873,15 @@ dependencies = [ "rw-stream-sink", "smallvec", "tracing", - "unsigned-varint 0.8.0", + "unsigned-varint", ] [[package]] name = "native-tls" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" +checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466" dependencies = [ - "lazy_static", "libc", "log", "openssl", @@ -3928,7 +3927,7 @@ dependencies = [ "anyhow", "byteorder", "paste", - "thiserror 1.0.63", + "thiserror 1.0.69", ] [[package]] @@ -3942,7 +3941,7 @@ dependencies = [ "log", "netlink-packet-core", "netlink-sys", - "thiserror 1.0.63", + "thiserror 1.0.69", "tokio", ] @@ -3969,7 +3968,7 @@ dependencies = [ "bitflags 1.3.2", "cfg-if", "libc", - "memoffset 0.7.1", + "memoffset", "pin-utils", ] @@ -4010,11 +4009,10 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.3" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" dependencies = [ - "autocfg", "num-integer", "num-traits", ] @@ -4027,11 +4025,10 @@ checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" [[package]] name = "num-integer" -version = "0.1.45" +version = "0.1.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" dependencies = [ - "autocfg", "num-traits", ] @@ -4050,15 +4047,15 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi", + "hermit-abi 0.3.9", "libc", ] [[package]] name = "object" -version = "0.31.1" +version = "0.36.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1" +checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" dependencies = [ "memchr", ] @@ -4074,11 +4071,11 @@ dependencies = [ [[package]] name = "oid-registry" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c958dd45046245b9c3c2547369bb634eb461670b2e7e0de552905801a648d1d" +checksum = "a8d8034d9489cdaf79228eb9f6a3b8d7bb32ba00d6645ebd48eef4077ceb5bd9" dependencies = [ - "asn1-rs 0.6.1", + "asn1-rs 0.6.2", ] [[package]] @@ -4089,23 +4086,23 @@ checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "oorandom" -version = "11.1.3" +version = "11.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" +checksum = "b410bbe7e14ab526a0e86877eb47c6996a2bd7746f027ba551028c925390e4e9" [[package]] name = "opaque-debug" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" [[package]] name = "openssl" -version = "0.10.66" +version = "0.10.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" +checksum = "6174bc48f102d208783c2c84bf931bb75927a617866870de8a4ea85597f871f5" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.6.0", "cfg-if", "foreign-types", "libc", @@ -4122,7 +4119,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.92", ] [[package]] @@ -4133,9 +4130,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.103" +version = "0.9.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" +checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741" dependencies = [ "cc", "libc", @@ -4151,11 +4148,11 @@ checksum = "1e32339a5dc40459130b3bd269e9892439f55b33e772d2a9d402a789baaf4e8a" dependencies = [ "futures-core", "futures-sink", - "indexmap 2.2.1", + "indexmap 2.7.0", "js-sys", "once_cell", "pin-project-lite", - "thiserror 1.0.63", + "thiserror 1.0.69", "urlencoding", ] @@ -4169,7 +4166,7 @@ dependencies = [ "futures-sink", "js-sys", "pin-project-lite", - "thiserror 1.0.63", + "thiserror 1.0.69", "tracing", ] @@ -4197,12 +4194,12 @@ checksum = "91cf61a1868dacc576bf2b2a1c3e9ab150af7272909e80085c3173384fe11f76" dependencies = [ "async-trait", "futures-core", - "http 1.1.0", + "http 1.2.0", "opentelemetry 0.27.1", "opentelemetry-proto", "opentelemetry_sdk 0.27.1", "prost", - "thiserror 1.0.63", + "thiserror 1.0.69", "tokio", "tonic", "tracing", @@ -4243,10 +4240,10 @@ dependencies = [ "glob", "once_cell", "opentelemetry 0.21.0", - "ordered-float 4.2.0", + "ordered-float 4.6.0", "percent-encoding", "rand 0.8.5", - "thiserror 1.0.63", + "thiserror 1.0.69", "tokio", "tokio-stream", ] @@ -4266,12 +4263,18 @@ dependencies = [ "percent-encoding", "rand 0.8.5", "serde_json", - "thiserror 1.0.63", + "thiserror 1.0.69", "tokio", "tokio-stream", "tracing", ] +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + [[package]] name = "ordered-float" version = "2.10.1" @@ -4283,9 +4286,9 @@ dependencies = [ [[package]] name = "ordered-float" -version = "4.2.0" +version = "4.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a76df7075c7d4d01fdcb46c912dd17fba5b60c78ea480b475f2b6ab6f666584e" +checksum = "7bb71e1b3fa6ca1c61f383464aaf2bb0e2f8e772a1f01d486832464de363b951" dependencies = [ "num-traits", ] @@ -4338,30 +4341,30 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.8" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.3.5", + "redox_syscall", "smallvec", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] name = "paste" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "pem" -version = "3.0.2" +version = "3.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3163d2912b7c3b52d651a055f2c7eec9ba5cd22d26ef75b8dd3a59980b185923" +checksum = "8e459365e590736a54c3fa561947c84837534b8e9af6fc5bf781307e82658fae" dependencies = [ - "base64 0.21.7", + "base64 0.22.1", "serde", ] @@ -4382,29 +4385,29 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pin-project" -version = "1.1.5" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" +checksum = "be57f64e946e500c8ee36ef6331845d40a93055567ec57e8fae13efd33759b95" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.5" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" +checksum = "3c0f5fad0874fc7abcd4d750e76917eaebbecaa2c20bde22e1dbeeba8beb758c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.92", ] [[package]] name = "pin-project-lite" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" +checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" [[package]] name = "pin-utils" @@ -4445,15 +4448,15 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.27" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "plotters" -version = "0.3.5" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2c224ba00d7cadd4d5c660deaf2098e5e80e07846537c51f9cfa4be50c1fd45" +checksum = "5aeb6f403d7a4911efb1e33402027fc44f29b5bf6def3effcc22d7bb75f2b747" dependencies = [ "num-traits", "plotters-backend", @@ -4464,31 +4467,32 @@ dependencies = [ [[package]] name = "plotters-backend" -version = "0.3.5" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e76628b4d3a7581389a35d5b6e2139607ad7c75b17aed325f210aa91f4a9609" +checksum = "df42e13c12958a16b3f7f4386b9ab1f3e7933914ecea48da7139435263a4172a" [[package]] name = "plotters-svg" -version = "0.3.5" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38f6d39893cca0701371e3c27294f09797214b86f1fb951b89ade8ec04e2abab" +checksum = "51bae2ac328883f7acdfea3d66a7c35751187f870bc81f94563733a154d7a670" dependencies = [ "plotters-backend", ] [[package]] name = "polling" -version = "3.3.0" +version = "3.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e53b6af1f60f36f8c2ac2aad5459d75a5a9b4be1e8cdd40264f315d78193e531" +checksum = "a604568c3202727d1507653cb121dbd627a58684eb09a820fd746bee38b4442f" dependencies = [ "cfg-if", "concurrent-queue", + "hermit-abi 0.4.0", "pin-project-lite", "rustix", "tracing", - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] @@ -4504,9 +4508,9 @@ dependencies = [ [[package]] name = "polyval" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52cff9d1d4dee5fe6d03729099f4a310a41179e0a10dbf542039873f2e826fb" +checksum = "9d1fe60d06143b2430aa532c94cfe9e29783047f06c0d7fd359a9a51b729fa25" dependencies = [ "cfg-if", "cpufeatures", @@ -4516,9 +4520,9 @@ dependencies = [ [[package]] name = "portable-atomic" -version = "1.6.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0" +checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6" [[package]] name = "powerfmt" @@ -4528,15 +4532,18 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "ppv-lite86" -version = "0.2.17" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] [[package]] name = "primeorder" -version = "0.13.2" +version = "0.13.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c2fcef82c0ec6eefcc179b978446c399b3cdf73c392c35604e399eee6df1ee3" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" dependencies = [ "elliptic-curve", ] @@ -4552,9 +4559,9 @@ dependencies = [ [[package]] name = "prometheus-client" -version = "0.22.2" +version = "0.22.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1ca959da22a332509f2a73ae9e5f23f9dcfc31fd3a54d71f159495bd5909baa" +checksum = "504ee9ff529add891127c4827eb481bd69dc0ebc72e9a682e187db4caa60c3ca" dependencies = [ "dtoa", "itoa", @@ -4570,14 +4577,14 @@ checksum = "440f724eba9f6996b75d63681b0a92b06947f1457076d503a4d2e2c8f56442b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.92", ] [[package]] name = "prost" -version = "0.13.3" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b0487d90e047de87f984913713b85c601c05609aad5b0df4b4573fbf69aa13f" +checksum = "2c0fef6c4230e4ccf618a35c59d7ede15dea37de8427500f50aff708806e42ec" dependencies = [ "bytes", "prost-derive", @@ -4585,22 +4592,22 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.13.3" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9552f850d5f0964a4e4d0bf306459ac29323ddfbae05e35a7c0d35cb0803cc5" +checksum = "157c5a9d7ea5c2ed2d9fb8f495b64759f7816c7eaea54ba3978f0d63000162e3" dependencies = [ "anyhow", - "itertools", + "itertools 0.13.0", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.92", ] [[package]] name = "quanta" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5167a477619228a0b284fac2674e3c388cba90631d7b7de620e6f1fcd08da5" +checksum = "773ce68d0bb9bc7ef20be3536ffe94e223e1f365bd374108b2659fac0c65cfe6" dependencies = [ "crossbeam-utils", "libc", @@ -4636,8 +4643,8 @@ dependencies = [ "futures", "quick-protobuf", "quickcheck-ext", - "thiserror 2.0.3", - "unsigned-varint 0.8.0", + "thiserror 2.0.9", + "unsigned-varint", ] [[package]] @@ -4673,9 +4680,9 @@ dependencies = [ "quinn-proto", "quinn-udp", "rustc-hash", - "rustls 0.23.11", + "rustls 0.23.20", "socket2", - "thiserror 2.0.3", + "thiserror 2.0.9", "tokio", "tracing", ] @@ -4691,10 +4698,10 @@ dependencies = [ "rand 0.8.5", "ring 0.17.8", "rustc-hash", - "rustls 0.23.11", + "rustls 0.23.20", "rustls-pki-types", "slab", - "thiserror 2.0.3", + "thiserror 2.0.9", "tinyvec", "tracing", "web-time 1.1.0", @@ -4711,14 +4718,14 @@ dependencies = [ "once_cell", "socket2", "tracing", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "quote" -version = "1.0.36" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" dependencies = [ "proc-macro2", ] @@ -4800,7 +4807,7 @@ version = "11.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ab240315c661615f2ee9f0f2cd32d5a7343a84d5ebcccb99d46e6637565e7b0" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.6.0", ] [[package]] @@ -4857,43 +4864,34 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" -dependencies = [ - "bitflags 1.3.2", -] - -[[package]] -name = "redox_syscall" -version = "0.3.5" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.6.0", ] [[package]] name = "redox_users" -version = "0.4.3" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" +checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" dependencies = [ "getrandom 0.2.15", - "redox_syscall 0.2.16", - "thiserror 1.0.63", + "libredox", + "thiserror 1.0.69", ] [[package]] name = "regex" -version = "1.10.5" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.4", - "regex-syntax 0.8.2", + "regex-automata 0.4.9", + "regex-syntax 0.8.5", ] [[package]] @@ -4907,13 +4905,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.4" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b7fa1134405e2ec9353fd416b17f8dacd46c473d7d3fd1cf202706a14eb792a" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.2", + "regex-syntax 0.8.5", ] [[package]] @@ -4924,9 +4922,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.8.2" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "relay-server-example" @@ -4952,9 +4950,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.12.4" +version = "0.12.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "566cafdd92868e0939d3fb961bd0dc25fcfaaed179291093b3d43e6b3150ea10" +checksum = "7fe060fe50f524be480214aba758c71f99f90ee8c83c5a36b5e9e1d568eb4eb3" dependencies = [ "base64 0.22.1", "bytes", @@ -4962,7 +4960,7 @@ dependencies = [ "futures-core", "futures-util", "h2", - "http 1.1.0", + "http 1.2.0", "http-body", "http-body-util", "hyper", @@ -4977,24 +4975,26 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", - "rustls 0.22.4", + "quinn", + "rustls 0.23.20", "rustls-pemfile", "rustls-pki-types", "serde", "serde_json", "serde_urlencoded", - "sync_wrapper 0.1.2", - "system-configuration 0.5.1", + "sync_wrapper", + "system-configuration", "tokio", "tokio-native-tls", "tokio-rustls", + "tower 0.5.2", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "webpki-roots 0.26.1", - "winreg 0.52.0", + "webpki-roots 0.26.7", + "windows-registry", ] [[package]] @@ -5080,12 +5080,12 @@ dependencies = [ [[package]] name = "rtcp" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3677908cadfbecb4cc1da9a56a32524fae4ebdfa7c2ea93886e1b1e846488cb9" +checksum = "33648a781874466a62d89e265fee9f17e32bc7d05a256e6cca41bf97eadcd8aa" dependencies = [ "bytes", - "thiserror 1.0.63", + "thiserror 1.0.69", "webrtc-util 0.8.1", ] @@ -5104,7 +5104,7 @@ dependencies = [ "netlink-proto", "netlink-sys", "nix", - "thiserror 1.0.63", + "thiserror 1.0.69", "tokio", ] @@ -5117,15 +5117,28 @@ dependencies = [ "bytes", "rand 0.8.5", "serde", - "thiserror 1.0.63", + "thiserror 1.0.69", + "webrtc-util 0.8.1", +] + +[[package]] +name = "rtp" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47fca9bd66ae0b1f3f649b8f5003d6176433d7293b78b0fce7e1031816bdd99d" +dependencies = [ + "bytes", + "rand 0.8.5", + "serde", + "thiserror 1.0.69", "webrtc-util 0.8.1", ] [[package]] name = "rust-embed" -version = "8.4.0" +version = "8.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19549741604902eb99a7ed0ee177a0663ee1eda51a29f71401f166e47e77806a" +checksum = "fa66af4a4fdd5e7ebc276f115e895611a34739a9c1c01028383d612d550953c0" dependencies = [ "rust-embed-impl", "rust-embed-utils", @@ -5134,23 +5147,23 @@ dependencies = [ [[package]] name = "rust-embed-impl" -version = "8.4.0" +version = "8.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb9f96e283ec64401f30d3df8ee2aaeb2561f34c824381efa24a35f79bf40ee4" +checksum = "6125dbc8867951125eec87294137f4e9c2c96566e61bf72c45095a7c77761478" dependencies = [ "proc-macro2", "quote", "rust-embed-utils", "shellexpand", - "syn 2.0.89", + "syn 2.0.92", "walkdir", ] [[package]] name = "rust-embed-utils" -version = "8.4.0" +version = "8.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38c74a686185620830701348de757fd36bef4aa9680fd23c49fc539ddcc1af32" +checksum = "2e5347777e9aacb56039b0e1f28785929a8a3b709e87482e7442c72e7c12529d" dependencies = [ "globset", "sha2 0.10.8", @@ -5159,21 +5172,21 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "rustc-hash" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" +checksum = "c7fb8039b3032c191086b10f11f319a6e99e1e82889c5cc6046f515c9db1d497" [[package]] name = "rustc_version" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ "semver", ] @@ -5189,22 +5202,22 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.31" +version = "0.38.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" +checksum = "f93dc38ecbab2eb790ff964bb77fa94faf256fd3e73285fd7ba0903b76bedb85" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.6.0", "errno", "libc", "linux-raw-sys", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "rustls" -version = "0.21.11" +version = "0.21.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fecbfb7b1444f477b345853b1fce097a2c6fb637b2bfb87e6bc5db0f043fae4" +checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" dependencies = [ "log", "ring 0.17.8", @@ -5214,47 +5227,32 @@ dependencies = [ [[package]] name = "rustls" -version = "0.22.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" -dependencies = [ - "log", - "ring 0.17.8", - "rustls-pki-types", - "rustls-webpki 0.102.5", - "subtle", - "zeroize", -] - -[[package]] -name = "rustls" -version = "0.23.11" +version = "0.23.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4828ea528154ae444e5a642dbb7d5623354030dc9822b83fd9bb79683c7399d0" +checksum = "5065c3f250cbd332cd894be57c40fa52387247659b14a2d6041d121547903b1b" dependencies = [ "once_cell", "ring 0.17.8", "rustls-pki-types", - "rustls-webpki 0.102.5", + "rustls-webpki 0.102.8", "subtle", "zeroize", ] [[package]] name = "rustls-pemfile" -version = "2.1.2" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" +checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" dependencies = [ - "base64 0.22.1", "rustls-pki-types", ] [[package]] name = "rustls-pki-types" -version = "1.7.0" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" +checksum = "d2bf47e6ff922db3825eb750c4e2ff784c6ff8fb9e13046ef6a1d1c5401b0b37" dependencies = [ "web-time 1.1.0", ] @@ -5271,9 +5269,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.102.5" +version = "0.102.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a6fccd794a42c2c105b513a2f62bc3fd8f3ba57a4593677ceb0bd035164d78" +checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" dependencies = [ "ring 0.17.8", "rustls-pki-types", @@ -5282,9 +5280,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.14" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" +checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4" [[package]] name = "rw-stream-sink" @@ -5298,9 +5296,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.15" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "salsa20" @@ -5322,11 +5320,11 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.22" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" +checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] @@ -5343,23 +5341,23 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "sct" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" dependencies = [ - "ring 0.16.20", - "untrusted 0.7.1", + "ring 0.17.8", + "untrusted 0.9.0", ] [[package]] name = "sdp" -version = "0.6.0" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4653054c30ebce63658762eb0d64e27673868a95564474811ae6c220cf767640" +checksum = "13254db766b17451aced321e7397ebf0a446ef0c8d2942b6e67a95815421093f" dependencies = [ "rand 0.8.5", "substring", - "thiserror 1.0.63", + "thiserror 1.0.69", "url", ] @@ -5379,11 +5377,11 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.9.2" +version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.6.0", "core-foundation", "core-foundation-sys", "libc", @@ -5392,9 +5390,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.9.1" +version = "2.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" +checksum = "1863fd3768cd83c56a7f60faa4dc0d403f1b6df0a38c3c25f44b7894e45370d5" dependencies = [ "core-foundation-sys", "libc", @@ -5402,9 +5400,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.18" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" +checksum = "3cb6eb87a131f756572d7fb904f6e7b68633f09cca868c5df1c4b8d1a694bbba" [[package]] name = "send_wrapper" @@ -5423,41 +5421,42 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.210" +version = "1.0.217" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.210" +version = "1.0.217" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" +checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.92", ] [[package]] name = "serde_json" -version = "1.0.117" +version = "1.0.134" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" +checksum = "d00f4175c42ee48b15416f6193a959ba3a0d67fc699a0db9ad12df9f83991c7d" dependencies = [ - "indexmap 2.2.1", + "indexmap 2.7.0", "itoa", + "memchr", "ryu", "serde", ] [[package]] name = "serde_path_to_error" -version = "0.1.14" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4beec8bce849d58d06238cb50db2e1c417cfeafa4c63f692b15c82b7c80f8335" +checksum = "af99884400da37c88f5e9146b7f1fd0fbcae8f6eec4e9da38b67d05486f814a6" dependencies = [ "itoa", "serde", @@ -5471,14 +5470,14 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.92", ] [[package]] name = "serde_spanned" -version = "0.6.5" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" dependencies = [ "serde", ] @@ -5497,9 +5496,9 @@ dependencies = [ [[package]] name = "sha1" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ "cfg-if", "cpufeatures", @@ -5542,9 +5541,9 @@ dependencies = [ [[package]] name = "sharded-slab" -version = "0.1.4" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" dependencies = [ "lazy_static", ] @@ -5558,20 +5557,26 @@ dependencies = [ "dirs", ] +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + [[package]] name = "signal-hook-registry" -version = "1.4.1" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" dependencies = [ "libc", ] [[package]] name = "signature" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" dependencies = [ "digest 0.10.7", "rand_core 0.6.4", @@ -5579,9 +5584,9 @@ dependencies = [ [[package]] name = "slab" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" dependencies = [ "autocfg", ] @@ -5602,7 +5607,7 @@ dependencies = [ "async-executor", "async-fs", "async-io", - "async-lock 3.1.0", + "async-lock", "async-net", "async-process", "blocking", @@ -5611,9 +5616,9 @@ dependencies = [ [[package]] name = "smol_str" -version = "0.2.0" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74212e6bbe9a4352329b2f68ba3130c15a3f26fe88ff22dbdc6cdd58fa85e99c" +checksum = "dd538fb6910ac1099850255cf94a94df6551fbdd602454387d0adb2d1ca6dead" dependencies = [ "serde", ] @@ -5637,9 +5642,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +checksum = "c970269d99b64e60ec3bd6ad27270092a5394c4e309314b18ae3fe575695fbe8" dependencies = [ "libc", "windows-sys 0.52.0", @@ -5647,9 +5652,9 @@ dependencies = [ [[package]] name = "soketto" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37468c595637c10857701c990f93a40ce0e357cedb0953d1c26c8d8027f9bb53" +checksum = "2e859df029d160cb88608f5d7df7fb4753fd20fdfb4de5644f3d8b8440841721" dependencies = [ "base64 0.22.1", "bytes", @@ -5674,9 +5679,9 @@ checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" [[package]] name = "spki" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" dependencies = [ "base64ct", "der", @@ -5719,30 +5724,30 @@ dependencies = [ [[package]] name = "strsim" -version = "0.11.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee073c9e4cd00e28217186dbe12796d692868f432bf2e97ee73bed0c56dfa01" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "strum" -version = "0.26.2" +version = "0.26.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d8cec3501a5194c432b2b7976db6b7d10ec95c253208b45f83f7136aa985e29" +checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" dependencies = [ "strum_macros", ] [[package]] name = "strum_macros" -version = "0.26.2" +version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6cf59daf282c0a494ba14fd21610a0325f9f90ec9d1231dea26bcb1d696c946" +checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" dependencies = [ - "heck 0.4.1", + "heck", "proc-macro2", "quote", "rustversion", - "syn 2.0.89", + "syn 2.0.92", ] [[package]] @@ -5758,7 +5763,7 @@ dependencies = [ "rand 0.8.5", "ring 0.17.8", "subtle", - "thiserror 1.0.63", + "thiserror 1.0.69", "tokio", "url", "webrtc-util 0.8.1", @@ -5766,21 +5771,21 @@ dependencies = [ [[package]] name = "stun" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28fad383a1cc63ae141e84e48eaef44a1063e9d9e55bcb8f51a99b886486e01b" +checksum = "ea256fb46a13f9204e9dee9982997b2c3097db175a9fddaa8350310d03c4d5a3" dependencies = [ - "base64 0.21.7", + "base64 0.22.1", "crc", "lazy_static", "md-5", "rand 0.8.5", "ring 0.17.8", "subtle", - "thiserror 1.0.63", + "thiserror 1.0.69", "tokio", "url", - "webrtc-util 0.9.0", + "webrtc-util 0.10.0", ] [[package]] @@ -5794,9 +5799,9 @@ dependencies = [ [[package]] name = "subtle" -version = "2.5.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -5811,9 +5816,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.89" +version = "2.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d46482f1c1c87acd84dea20c1bf5ebff4c757009ed6bf19cfd36fb10e92c4e" +checksum = "70ae51629bf965c5c098cc9e87908a3df5301051a9e087d6f9bef5c9771ed126" dependencies = [ "proc-macro2", "quote", @@ -5822,15 +5827,12 @@ dependencies = [ [[package]] name = "sync_wrapper" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" - -[[package]] -name = "sync_wrapper" -version = "1.0.0" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "384595c11a4e2969895cad5a8c4029115f5ab956a9e5ef4de79d11a426e5f20c" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] [[package]] name = "synstructure" @@ -5852,14 +5854,14 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.92", ] [[package]] name = "sysinfo" -version = "0.33.0" +version = "0.33.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "948512566b1895f93b1592c7574baeb2de842f224f2aab158799ecadb8ebbb46" +checksum = "4fc858248ea01b66f19d8e8a6d55f41deaf91e9d495246fd01368d99935c6c01" dependencies = [ "core-foundation-sys", "libc", @@ -5869,36 +5871,15 @@ dependencies = [ "windows 0.57.0", ] -[[package]] -name = "system-configuration" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" -dependencies = [ - "bitflags 1.3.2", - "core-foundation", - "system-configuration-sys 0.5.0", -] - [[package]] name = "system-configuration" version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.6.0", "core-foundation", - "system-configuration-sys 0.6.0", -] - -[[package]] -name = "system-configuration-sys" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" -dependencies = [ - "core-foundation-sys", - "libc", + "system-configuration-sys", ] [[package]] @@ -5917,23 +5898,30 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417" +[[package]] +name = "target-triple" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42a4d50cdb458045afc8131fd91b64904da29548bcb63c7236e0844936c13078" + [[package]] name = "tempfile" -version = "3.10.1" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" +checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" dependencies = [ "cfg-if", "fastrand", + "once_cell", "rustix", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "termcolor" -version = "1.2.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" dependencies = [ "winapi-util", ] @@ -5947,8 +5935,8 @@ dependencies = [ "async-trait", "base64 0.22.1", "futures", - "http 1.1.0", - "indexmap 2.2.1", + "http 1.2.0", + "indexmap 2.7.0", "parking_lot", "paste", "reqwest", @@ -5958,7 +5946,7 @@ dependencies = [ "stringmatch", "strum", "thirtyfour-macros", - "thiserror 1.0.63", + "thiserror 1.0.69", "tokio", "tracing", "url", @@ -5972,54 +5960,54 @@ checksum = "b72d056365e368fc57a56d0cec9e41b02fb4a3474a61c8735262b1cfebe67425" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.92", ] [[package]] name = "thiserror" -version = "1.0.63" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ - "thiserror-impl 1.0.63", + "thiserror-impl 1.0.69", ] [[package]] name = "thiserror" -version = "2.0.3" +version = "2.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c006c85c7651b3cf2ada4584faa36773bd07bac24acfb39f3c431b36d7e667aa" +checksum = "f072643fd0190df67a8bab670c20ef5d8737177d6ac6b2e9a236cb096206b2cc" dependencies = [ - "thiserror-impl 2.0.3", + "thiserror-impl 2.0.9", ] [[package]] name = "thiserror-impl" -version = "1.0.63" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.92", ] [[package]] name = "thiserror-impl" -version = "2.0.3" +version = "2.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f077553d607adc1caf65430528a576c757a71ed73944b66ebb58ef2bbd243568" +checksum = "7b50fa271071aae2e6ee85f842e2e28ba8cd2c5fb67f11fcb1fd70b276f9e7d4" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.92", ] [[package]] name = "thread_local" -version = "1.1.7" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" dependencies = [ "cfg-if", "once_cell", @@ -6049,9 +6037,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.36" +version = "0.3.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" +checksum = "35e7868883861bd0e56d9ac6efcaaca0d6d5d82a2a7ec8209ff492c07cf37b21" dependencies = [ "deranged", "itoa", @@ -6070,9 +6058,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" +checksum = "2834e6017e3e5e4b9834939793b282bc03b37a3336245fa820e35e233e2a85de" dependencies = [ "num-conv", "time-core", @@ -6100,9 +6088,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.6.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +checksum = "022db8904dfa342efe721985167e9fcd16c29b226db4397ed752a761cfce81e8" dependencies = [ "tinyvec_macros", ] @@ -6139,7 +6127,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.92", ] [[package]] @@ -6154,20 +6142,19 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.25.0" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" +checksum = "5f6d0975eaace0cf0fcadee4e4aaa5da15b5c079146f2cffb67c113be122bf37" dependencies = [ - "rustls 0.22.4", - "rustls-pki-types", + "rustls 0.23.20", "tokio", ] [[package]] name = "tokio-stream" -version = "0.1.16" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f4e6ce100d0eb49a2734f8c0812bcd324cf357d21810932c5df6b96ef2b86f1" +checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047" dependencies = [ "futures-core", "pin-project-lite", @@ -6176,9 +6163,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.11" +version = "0.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" +checksum = "d7fcaa8d55a2bdd6b83ace262b016eca0d79ee02818c5c1bcdf0305114081078" dependencies = [ "bytes", "futures-core", @@ -6190,9 +6177,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.11" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af06656561d28735e9c1cd63dfd57132c8155426aa6af24f36a00a351f88c48e" +checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" dependencies = [ "serde", "serde_spanned", @@ -6202,20 +6189,20 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.5" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.22.7" +version = "0.22.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18769cd1cec395d70860ceb4d932812a0b4d06b1a4bb336745a4d21b9496e992" +checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ - "indexmap 2.2.1", + "indexmap 2.7.0", "serde", "serde_spanned", "toml_datetime", @@ -6234,7 +6221,7 @@ dependencies = [ "base64 0.22.1", "bytes", "h2", - "http 1.1.0", + "http 1.2.0", "http-body", "http-body-util", "hyper", @@ -6246,7 +6233,7 @@ dependencies = [ "socket2", "tokio", "tokio-stream", - "tower", + "tower 0.4.13", "tower-layer", "tower-service", "tracing", @@ -6272,16 +6259,32 @@ dependencies = [ "tracing", ] +[[package]] +name = "tower" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", + "tracing", +] + [[package]] name = "tower-http" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e9cd434a998747dd2c4276bc96ee2e0c7a2eadf3cae88e52be55a05fa9053f5" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.6.0", "bytes", "futures-util", - "http 1.1.0", + "http 1.2.0", "http-body", "http-body-util", "http-range-header", @@ -6299,15 +6302,15 @@ dependencies = [ [[package]] name = "tower-layer" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" [[package]] name = "tower-service" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" @@ -6329,7 +6332,7 @@ checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.92", ] [[package]] @@ -6426,29 +6429,30 @@ checksum = "859eb650cfee7434994602c3a68b25d77ad9e68c8a6cd491616ef86661382eb3" [[package]] name = "try-lock" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "trybuild" -version = "1.0.96" +version = "1.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33a5f13f11071020bb12de7a16b925d2d58636175c20c11dc5f96cb64bb6c9b3" +checksum = "8dcd332a5496c026f1e14b7f3d2b7bd98e509660c04239c58b0ba38a12daded4" dependencies = [ "glob", "serde", "serde_derive", "serde_json", + "target-triple", "termcolor", "toml", ] [[package]] name = "turn" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58f4fcb97da0426e8146fe0e9b78cc13120161087256198701d12d9df77f7701" +checksum = "ffb2ac4f331064513ad510b7a36edc0df555bd61672986607f7c9ff46f98f415" dependencies = [ "async-trait", "base64 0.21.7", @@ -6456,18 +6460,19 @@ dependencies = [ "log", "md-5", "rand 0.8.5", - "ring 0.16.20", + "ring 0.17.8", "stun 0.5.1", - "thiserror 1.0.63", + "thiserror 1.0.69", "tokio", + "tokio-util", "webrtc-util 0.8.1", ] [[package]] name = "typenum" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "uint" @@ -6483,24 +6488,21 @@ dependencies = [ [[package]] name = "unicase" -version = "2.6.0" +version = "2.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" -dependencies = [ - "version_check", -] +checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539" [[package]] name = "unicode-ident" -version = "1.0.11" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" [[package]] name = "unicode-xid" -version = "0.2.4" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" [[package]] name = "universal-hash" @@ -6512,12 +6514,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "unsigned-varint" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6889a77d49f1f013504cec6bf97a2c730394adedaeb1deb5ea08949a50541105" - [[package]] name = "unsigned-varint" version = "0.8.0" @@ -6581,15 +6577,15 @@ checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" [[package]] name = "utf8parse" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" -version = "1.4.1" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79daa5ed5740825c40b389c5e50312b9c86df53fccd33f281df655642b43869d" +checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" dependencies = [ "getrandom 0.2.15", ] @@ -6602,9 +6598,9 @@ checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" [[package]] name = "value-bag" -version = "1.7.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "126e423afe2dd9ac52142e7e9d5ce4135d7e13776c529d27fd6bc49f19e3280b" +checksum = "3ef4c4aa54d5d05a279399bfa921ec387b7aba77caf7a682ae8d86785b8fdad2" [[package]] name = "vcpkg" @@ -6614,9 +6610,9 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "version_check" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "waitgroup" @@ -6629,9 +6625,9 @@ dependencies = [ [[package]] name = "walkdir" -version = "2.3.3" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" dependencies = [ "same-file", "winapi-util", @@ -6660,9 +6656,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.93" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" +checksum = "a474f6281d1d70c17ae7aa6a613c87fce69a127e2624002df63dcb39d6cf6396" dependencies = [ "cfg-if", "once_cell", @@ -6671,36 +6667,36 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.93" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" +checksum = "5f89bb38646b4f81674e8f5c3fb81b562be1fd936d84320f3264486418519c79" dependencies = [ "bumpalo", "log", - "once_cell", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.92", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.43" +version = "0.4.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed" +checksum = "38176d9b44ea84e9184eff0bc34cc167ed044f816accfe5922e54d84cf48eca2" dependencies = [ "cfg-if", "js-sys", + "once_cell", "wasm-bindgen", "web-sys", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.93" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" +checksum = "2cc6181fd9a7492eef6fef1f33961e3695e4579b9872a6f7c83aee556666d4fe" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -6708,30 +6704,29 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.93" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" +checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.92", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.93" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" +checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6" [[package]] name = "wasm-bindgen-test" -version = "0.3.43" +version = "0.3.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68497a05fb21143a08a7d24fc81763384a3072ee43c44e86aad1744d6adef9d9" +checksum = "c61d44563646eb934577f2772656c7ad5e9c90fac78aa8013d776fcdaf24625d" dependencies = [ - "console_error_panic_hook", "js-sys", "minicov", "scoped-tls", @@ -6742,13 +6737,13 @@ dependencies = [ [[package]] name = "wasm-bindgen-test-macro" -version = "0.3.43" +version = "0.3.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b8220be1fa9e4c889b30fd207d4906657e7e90b12e0e6b0c8b8d8709f5de021" +checksum = "54171416ce73aa0b9c377b51cc3cb542becee1cd678204812e8392e5b0e4a031" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.92", ] [[package]] @@ -6764,9 +6759,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.70" +version = "0.3.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0" +checksum = "04dd7223427d52553d3702c004d3b2fe07c148165faa56313cb00211e31c12bc" dependencies = [ "js-sys", "wasm-bindgen", @@ -6794,15 +6789,15 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.25.2" +version = "0.25.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" +checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" [[package]] name = "webpki-roots" -version = "0.26.1" +version = "0.26.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3de34ae270483955a94f4b21bdaaeb83d508bb84a01435f393818edb0012009" +checksum = "5d642ff16b7e79272ae451b7322067cdc17cadf68c23264be9d94a32319efe7e" dependencies = [ "rustls-pki-types", ] @@ -6827,15 +6822,15 @@ dependencies = [ "regex", "ring 0.16.20", "rtcp", - "rtp", - "rustls 0.21.11", + "rtp 0.9.0", + "rustls 0.21.12", "sdp", "serde", "serde_json", "sha2 0.10.8", "smol_str", "stun 0.5.1", - "thiserror 1.0.63", + "thiserror 1.0.69", "time", "tokio", "turn", @@ -6853,13 +6848,13 @@ dependencies = [ [[package]] name = "webrtc-data" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a45d2461d0e0bf93f181e30eb0b40df32b8bf3efb89c53cebb1990e603e2067d" +checksum = "e8c08e648e10572b9edbe741074e0f4d3cb221aa7cdf9a814ee71606de312f33" dependencies = [ "bytes", "log", - "thiserror 1.0.63", + "thiserror 1.0.69", "tokio", "webrtc-sctp", "webrtc-util 0.8.1", @@ -6889,13 +6884,13 @@ dependencies = [ "rand_core 0.6.4", "rcgen", "ring 0.16.20", - "rustls 0.21.11", + "rustls 0.21.12", "sec1", "serde", "sha1", "sha2 0.10.8", "subtle", - "thiserror 1.0.63", + "thiserror 1.0.69", "tokio", "webrtc-util 0.8.1", "x25519-dalek", @@ -6916,7 +6911,7 @@ dependencies = [ "serde", "serde_json", "stun 0.5.1", - "thiserror 1.0.63", + "thiserror 1.0.69", "tokio", "turn", "url", @@ -6928,35 +6923,35 @@ dependencies = [ [[package]] name = "webrtc-mdns" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bebbd40e7f8b630a0f1a74783dbfff1edfc0ccaae891c4689891156a8c4d8c" +checksum = "ce981f93104a8debb3563bb0cedfe4aa2f351fdf6b53f346ab50009424125c08" dependencies = [ "log", "socket2", - "thiserror 1.0.63", + "thiserror 1.0.69", "tokio", "webrtc-util 0.8.1", ] [[package]] name = "webrtc-media" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cfde3c7b9450b67d466bb2f02c6d9ff9514d33535eb9994942afd1f828839d1" +checksum = "280017b6b9625ef7329146332518b339c3cceff231cc6f6a9e0e6acab25ca4af" dependencies = [ "byteorder", "bytes", "rand 0.8.5", - "rtp", - "thiserror 1.0.63", + "rtp 0.10.0", + "thiserror 1.0.69", ] [[package]] name = "webrtc-sctp" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1af6116b7f9703560c3ad0b32f67220b171bb1b59633b03563db8404d0e482ea" +checksum = "df75ec042002fe995194712cbeb2029107a60a7eab646f1b789eb1be94d0e367" dependencies = [ "arc-swap", "async-trait", @@ -6964,7 +6959,7 @@ dependencies = [ "crc", "log", "rand 0.8.5", - "thiserror 1.0.63", + "thiserror 1.0.69", "tokio", "webrtc-util 0.8.1", ] @@ -6984,10 +6979,10 @@ dependencies = [ "hmac 0.12.1", "log", "rtcp", - "rtp", + "rtp 0.9.0", "sha1", "subtle", - "thiserror 1.0.63", + "thiserror 1.0.69", "tokio", "webrtc-util 0.8.1", ] @@ -7007,16 +7002,16 @@ dependencies = [ "log", "nix", "rand 0.8.5", - "thiserror 1.0.63", + "thiserror 1.0.69", "tokio", "winapi", ] [[package]] name = "webrtc-util" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc8d9bc631768958ed97b8d68b5d301e63054ae90b09083d43e2fefb939fd77e" +checksum = "1438a8fd0d69c5775afb4a71470af92242dbd04059c61895163aa3c1ef933375" dependencies = [ "async-trait", "bitflags 1.3.2", @@ -7028,7 +7023,7 @@ dependencies = [ "nix", "portable-atomic", "rand 0.8.5", - "thiserror 1.0.63", + "thiserror 1.0.69", "tokio", "winapi", ] @@ -7053,9 +7048,9 @@ dependencies = [ [[package]] name = "widestring" -version = "1.0.2" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "653f141f39ec16bba3c5abe400a0c60da7468261cc2cbf36805022876bc721a8" +checksum = "7219d36b6eac893fa81e84ebe06485e7dcbb616177469b142df14f1f4deb1311" [[package]] name = "winapi" @@ -7075,11 +7070,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.5" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "winapi", + "windows-sys 0.59.0", ] [[package]] @@ -7090,11 +7085,11 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows" -version = "0.52.0" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" +checksum = "efc5cf48f83140dcaab716eeaea345f9e93d0018fb81162753a3f76c3397b538" dependencies = [ - "windows-core 0.52.0", + "windows-core 0.53.0", "windows-targets 0.52.6", ] @@ -7110,10 +7105,11 @@ dependencies = [ [[package]] name = "windows-core" -version = "0.52.0" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +checksum = "9dcc5b895a6377f1ab9fa55acedab1fd5ac0db66ad1e6c7f47e28a22e446a5dd" dependencies = [ + "windows-result 0.1.2", "windows-targets 0.52.6", ] @@ -7125,7 +7121,7 @@ checksum = "d2ed2439a290666cd67ecce2b0ffaad89c2a56b976b736e6ece670297897832d" dependencies = [ "windows-implement", "windows-interface", - "windows-result", + "windows-result 0.1.2", "windows-targets 0.52.6", ] @@ -7137,7 +7133,7 @@ checksum = "9107ddc059d5b6fbfbffdfa7a7fe3e22a226def0b2608f72e9d552763d3e1ad7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.92", ] [[package]] @@ -7148,7 +7144,18 @@ checksum = "29bee4b38ea3cde66011baa44dba677c432a78593e202392d1e9070cf2a7fca7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.92", +] + +[[package]] +name = "windows-registry" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0" +dependencies = [ + "windows-result 0.2.0", + "windows-strings", + "windows-targets 0.52.6", ] [[package]] @@ -7160,6 +7167,25 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-result" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-strings" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" +dependencies = [ + "windows-result 0.2.0", + "windows-targets 0.52.6", +] + [[package]] name = "windows-sys" version = "0.48.0" @@ -7178,6 +7204,15 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + [[package]] name = "windows-targets" version = "0.48.5" @@ -7301,9 +7336,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.6.5" +version = "0.6.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dffa400e67ed5a4dd237983829e66475f0a4a26938c4b04c21baede6262215b8" +checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" dependencies = [ "memchr", ] @@ -7318,16 +7353,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "winreg" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" -dependencies = [ - "cfg-if", - "windows-sys 0.48.0", -] - [[package]] name = "write16" version = "1.0.0" @@ -7366,7 +7391,7 @@ dependencies = [ "oid-registry 0.6.1", "ring 0.16.20", "rusticata-macros", - "thiserror 1.0.63", + "thiserror 1.0.69", "time", ] @@ -7376,22 +7401,22 @@ version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcbc162f30700d6f3f82a24bf7cc62ffe7caea42c0b2cba8bf7f3ae50cf51f69" dependencies = [ - "asn1-rs 0.6.1", + "asn1-rs 0.6.2", "data-encoding", "der-parser 9.0.0", "lazy_static", "nom", - "oid-registry 0.7.0", + "oid-registry 0.7.1", "rusticata-macros", - "thiserror 1.0.63", + "thiserror 1.0.69", "time", ] [[package]] name = "xml-rs" -version = "0.8.17" +version = "0.8.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1eee6bf5926be7cf998d7381a9a23d833fd493f6a8034658a9505a4dc4b20444" +checksum = "ea8b391c9a790b496184c29f7f93b9ed5b16abb306c05415b68bcc16e4d06432" [[package]] name = "xmltree" @@ -7419,9 +7444,9 @@ dependencies = [ [[package]] name = "yamux" -version = "0.13.3" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31b5e376a8b012bee9c423acdbb835fc34d45001cfa3106236a624e4b738028" +checksum = "17610762a1207ee816c6fadc29220904753648aba0a9ed61c7b8336e80a559c4" dependencies = [ "futures", "log", @@ -7462,28 +7487,29 @@ checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.92", "synstructure 0.13.1", ] [[package]] name = "zerocopy" -version = "0.7.32" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ + "byteorder", "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.32" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.92", ] [[package]] @@ -7503,7 +7529,7 @@ checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.92", "synstructure 0.13.1", ] @@ -7524,7 +7550,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.92", ] [[package]] @@ -7546,5 +7572,5 @@ checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.92", ] diff --git a/transports/webrtc/Cargo.toml b/transports/webrtc/Cargo.toml index d010d4c1044..d43be5720d4 100644 --- a/transports/webrtc/Cargo.toml +++ b/transports/webrtc/Cargo.toml @@ -23,12 +23,13 @@ libp2p-webrtc-utils = { workspace = true } multihash = { workspace = true } rand = "0.8" rcgen = { workspace = true } -stun = "0.6" +stun = "0.7" thiserror = { workspace = true } tokio = { workspace = true, features = ["net"], optional = true } tokio-util = { version = "0.7", features = ["compat"], optional = true } tracing = { workspace = true } webrtc = { version = "0.9.0", optional = true } +webrtc-ice = "=0.10.0" # smoke tests only work with this version [features] tokio = ["dep:tokio", "dep:tokio-util", "dep:webrtc", "if-watch/tokio"] diff --git a/wasm-tests/webtransport-tests/src/lib.rs b/wasm-tests/webtransport-tests/src/lib.rs index 207bdb03b91..0ff838b49e5 100644 --- a/wasm-tests/webtransport-tests/src/lib.rs +++ b/wasm-tests/webtransport-tests/src/lib.rs @@ -20,7 +20,7 @@ use web_sys::{window, Response}; wasm_bindgen_test_configure!(run_in_browser); #[wasm_bindgen_test] -async fn single_conn_single_stream() { +pub async fn single_conn_single_stream() { let mut conn = new_connection_to_echo_server().await; let mut stream = create_stream(&mut conn).await; @@ -28,7 +28,7 @@ async fn single_conn_single_stream() { } #[wasm_bindgen_test] -async fn single_conn_single_stream_incoming() { +pub async fn single_conn_single_stream_incoming() { let mut conn = new_connection_to_echo_server().await; let mut stream = incoming_stream(&mut conn).await; @@ -36,7 +36,7 @@ async fn single_conn_single_stream_incoming() { } #[wasm_bindgen_test] -async fn single_conn_multiple_streams() { +pub async fn single_conn_multiple_streams() { let mut conn = new_connection_to_echo_server().await; let mut tasks = Vec::new(); let mut streams = Vec::new(); @@ -59,7 +59,7 @@ async fn single_conn_multiple_streams() { } #[wasm_bindgen_test] -async fn multiple_conn_multiple_streams() { +pub async fn multiple_conn_multiple_streams() { let mut tasks = Vec::new(); let mut conns = Vec::new(); @@ -90,7 +90,7 @@ async fn multiple_conn_multiple_streams() { } #[wasm_bindgen_test] -async fn multiple_conn_multiple_streams_sequential() { +pub async fn multiple_conn_multiple_streams_sequential() { for _ in 0..10 { let mut conn = new_connection_to_echo_server().await; @@ -107,7 +107,7 @@ async fn multiple_conn_multiple_streams_sequential() { } #[wasm_bindgen_test] -async fn read_leftovers() { +pub async fn read_leftovers() { let mut conn = new_connection_to_echo_server().await; let mut stream = create_stream(&mut conn).await; @@ -130,7 +130,7 @@ async fn read_leftovers() { } #[wasm_bindgen_test] -async fn allow_read_after_closing_writer() { +pub async fn allow_read_after_closing_writer() { let mut conn = new_connection_to_echo_server().await; let mut stream = create_stream(&mut conn).await; @@ -156,7 +156,7 @@ async fn allow_read_after_closing_writer() { } #[wasm_bindgen_test] -async fn poll_outbound_error_after_connection_close() { +pub async fn poll_outbound_error_after_connection_close() { let mut conn = new_connection_to_echo_server().await; // Make sure that poll_outbound works well before closing the connection @@ -174,7 +174,7 @@ async fn poll_outbound_error_after_connection_close() { } #[wasm_bindgen_test] -async fn poll_inbound_error_after_connection_close() { +pub async fn poll_inbound_error_after_connection_close() { let mut conn = new_connection_to_echo_server().await; // Make sure that poll_inbound works well before closing the connection @@ -192,7 +192,7 @@ async fn poll_inbound_error_after_connection_close() { } #[wasm_bindgen_test] -async fn read_error_after_connection_drop() { +pub async fn read_error_after_connection_drop() { let mut conn = new_connection_to_echo_server().await; let mut stream = create_stream(&mut conn).await; @@ -207,7 +207,7 @@ async fn read_error_after_connection_drop() { } #[wasm_bindgen_test] -async fn read_error_after_connection_close() { +pub async fn read_error_after_connection_close() { let mut conn = new_connection_to_echo_server().await; let mut stream = create_stream(&mut conn).await; @@ -225,7 +225,7 @@ async fn read_error_after_connection_close() { } #[wasm_bindgen_test] -async fn write_error_after_connection_drop() { +pub async fn write_error_after_connection_drop() { let mut conn = new_connection_to_echo_server().await; let mut stream = create_stream(&mut conn).await; @@ -240,7 +240,7 @@ async fn write_error_after_connection_drop() { } #[wasm_bindgen_test] -async fn write_error_after_connection_close() { +pub async fn write_error_after_connection_close() { let mut conn = new_connection_to_echo_server().await; let mut stream = create_stream(&mut conn).await; @@ -258,7 +258,7 @@ async fn write_error_after_connection_close() { } #[wasm_bindgen_test] -async fn connect_without_peer_id() { +pub async fn connect_without_peer_id() { let mut addr = fetch_server_addr().await; let keypair = Keypair::generate_ed25519(); @@ -280,7 +280,7 @@ async fn connect_without_peer_id() { } #[wasm_bindgen_test] -async fn error_on_unknown_peer_id() { +pub async fn error_on_unknown_peer_id() { let mut addr = fetch_server_addr().await; let keypair = Keypair::generate_ed25519(); @@ -306,7 +306,7 @@ async fn error_on_unknown_peer_id() { } #[wasm_bindgen_test] -async fn error_on_unknown_certhash() { +pub async fn error_on_unknown_certhash() { let mut addr = fetch_server_addr().await; let keypair = Keypair::generate_ed25519(); From e1d02ca0d9458ab4e0afccac91be9221d92294f8 Mon Sep 17 00:00:00 2001 From: hopinheimer <48147533+hopinheimer@users.noreply.github.com> Date: Sun, 29 Dec 2024 16:29:15 -0500 Subject: [PATCH 09/56] feat(gossipsub): Allow setting a size threshold for IDONTWANT messages This PR adds configurable parameter that sets minimum message size for which `IDONTWANT` messages would be send. This is an optimisation trick, discussion regarding the same can be found [here](https://github.com/sigp/lighthouse/issues/6437) Pull-Request: #5770. --- protocols/gossipsub/CHANGELOG.md | 2 + protocols/gossipsub/src/behaviour.rs | 7 +++- protocols/gossipsub/src/behaviour/tests.rs | 44 +++++++++++++++++++++- protocols/gossipsub/src/config.rs | 27 +++++++++++++ 4 files changed, 77 insertions(+), 3 deletions(-) diff --git a/protocols/gossipsub/CHANGELOG.md b/protocols/gossipsub/CHANGELOG.md index 5e18f284fc4..d5054bea945 100644 --- a/protocols/gossipsub/CHANGELOG.md +++ b/protocols/gossipsub/CHANGELOG.md @@ -1,4 +1,6 @@ ## 0.48.0 +- Add configurable `idontwant_message_size_threshold` parameter. + See [PR 5770](https://github.com/libp2p/rust-libp2p/pull/5770) - Introduce Gossipsub v1.2 [spec](https://github.com/libp2p/specs/blob/master/pubsub/gossipsub/gossipsub-v1.2.md). See [PR 5697](https://github.com/libp2p/rust-libp2p/pull/5697) diff --git a/protocols/gossipsub/src/behaviour.rs b/protocols/gossipsub/src/behaviour.rs index 4643f2bd97f..4de314d7423 100644 --- a/protocols/gossipsub/src/behaviour.rs +++ b/protocols/gossipsub/src/behaviour.rs @@ -1739,8 +1739,10 @@ where // Calculate the message id on the transformed data. let msg_id = self.config.message_id(&message); - // Broadcast IDONTWANT messages. - self.send_idontwant(&raw_message, &msg_id, propagation_source); + // Broadcast IDONTWANT messages + if raw_message.raw_protobuf_len() > self.config.idontwant_message_size_threshold() { + self.send_idontwant(&raw_message, &msg_id, propagation_source); + } // Check the validity of the message // Peers get penalized if this message is invalid. We don't add it to the duplicate cache @@ -1757,6 +1759,7 @@ where self.mcache.observe_duplicate(&msg_id, propagation_source); return; } + tracing::debug!( message=%msg_id, "Put message in duplicate_cache and resolve promises" diff --git a/protocols/gossipsub/src/behaviour/tests.rs b/protocols/gossipsub/src/behaviour/tests.rs index f3d24897b0c..bed74ecdce7 100644 --- a/protocols/gossipsub/src/behaviour/tests.rs +++ b/protocols/gossipsub/src/behaviour/tests.rs @@ -5288,7 +5288,7 @@ fn sends_idontwant() { let message = RawMessage { source: Some(peers[1]), - data: vec![12], + data: vec![12u8; 1024], sequence_number: Some(0), topic: topic_hashes[0].clone(), signature: None, @@ -5314,6 +5314,48 @@ fn sends_idontwant() { ); } +#[test] +fn doesnt_sends_idontwant_for_lower_message_size() { + let (mut gs, peers, receivers, topic_hashes) = inject_nodes1() + .peer_no(5) + .topics(vec![String::from("topic1")]) + .to_subscribe(true) + .gs_config(Config::default()) + .explicit(1) + .peer_kind(PeerKind::Gossipsubv1_2) + .create_network(); + + let local_id = PeerId::random(); + + let message = RawMessage { + source: Some(peers[1]), + data: vec![12], + sequence_number: Some(0), + topic: topic_hashes[0].clone(), + signature: None, + key: None, + validated: true, + }; + + gs.handle_received_message(message.clone(), &local_id); + assert_eq!( + receivers + .into_iter() + .fold(0, |mut idontwants, (peer_id, c)| { + let non_priority = c.non_priority.get_ref(); + while !non_priority.is_empty() { + if let Ok(RpcOut::IDontWant(_)) = non_priority.try_recv() { + assert_ne!(peer_id, peers[1]); + idontwants += 1; + } + } + idontwants + }), + 0, + "IDONTWANT was sent" + ); +} + /// Test that a node doesn't send IDONTWANT messages to the mesh peers /// that don't run Gossipsub v1.2. #[test] diff --git a/protocols/gossipsub/src/config.rs b/protocols/gossipsub/src/config.rs index d53908ad267..7bd6c9c583d 100644 --- a/protocols/gossipsub/src/config.rs +++ b/protocols/gossipsub/src/config.rs @@ -98,6 +98,7 @@ pub struct Config { connection_handler_queue_len: usize, connection_handler_publish_duration: Duration, connection_handler_forward_duration: Duration, + idontwant_message_size_threshold: usize, } impl Config { @@ -371,6 +372,16 @@ impl Config { pub fn forward_queue_duration(&self) -> Duration { self.connection_handler_forward_duration } + + // The message size threshold for which IDONTWANT messages are sent. + // Sending IDONTWANT messages for small messages can have a negative effect to the overall + // traffic and CPU load. This acts as a lower bound cutoff for the message size to which + // IDONTWANT won't be sent to peers. Only works if the peers support Gossipsub1.2 + // (see https://github.com/libp2p/specs/blob/master/pubsub/gossipsub/gossipsub-v1.2.md#idontwant-message) + // default is 1kB + pub fn idontwant_message_size_threshold(&self) -> usize { + self.idontwant_message_size_threshold + } } impl Default for Config { @@ -443,6 +454,7 @@ impl Default for ConfigBuilder { connection_handler_queue_len: 5000, connection_handler_publish_duration: Duration::from_secs(5), connection_handler_forward_duration: Duration::from_secs(1), + idontwant_message_size_threshold: 1000, }, invalid_protocol: false, } @@ -829,6 +841,17 @@ impl ConfigBuilder { self } + // The message size threshold for which IDONTWANT messages are sent. + // Sending IDONTWANT messages for small messages can have a negative effect to the overall + // traffic and CPU load. This acts as a lower bound cutoff for the message size to which + // IDONTWANT won't be sent to peers. Only works if the peers support Gossipsub1.2 + // (see https://github.com/libp2p/specs/blob/master/pubsub/gossipsub/gossipsub-v1.2.md#idontwant-message) + // default is 1kB + pub fn idontwant_message_size_threshold(&mut self, size: usize) -> &mut Self { + self.config.idontwant_message_size_threshold = size; + self + } + /// Constructs a [`Config`] from the given configuration and validates the settings. pub fn build(&self) -> Result { // check all constraints on config @@ -899,6 +922,10 @@ impl std::fmt::Debug for Config { "published_message_ids_cache_time", &self.published_message_ids_cache_time, ); + let _ = builder.field( + "idontwant_message_size_threhold", + &self.idontwant_message_size_threshold, + ); builder.finish() } } From 5841277b3e5498e7126f0fb5347f027039071d51 Mon Sep 17 00:00:00 2001 From: Elena Frank Date: Thu, 2 Jan 2025 21:35:44 +0700 Subject: [PATCH 10/56] chore(kad): revert version bump Revert version bump, because `libp2p-kad-0.47.0` isn't released yet. Pull-Request: #5776. --- Cargo.lock | 2 +- Cargo.toml | 2 +- protocols/kad/CHANGELOG.md | 11 ++++------- protocols/kad/Cargo.toml | 2 +- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e6f00ab4c9f..c73e12ed86d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2935,7 +2935,7 @@ dependencies = [ [[package]] name = "libp2p-kad" -version = "0.47.1" +version = "0.47.0" dependencies = [ "async-std", "asynchronous-codec", diff --git a/Cargo.toml b/Cargo.toml index 8c5c4c320c1..61266bd5827 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -84,7 +84,7 @@ libp2p-floodsub = { version = "0.45.0", path = "protocols/floodsub" } libp2p-gossipsub = { version = "0.48.0", path = "protocols/gossipsub" } libp2p-identify = { version = "0.46.1", path = "protocols/identify" } libp2p-identity = { version = "0.2.10" } -libp2p-kad = { version = "0.47.1", path = "protocols/kad" } +libp2p-kad = { version = "0.47.0", path = "protocols/kad" } libp2p-mdns = { version = "0.46.1", path = "protocols/mdns" } libp2p-memory-connection-limits = { version = "0.3.1", path = "misc/memory-connection-limits" } libp2p-metrics = { version = "0.15.0", path = "misc/metrics" } diff --git a/protocols/kad/CHANGELOG.md b/protocols/kad/CHANGELOG.md index 71ef499a179..0793c964fd8 100644 --- a/protocols/kad/CHANGELOG.md +++ b/protocols/kad/CHANGELOG.md @@ -1,10 +1,3 @@ -## 0.47.1 - -- Expose Distance private field U256 to public. - See [PR 5705](https://github.com/libp2p/rust-libp2p/pull/5705). -- Fix systematic memory allocation when iterating over `KBuckets`. - See [PR 5715](https://github.com/libp2p/rust-libp2p/pull/5715). - ## 0.47.0 - Expose a kad query facility allowing specify num_results dynamicaly. @@ -15,6 +8,10 @@ See [PR 5645](https://github.com/libp2p/rust-libp2p/pull/5645). - Fix `cargo clippy` warnings in `rustc 1.84.0-beta.1`. See [PR 5700](https://github.com/libp2p/rust-libp2p/pull/5700). +- Expose Distance private field U256 to public. + See [PR 5705](https://github.com/libp2p/rust-libp2p/pull/5705). +- Fix systematic memory allocation when iterating over `KBuckets`. + See [PR 5715](https://github.com/libp2p/rust-libp2p/pull/5715). ## 0.46.2 diff --git a/protocols/kad/Cargo.toml b/protocols/kad/Cargo.toml index 9b8ec64205a..757c0aed189 100644 --- a/protocols/kad/Cargo.toml +++ b/protocols/kad/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-kad" edition = "2021" rust-version = { workspace = true } description = "Kademlia protocol for libp2p" -version = "0.47.1" +version = "0.47.0" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" From a14776ea7778b7ec17057b8a6cd1711d64131ceb Mon Sep 17 00:00:00 2001 From: Elena Frank Date: Thu, 2 Jan 2025 21:46:07 +0700 Subject: [PATCH 11/56] chore(autonat): revert version bump Revert version bump, `libp2p-autonat-v0.13.1` isn't released yet. Pull-Request: #5777. --- Cargo.lock | 2 +- Cargo.toml | 2 +- protocols/autonat/CHANGELOG.md | 6 +----- protocols/autonat/Cargo.toml | 2 +- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c73e12ed86d..f7597208662 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2716,7 +2716,7 @@ dependencies = [ [[package]] name = "libp2p-autonat" -version = "0.13.2" +version = "0.13.1" dependencies = [ "async-trait", "asynchronous-codec", diff --git a/Cargo.toml b/Cargo.toml index 61266bd5827..17ac1f3dadc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -75,7 +75,7 @@ rust-version = "1.75.0" [workspace.dependencies] libp2p = { version = "0.54.2", path = "libp2p" } libp2p-allow-block-list = { version = "0.4.2", path = "misc/allow-block-list" } -libp2p-autonat = { version = "0.13.2", path = "protocols/autonat" } +libp2p-autonat = { version = "0.13.1", path = "protocols/autonat" } libp2p-connection-limits = { version = "0.4.1", path = "misc/connection-limits" } libp2p-core = { version = "0.42.1", path = "core" } libp2p-dcutr = { version = "0.12.1", path = "protocols/dcutr" } diff --git a/protocols/autonat/CHANGELOG.md b/protocols/autonat/CHANGELOG.md index f946f59c9ef..75a40b8c5ad 100644 --- a/protocols/autonat/CHANGELOG.md +++ b/protocols/autonat/CHANGELOG.md @@ -1,13 +1,9 @@ -## 0.13.2 - -- Update to `libp2p-request-response` `v0.28.0`. - ## 0.13.1 - Verify that an incoming AutoNAT dial comes from a connected peer. See [PR 5597](https://github.com/libp2p/rust-libp2p/pull/5597). - - Deprecate `void` crate. See [PR 5676](https://github.com/libp2p/rust-libp2p/pull/5676). +- Update to `libp2p-request-response` `v0.28.0`. ## 0.13.0 diff --git a/protocols/autonat/Cargo.toml b/protocols/autonat/Cargo.toml index 5f5d18562fd..8ad4492fbff 100644 --- a/protocols/autonat/Cargo.toml +++ b/protocols/autonat/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-autonat" edition = "2021" rust-version = { workspace = true } description = "NAT and firewall detection for libp2p" -version = "0.13.2" +version = "0.13.1" authors = [ "David Craven ", "Elena Frank ", From f7f9e137960a3e57d14f05fdf41ce5a64c0deae6 Mon Sep 17 00:00:00 2001 From: Elena Frank Date: Thu, 2 Jan 2025 22:02:25 +0700 Subject: [PATCH 12/56] chore(server): revert version bump Revert version bump, `libp2p-server-v0.12.6` isn't released yet. Pull-Request: #5780. --- Cargo.lock | 2 +- Cargo.toml | 2 +- misc/server/CHANGELOG.md | 20 +++++--------------- misc/server/Cargo.toml | 2 +- 4 files changed, 8 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f7597208662..8df2890b494 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3267,7 +3267,7 @@ dependencies = [ [[package]] name = "libp2p-server" -version = "0.12.8" +version = "0.12.6" dependencies = [ "axum", "base64 0.22.1", diff --git a/Cargo.toml b/Cargo.toml index 17ac1f3dadc..8030d400320 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -98,7 +98,7 @@ libp2p-quic = { version = "0.11.2", path = "transports/quic" } libp2p-relay = { version = "0.18.1", path = "protocols/relay" } libp2p-rendezvous = { version = "0.15.1", path = "protocols/rendezvous" } libp2p-request-response = { version = "0.28.0", path = "protocols/request-response" } -libp2p-server = { version = "0.12.8", path = "misc/server" } +libp2p-server = { version = "0.12.6", path = "misc/server" } libp2p-stream = { version = "0.2.0-alpha.1", path = "protocols/stream" } libp2p-swarm = { version = "0.45.2", path = "swarm" } libp2p-swarm-derive = { version = "=0.35.0", path = "swarm-derive" } # `libp2p-swarm-derive` may not be compatible with different `libp2p-swarm` non-breaking releases. E.g. `libp2p-swarm` might introduce a new enum variant `FromSwarm` (which is `#[non-exhaustive]`) in a non-breaking release. Older versions of `libp2p-swarm-derive` would not forward this enum variant within the `NetworkBehaviour` hierarchy. Thus the version pinning is required. diff --git a/misc/server/CHANGELOG.md b/misc/server/CHANGELOG.md index fe48de0f553..53341baa9ab 100644 --- a/misc/server/CHANGELOG.md +++ b/misc/server/CHANGELOG.md @@ -1,25 +1,15 @@ -## 0.12.8 - -### Changed - -- Remove deprecated [`libp2p-lookup`](https://github.com/mxinden/libp2p-lookup) from Dockerfile. - See [PR 5610](https://github.com/libp2p/rust-libp2p/pull/5610). - -## 0.12.7 +## 0.12.6 ### Changed +- Stop using kad default protocol. + See [PR 5122](https://github.com/libp2p/rust-libp2p/pull/5122) - Use periodic and automatic bootstrap of Kademlia. See [PR 4838](https://github.com/libp2p/rust-libp2p/pull/4838). - Update to [`libp2p-identify` `v0.45.0`](protocols/identify/CHANGELOG.md#0450). See [PR 4981](https://github.com/libp2p/rust-libp2p/pull/4981). - -## 0.12.6 - -### Changed - -- Stop using kad default protocol. - See [PR 5122](https://github.com/libp2p/rust-libp2p/pull/5122) +- Remove deprecated [`libp2p-lookup`](https://github.com/mxinden/libp2p-lookup) from Dockerfile. + See [PR 5610](https://github.com/libp2p/rust-libp2p/pull/5610). ## 0.12.5 diff --git a/misc/server/Cargo.toml b/misc/server/Cargo.toml index 02da0adb9ef..b2b3d33ca1e 100644 --- a/misc/server/Cargo.toml +++ b/misc/server/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "libp2p-server" -version = "0.12.8" +version = "0.12.6" authors = ["Max Inden "] edition = "2021" repository = "https://github.com/libp2p/rust-libp2p" From 2f9294c5d6fd62a2dd0daefc9fce526ffc52217f Mon Sep 17 00:00:00 2001 From: Elena Frank Date: Thu, 2 Jan 2025 22:13:02 +0700 Subject: [PATCH 13/56] chore(identify): revert version bump Revert version bump, `libp2p-identify-v0.46.0` isn't released yet. Pull-Request: #5778. --- Cargo.lock | 2 +- Cargo.toml | 2 +- protocols/identify/CHANGELOG.md | 6 ++---- protocols/identify/Cargo.toml | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8df2890b494..8b7ef2022a3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2886,7 +2886,7 @@ dependencies = [ [[package]] name = "libp2p-identify" -version = "0.46.1" +version = "0.46.0" dependencies = [ "async-std", "asynchronous-codec", diff --git a/Cargo.toml b/Cargo.toml index 8030d400320..657a347d45e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -82,7 +82,7 @@ libp2p-dcutr = { version = "0.12.1", path = "protocols/dcutr" } libp2p-dns = { version = "0.42.1", path = "transports/dns" } libp2p-floodsub = { version = "0.45.0", path = "protocols/floodsub" } libp2p-gossipsub = { version = "0.48.0", path = "protocols/gossipsub" } -libp2p-identify = { version = "0.46.1", path = "protocols/identify" } +libp2p-identify = { version = "0.46.0", path = "protocols/identify" } libp2p-identity = { version = "0.2.10" } libp2p-kad = { version = "0.47.0", path = "protocols/kad" } libp2p-mdns = { version = "0.46.1", path = "protocols/mdns" } diff --git a/protocols/identify/CHANGELOG.md b/protocols/identify/CHANGELOG.md index 2b136740156..e9f7b017574 100644 --- a/protocols/identify/CHANGELOG.md +++ b/protocols/identify/CHANGELOG.md @@ -1,11 +1,9 @@ -## 0.46.1 -- Discard `Info`s received from remote peers that contain a public key that doesn't match their peer ID. - See [PR 5707](https://github.com/libp2p/rust-libp2p/pull/5707). - ## 0.46.0 - Make `identify::Config` fields private and add getter functions. See [PR 5663](https://github.com/libp2p/rust-libp2p/pull/5663). +- Discard `Info`s received from remote peers that contain a public key that doesn't match their peer ID. + See [PR 5707](https://github.com/libp2p/rust-libp2p/pull/5707). ## 0.45.1 diff --git a/protocols/identify/Cargo.toml b/protocols/identify/Cargo.toml index 4ce2a0c1bd9..9c4f8ea3707 100644 --- a/protocols/identify/Cargo.toml +++ b/protocols/identify/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-identify" edition = "2021" rust-version = { workspace = true } description = "Nodes identification protocol for libp2p" -version = "0.46.1" +version = "0.46.0" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" From fd3f7c400b39e8a7d5913d53dc151db58781c3a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Thu, 2 Jan 2025 15:26:24 +0000 Subject: [PATCH 14/56] chore(ci): add Zlib to deny.toml Similar to https://github.com/libp2p/rust-libp2p/pull/5738, [`foldhash`](https://crates.io/crates/foldhash) is the dependency that requires it. It was introduced by `hashbrown` which is dependency of a lot of crates [here](https://github.com/rust-lang/hashbrown/pull/563). `hashbrown` is MIT, and Zlib is also an Open Source Initiative [approved license](https://opensource.org/license/zlib). If you prefer we can also do as the upstream `cargo-deny` do and just add `foldhash` [to the exceptions](https://github.com/EmbarkStudios/cargo-deny/pull/618/files#diff-1040309c64844eb1b6b63d8fd67938adbf9461f1b3c61f12cf738f064a02d3deR56) but I can't see any advantage to it. Cc @hanabi1224 Pull-Request: #5769. --- deny.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/deny.toml b/deny.toml index 9e0e201527b..47487553028 100644 --- a/deny.toml +++ b/deny.toml @@ -44,6 +44,7 @@ allow = [ "MPL-2.0", "Unlicense", "Unicode-3.0", + "Zlib", ] # The confidence threshold for detecting a license from license text. # The higher the value, the more closely the license text must be to the From 02040ffd79fab078d94cf6bbc000f02a647a95b0 Mon Sep 17 00:00:00 2001 From: Elena Frank Date: Thu, 2 Jan 2025 23:48:57 +0700 Subject: [PATCH 15/56] chore(allow-block-list): revert version bump Revert version bump, `libp2p-allow-block-list-v0.4.1` isn't released yet. Pull-Request: #5779. --- Cargo.lock | 2 +- Cargo.toml | 2 +- misc/allow-block-list/CHANGELOG.md | 7 ++----- misc/allow-block-list/Cargo.toml | 2 +- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8b7ef2022a3..091b1b8dede 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2704,7 +2704,7 @@ dependencies = [ [[package]] name = "libp2p-allow-block-list" -version = "0.4.2" +version = "0.4.1" dependencies = [ "async-std", "libp2p-core", diff --git a/Cargo.toml b/Cargo.toml index 657a347d45e..b8186584487 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -74,7 +74,7 @@ rust-version = "1.75.0" [workspace.dependencies] libp2p = { version = "0.54.2", path = "libp2p" } -libp2p-allow-block-list = { version = "0.4.2", path = "misc/allow-block-list" } +libp2p-allow-block-list = { version = "0.4.1", path = "misc/allow-block-list" } libp2p-autonat = { version = "0.13.1", path = "protocols/autonat" } libp2p-connection-limits = { version = "0.4.1", path = "misc/connection-limits" } libp2p-core = { version = "0.42.1", path = "core" } diff --git a/misc/allow-block-list/CHANGELOG.md b/misc/allow-block-list/CHANGELOG.md index b5ffd7f0495..e7f68f6f8fe 100644 --- a/misc/allow-block-list/CHANGELOG.md +++ b/misc/allow-block-list/CHANGELOG.md @@ -1,13 +1,10 @@ -## 0.4.2 - -- Deprecate `void` crate. - See [PR 5676](https://github.com/libp2p/rust-libp2p/pull/5676). - ## 0.4.1 - Add getters & setters for the allowed/blocked peers. Return a `bool` for every "insert/remove" function, informing if a change was performed. See [PR 5572](https://github.com/libp2p/rust-libp2p/pull/5572). +- Deprecate `void` crate. + See [PR 5676](https://github.com/libp2p/rust-libp2p/pull/5676). ## 0.4.0 diff --git a/misc/allow-block-list/Cargo.toml b/misc/allow-block-list/Cargo.toml index 66ee3ef9124..c169be87056 100644 --- a/misc/allow-block-list/Cargo.toml +++ b/misc/allow-block-list/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-allow-block-list" edition = "2021" rust-version = { workspace = true } description = "Allow/block list connection management for libp2p." -version = "0.4.2" +version = "0.4.1" license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" keywords = ["peer-to-peer", "libp2p", "networking"] From 40550dc8895872d6028236050786ffdab435c16b Mon Sep 17 00:00:00 2001 From: DrHuangMHT Date: Sat, 4 Jan 2025 02:51:48 +0800 Subject: [PATCH 16/56] chore(kad): remove default constructor for ProtocolConfig Remove items that were deprecated in #5122. Pull-Request: #5774. --- protocols/kad/CHANGELOG.md | 2 ++ protocols/kad/src/behaviour.rs | 23 ----------------------- protocols/kad/src/protocol.rs | 28 +--------------------------- 3 files changed, 3 insertions(+), 50 deletions(-) diff --git a/protocols/kad/CHANGELOG.md b/protocols/kad/CHANGELOG.md index 0793c964fd8..0c6e460afcd 100644 --- a/protocols/kad/CHANGELOG.md +++ b/protocols/kad/CHANGELOG.md @@ -12,6 +12,8 @@ See [PR 5705](https://github.com/libp2p/rust-libp2p/pull/5705). - Fix systematic memory allocation when iterating over `KBuckets`. See [PR 5715](https://github.com/libp2p/rust-libp2p/pull/5715). +- Remove deprecated default constructor for `ProtocolConfig`. + See [PR 5774](https://github.com/libp2p/rust-libp2p/pull/5774). ## 0.46.2 diff --git a/protocols/kad/src/behaviour.rs b/protocols/kad/src/behaviour.rs index 1ba8b1e27af..04ebe7d8174 100644 --- a/protocols/kad/src/behaviour.rs +++ b/protocols/kad/src/behaviour.rs @@ -238,29 +238,6 @@ impl Config { } } - /// Returns the default configuration. - #[deprecated(note = "Use `Config::new` instead")] - #[allow(clippy::should_implement_trait)] - pub fn default() -> Self { - Default::default() - } - - /// Sets custom protocol names. - /// - /// Kademlia nodes only communicate with other nodes using the same protocol - /// name. Using custom name(s) therefore allows to segregate the DHT from - /// others, if that is desired. - /// - /// More than one protocol name can be supplied. In this case the node will - /// be able to talk to other nodes supporting any of the provided names. - /// Multiple names must be used with caution to avoid network partitioning. - #[deprecated(note = "Use `Config::new` instead")] - #[allow(deprecated)] - pub fn set_protocol_names(&mut self, names: Vec) -> &mut Self { - self.protocol_config.set_protocol_names(names); - self - } - /// Sets the timeout for a single query. /// /// > **Note**: A single query usually comprises at least as many requests diff --git a/protocols/kad/src/protocol.rs b/protocols/kad/src/protocol.rs index 9d0d69b670e..059b6ae6fd1 100644 --- a/protocols/kad/src/protocol.rs +++ b/protocols/kad/src/protocol.rs @@ -26,7 +26,7 @@ //! to poll the underlying transport for incoming messages, and the `Sink` component //! is used to send messages to remote peers. -use std::{io, iter, marker::PhantomData, time::Duration}; +use std::{io, marker::PhantomData, time::Duration}; use asynchronous_codec::{Decoder, Encoder, Framed}; use bytes::BytesMut; @@ -156,43 +156,17 @@ impl ProtocolConfig { } } - /// Returns the default configuration. - #[deprecated(note = "Use `ProtocolConfig::new` instead")] - #[allow(clippy::should_implement_trait)] - pub fn default() -> Self { - Default::default() - } - /// Returns the configured protocol name. pub fn protocol_names(&self) -> &[StreamProtocol] { &self.protocol_names } - /// Modifies the protocol names used on the wire. Can be used to create incompatibilities - /// between networks on purpose. - #[deprecated(note = "Use `ProtocolConfig::new` instead")] - pub fn set_protocol_names(&mut self, names: Vec) { - self.protocol_names = names; - } - /// Modifies the maximum allowed size of a single Kademlia packet. pub fn set_max_packet_size(&mut self, size: usize) { self.max_packet_size = size; } } -impl Default for ProtocolConfig { - /// Returns the default configuration. - /// - /// Deprecated: use `ProtocolConfig::new` instead. - fn default() -> Self { - ProtocolConfig { - protocol_names: iter::once(DEFAULT_PROTO_NAME).collect(), - max_packet_size: DEFAULT_MAX_PACKET_SIZE, - } - } -} - impl UpgradeInfo for ProtocolConfig { type Info = StreamProtocol; type InfoIter = std::vec::IntoIter; From 7e3086dd8333d73fa7a106bad858d238ceb1048e Mon Sep 17 00:00:00 2001 From: hopinheimer <48147533+hopinheimer@users.noreply.github.com> Date: Sat, 4 Jan 2025 17:08:32 -0500 Subject: [PATCH 17/56] feat: broadcasting `idontwant` for published messages This PR introduces an optimisation to preemptively broadcast `IDONTWANT` for published messages, preventing redundant downloads of the same message received over gossip. This feature is opt-in and respects the existing `idontwant_message_size_threshold`. By default, `IDONTWANT` messages will only be sent for published messages larger than 1000 bytes. reference PRs: [spec](https://github.com/libp2p/specs/pull/642) Pull-Request: #5773. --- protocols/gossipsub/CHANGELOG.md | 4 +++ protocols/gossipsub/src/behaviour.rs | 15 +++++++--- protocols/gossipsub/src/config.rs | 42 ++++++++++++++++++++-------- 3 files changed, 45 insertions(+), 16 deletions(-) diff --git a/protocols/gossipsub/CHANGELOG.md b/protocols/gossipsub/CHANGELOG.md index d5054bea945..550bbad4d99 100644 --- a/protocols/gossipsub/CHANGELOG.md +++ b/protocols/gossipsub/CHANGELOG.md @@ -1,4 +1,8 @@ ## 0.48.0 + +- Allow broadcasting `IDONTWANT` messages when publishing to avoid downloading data that is already available. + See [PR 5773](https://github.com/libp2p/rust-libp2p/pull/5773) + - Add configurable `idontwant_message_size_threshold` parameter. See [PR 5770](https://github.com/libp2p/rust-libp2p/pull/5770) diff --git a/protocols/gossipsub/src/behaviour.rs b/protocols/gossipsub/src/behaviour.rs index 4de314d7423..6172875e5b9 100644 --- a/protocols/gossipsub/src/behaviour.rs +++ b/protocols/gossipsub/src/behaviour.rs @@ -757,6 +757,13 @@ where return Err(PublishError::AllQueuesFull(recipient_peers.len())); } + // Broadcast IDONTWANT messages + if raw_message.raw_protobuf_len() > self.config.idontwant_message_size_threshold() + && self.config.idontwant_on_publish() + { + self.send_idontwant(&raw_message, &msg_id, raw_message.source.as_ref()); + } + tracing::debug!(message=%msg_id, "Published message"); if let Some(metrics) = self.metrics.as_mut() { @@ -1741,7 +1748,7 @@ where // Broadcast IDONTWANT messages if raw_message.raw_protobuf_len() > self.config.idontwant_message_size_threshold() { - self.send_idontwant(&raw_message, &msg_id, propagation_source); + self.send_idontwant(&raw_message, &msg_id, Some(propagation_source)); } // Check the validity of the message @@ -2600,7 +2607,7 @@ where &mut self, message: &RawMessage, msg_id: &MessageId, - propagation_source: &PeerId, + propagation_source: Option<&PeerId>, ) { let Some(mesh_peers) = self.mesh.get(&message.topic) else { return; @@ -2611,8 +2618,8 @@ where let recipient_peers: Vec = mesh_peers .iter() .chain(iwant_peers.iter()) - .filter(|peer_id| { - *peer_id != propagation_source && Some(*peer_id) != message.source.as_ref() + .filter(|&peer_id| { + Some(peer_id) != propagation_source && Some(peer_id) != message.source.as_ref() }) .cloned() .collect(); diff --git a/protocols/gossipsub/src/config.rs b/protocols/gossipsub/src/config.rs index 7bd6c9c583d..3b0eeafcbb6 100644 --- a/protocols/gossipsub/src/config.rs +++ b/protocols/gossipsub/src/config.rs @@ -99,6 +99,7 @@ pub struct Config { connection_handler_publish_duration: Duration, connection_handler_forward_duration: Duration, idontwant_message_size_threshold: usize, + idontwant_on_publish: bool, } impl Config { @@ -373,15 +374,22 @@ impl Config { self.connection_handler_forward_duration } - // The message size threshold for which IDONTWANT messages are sent. - // Sending IDONTWANT messages for small messages can have a negative effect to the overall - // traffic and CPU load. This acts as a lower bound cutoff for the message size to which - // IDONTWANT won't be sent to peers. Only works if the peers support Gossipsub1.2 - // (see https://github.com/libp2p/specs/blob/master/pubsub/gossipsub/gossipsub-v1.2.md#idontwant-message) - // default is 1kB + /// The message size threshold for which IDONTWANT messages are sent. + /// Sending IDONTWANT messages for small messages can have a negative effect to the overall + /// traffic and CPU load. This acts as a lower bound cutoff for the message size to which + /// IDONTWANT won't be sent to peers. Only works if the peers support Gossipsub1.2 + /// (see ) + /// default is 1kB pub fn idontwant_message_size_threshold(&self) -> usize { self.idontwant_message_size_threshold } + + /// Send IDONTWANT messages after publishing message on gossip. This is an optimisation + /// to avoid bandwidth consumption by downloading the published message over gossip. + /// By default it is false. + pub fn idontwant_on_publish(&self) -> bool { + self.idontwant_on_publish + } } impl Default for Config { @@ -455,6 +463,7 @@ impl Default for ConfigBuilder { connection_handler_publish_duration: Duration::from_secs(5), connection_handler_forward_duration: Duration::from_secs(1), idontwant_message_size_threshold: 1000, + idontwant_on_publish: false, }, invalid_protocol: false, } @@ -841,17 +850,25 @@ impl ConfigBuilder { self } - // The message size threshold for which IDONTWANT messages are sent. - // Sending IDONTWANT messages for small messages can have a negative effect to the overall - // traffic and CPU load. This acts as a lower bound cutoff for the message size to which - // IDONTWANT won't be sent to peers. Only works if the peers support Gossipsub1.2 - // (see https://github.com/libp2p/specs/blob/master/pubsub/gossipsub/gossipsub-v1.2.md#idontwant-message) - // default is 1kB + /// The message size threshold for which IDONTWANT messages are sent. + /// Sending IDONTWANT messages for small messages can have a negative effect to the overall + /// traffic and CPU load. This acts as a lower bound cutoff for the message size to which + /// IDONTWANT won't be sent to peers. Only works if the peers support Gossipsub1.2 + /// (see ) + /// default is 1kB pub fn idontwant_message_size_threshold(&mut self, size: usize) -> &mut Self { self.config.idontwant_message_size_threshold = size; self } + /// Send IDONTWANT messages after publishing message on gossip. This is an optimisation + /// to avoid bandwidth consumption by downloading the published message over gossip. + /// By default it is false. + pub fn idontwant_on_publish(&mut self, idontwant_on_publish: bool) -> &mut Self { + self.config.idontwant_on_publish = idontwant_on_publish; + self + } + /// Constructs a [`Config`] from the given configuration and validates the settings. pub fn build(&self) -> Result { // check all constraints on config @@ -926,6 +943,7 @@ impl std::fmt::Debug for Config { "idontwant_message_size_threhold", &self.idontwant_message_size_threshold, ); + let _ = builder.field("idontwant_on_publish", &self.idontwant_on_publish); builder.finish() } } From 34ac47655dab3e4edf3704c41b3b939bc7ef1303 Mon Sep 17 00:00:00 2001 From: Akihito Nakano Date: Mon, 6 Jan 2025 23:28:33 +0900 Subject: [PATCH 18/56] fix(gossipsub): make sure we have fanout peers when publish This PR is to submit a fix in Lighthouse. https://github.com/sigp/lighthouse/pull/6738 An `InsufficientPeers` error can occur under a particular condition, even if we have peers subscribed to a topic. Pull-Request: #5793. --- protocols/gossipsub/CHANGELOG.md | 3 +++ protocols/gossipsub/src/behaviour.rs | 9 +++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/protocols/gossipsub/CHANGELOG.md b/protocols/gossipsub/CHANGELOG.md index 550bbad4d99..94b9b922973 100644 --- a/protocols/gossipsub/CHANGELOG.md +++ b/protocols/gossipsub/CHANGELOG.md @@ -35,6 +35,9 @@ - Fix `cargo clippy` warnings in `rustc 1.84.0-beta.1`. See [PR 5700](https://github.com/libp2p/rust-libp2p/pull/5700). +- Fixe an issue where an `InsufficientPeers` error could occur under certain conditions, despite having peers subscribed to a topic. + See [PR 5793](https://github.com/libp2p/rust-libp2p/pull/5793). + ## 0.47.0 diff --git a/protocols/gossipsub/src/behaviour.rs b/protocols/gossipsub/src/behaviour.rs index 6172875e5b9..356f1d6cd77 100644 --- a/protocols/gossipsub/src/behaviour.rs +++ b/protocols/gossipsub/src/behaviour.rs @@ -675,9 +675,14 @@ where // Gossipsub peers None => { tracing::debug!(topic=%topic_hash, "Topic not in the mesh"); + // `fanout_peers` is always non-empty if it's `Some`. + let fanout_peers = self + .fanout + .get(&topic_hash) + .filter(|peers| !peers.is_empty()); // If we have fanout peers add them to the map. - if self.fanout.contains_key(&topic_hash) { - for peer in self.fanout.get(&topic_hash).expect("Topic must exist") { + if let Some(peers) = fanout_peers { + for peer in peers { recipient_peers.insert(*peer); } } else { From f096394fe5af787565c35113d51b3aad20502590 Mon Sep 17 00:00:00 2001 From: Darius Clark Date: Tue, 7 Jan 2025 10:12:35 -0500 Subject: [PATCH 19/56] feat(request-response): allow custom sizes for `json` and `cbor` codec resolves #5791. Pull-Request: #5792. --- protocols/request-response/CHANGELOG.md | 3 ++ protocols/request-response/src/cbor.rs | 39 ++++++++++++++++++++----- protocols/request-response/src/json.rs | 39 ++++++++++++++++++++----- 3 files changed, 65 insertions(+), 16 deletions(-) diff --git a/protocols/request-response/CHANGELOG.md b/protocols/request-response/CHANGELOG.md index 15cb0c91797..34fc27b7432 100644 --- a/protocols/request-response/CHANGELOG.md +++ b/protocols/request-response/CHANGELOG.md @@ -3,6 +3,9 @@ - Add connection id to the events emitted by a request-response `Behaviour`. See [PR 5719](https://github.com/libp2p/rust-libp2p/pull/5719). +- Allow configurable request and response sizes for `json` and `cbor` codec. + See [PR 5792](https://github.com/libp2p/rust-libp2p/pull/5792). + ## 0.27.1 - Deprecate `void` crate. diff --git a/protocols/request-response/src/cbor.rs b/protocols/request-response/src/cbor.rs index 744d94cb961..eac1944bb09 100644 --- a/protocols/request-response/src/cbor.rs +++ b/protocols/request-response/src/cbor.rs @@ -55,18 +55,19 @@ mod codec { use libp2p_swarm::StreamProtocol; use serde::{de::DeserializeOwned, Serialize}; - /// Max request size in bytes - const REQUEST_SIZE_MAXIMUM: u64 = 1024 * 1024; - /// Max response size in bytes - const RESPONSE_SIZE_MAXIMUM: u64 = 10 * 1024 * 1024; - pub struct Codec { + /// Max request size in bytes. + request_size_maximum: u64, + /// Max response size in bytes. + response_size_maximum: u64, phantom: PhantomData<(Req, Resp)>, } impl Default for Codec { fn default() -> Self { Codec { + request_size_maximum: 1024 * 1024, + response_size_maximum: 10 * 1024 * 1024, phantom: PhantomData, } } @@ -74,7 +75,25 @@ mod codec { impl Clone for Codec { fn clone(&self) -> Self { - Self::default() + Self { + request_size_maximum: self.request_size_maximum, + response_size_maximum: self.response_size_maximum, + phantom: PhantomData, + } + } + } + + impl Codec { + /// Sets the limit for request size in bytes. + pub fn set_request_size_maximum(mut self, request_size_maximum: u64) -> Self { + self.request_size_maximum = request_size_maximum; + self + } + + /// Sets the limit for response size in bytes. + pub fn set_response_size_maximum(mut self, response_size_maximum: u64) -> Self { + self.response_size_maximum = response_size_maximum; + self } } @@ -94,7 +113,9 @@ mod codec { { let mut vec = Vec::new(); - io.take(REQUEST_SIZE_MAXIMUM).read_to_end(&mut vec).await?; + io.take(self.request_size_maximum) + .read_to_end(&mut vec) + .await?; cbor4ii::serde::from_slice(vec.as_slice()).map_err(decode_into_io_error) } @@ -105,7 +126,9 @@ mod codec { { let mut vec = Vec::new(); - io.take(RESPONSE_SIZE_MAXIMUM).read_to_end(&mut vec).await?; + io.take(self.response_size_maximum) + .read_to_end(&mut vec) + .await?; cbor4ii::serde::from_slice(vec.as_slice()).map_err(decode_into_io_error) } diff --git a/protocols/request-response/src/json.rs b/protocols/request-response/src/json.rs index 9bd5b8c6df9..f151b16bf5f 100644 --- a/protocols/request-response/src/json.rs +++ b/protocols/request-response/src/json.rs @@ -54,18 +54,19 @@ mod codec { use libp2p_swarm::StreamProtocol; use serde::{de::DeserializeOwned, Serialize}; - /// Max request size in bytes - const REQUEST_SIZE_MAXIMUM: u64 = 1024 * 1024; - /// Max response size in bytes - const RESPONSE_SIZE_MAXIMUM: u64 = 10 * 1024 * 1024; - pub struct Codec { + /// Max request size in bytes + request_size_maximum: u64, + /// Max response size in bytes + response_size_maximum: u64, phantom: PhantomData<(Req, Resp)>, } impl Default for Codec { fn default() -> Self { Codec { + request_size_maximum: 1024 * 1024, + response_size_maximum: 10 * 1024 * 1024, phantom: PhantomData, } } @@ -73,7 +74,25 @@ mod codec { impl Clone for Codec { fn clone(&self) -> Self { - Self::default() + Self { + request_size_maximum: self.request_size_maximum, + response_size_maximum: self.response_size_maximum, + phantom: self.phantom, + } + } + } + + impl Codec { + /// Sets the limit for request size in bytes. + pub fn set_request_size_maximum(mut self, request_size_maximum: u64) -> Self { + self.request_size_maximum = request_size_maximum; + self + } + + /// Sets the limit for response size in bytes. + pub fn set_response_size_maximum(mut self, response_size_maximum: u64) -> Self { + self.response_size_maximum = response_size_maximum; + self } } @@ -93,7 +112,9 @@ mod codec { { let mut vec = Vec::new(); - io.take(REQUEST_SIZE_MAXIMUM).read_to_end(&mut vec).await?; + io.take(self.request_size_maximum) + .read_to_end(&mut vec) + .await?; Ok(serde_json::from_slice(vec.as_slice())?) } @@ -104,7 +125,9 @@ mod codec { { let mut vec = Vec::new(); - io.take(RESPONSE_SIZE_MAXIMUM).read_to_end(&mut vec).await?; + io.take(self.response_size_maximum) + .read_to_end(&mut vec) + .await?; Ok(serde_json::from_slice(vec.as_slice())?) } From 4a1122e1236b63c9ac62947ab70e1968e5816353 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Wed, 8 Jan 2025 19:32:02 +0000 Subject: [PATCH 20/56] chore: update MSRV Pull-Request: #5650. --- Cargo.lock | 2 +- Cargo.toml | 4 ++-- examples/autonatv2/Dockerfile | 2 +- hole-punching-tests/Dockerfile | 2 +- interop-tests/Dockerfile.chromium | 2 +- interop-tests/Dockerfile.native | 4 ++-- libp2p/CHANGELOG.md | 5 ++++- libp2p/Cargo.toml | 2 +- misc/server/Dockerfile | 2 +- protocols/perf/Dockerfile | 2 +- 10 files changed, 15 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 091b1b8dede..252429064af 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2654,7 +2654,7 @@ checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" [[package]] name = "libp2p" -version = "0.54.2" +version = "0.55.0" dependencies = [ "async-std", "bytes", diff --git a/Cargo.toml b/Cargo.toml index b8186584487..bd793d4f2c1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -70,10 +70,10 @@ members = [ resolver = "2" [workspace.package] -rust-version = "1.75.0" +rust-version = "1.83.0" [workspace.dependencies] -libp2p = { version = "0.54.2", path = "libp2p" } +libp2p = { version = "0.55.0", path = "libp2p" } libp2p-allow-block-list = { version = "0.4.1", path = "misc/allow-block-list" } libp2p-autonat = { version = "0.13.1", path = "protocols/autonat" } libp2p-connection-limits = { version = "0.4.1", path = "misc/connection-limits" } diff --git a/examples/autonatv2/Dockerfile b/examples/autonatv2/Dockerfile index 6bc92e4d11b..083f9f5c113 100644 --- a/examples/autonatv2/Dockerfile +++ b/examples/autonatv2/Dockerfile @@ -1,4 +1,4 @@ -FROM rust:1.81-alpine as builder +FROM rust:1.83-alpine as builder RUN apk add musl-dev diff --git a/hole-punching-tests/Dockerfile b/hole-punching-tests/Dockerfile index 403cc301fc6..30c8e0a6414 100644 --- a/hole-punching-tests/Dockerfile +++ b/hole-punching-tests/Dockerfile @@ -1,5 +1,5 @@ # syntax=docker/dockerfile:1.5-labs -FROM rust:1.81.0 as builder +FROM rust:1.83.0 as builder # Run with access to the target cache to speed up builds WORKDIR /workspace diff --git a/interop-tests/Dockerfile.chromium b/interop-tests/Dockerfile.chromium index 86edbc5b9d2..4ccb142b4a3 100644 --- a/interop-tests/Dockerfile.chromium +++ b/interop-tests/Dockerfile.chromium @@ -1,5 +1,5 @@ # syntax=docker/dockerfile:1.5-labs -FROM rust:1.81 as chef +FROM rust:1.83 as chef RUN rustup target add wasm32-unknown-unknown RUN wget -q -O- https://github.com/rustwasm/wasm-pack/releases/download/v0.12.1/wasm-pack-v0.12.1-x86_64-unknown-linux-musl.tar.gz | tar -zx -C /usr/local/bin --strip-components 1 --wildcards "wasm-pack-*/wasm-pack" RUN wget -q -O- https://github.com/WebAssembly/binaryen/releases/download/version_115/binaryen-version_115-x86_64-linux.tar.gz | tar -zx -C /usr/local/bin --strip-components 2 --wildcards "binaryen-version_*/bin/wasm-opt" diff --git a/interop-tests/Dockerfile.native b/interop-tests/Dockerfile.native index 499c73437fc..f0b078d9492 100644 --- a/interop-tests/Dockerfile.native +++ b/interop-tests/Dockerfile.native @@ -1,5 +1,5 @@ # syntax=docker/dockerfile:1.5-labs -FROM lukemathwalker/cargo-chef:0.1.67-rust-bullseye as chef +FROM lukemathwalker/cargo-chef:0.1.68-rust-bullseye as chef WORKDIR /app FROM chef AS planner @@ -15,7 +15,7 @@ COPY . . RUN RUSTFLAGS='-C target-feature=+crt-static' cargo build --release --package interop-tests --target $(rustc -vV | grep host | awk '{print $2}') --bin native_ping RUN cp /app/target/$(rustc -vV | grep host | awk '{print $2}')/release/native_ping /usr/local/bin/testplan -FROM scratch +FROM debian:bullseye COPY --from=builder /usr/local/bin/testplan /usr/local/bin/testplan ENV RUST_BACKTRACE=1 ENTRYPOINT ["testplan"] diff --git a/libp2p/CHANGELOG.md b/libp2p/CHANGELOG.md index 8b7bf0ff55f..9e7194e2a69 100644 --- a/libp2p/CHANGELOG.md +++ b/libp2p/CHANGELOG.md @@ -1,4 +1,7 @@ -## 0.54.2 +## 0.55.0 + +- Raise MSRV to 1.83.0. + See [PR 5650](https://github.com/libp2p/rust-libp2p/pull/5650). - Add `with_connection_timeout` on `SwarmBuilder` to allow configuration of the connection_timeout parameter. See [PR 5575](https://github.com/libp2p/rust-libp2p/pull/5575). diff --git a/libp2p/Cargo.toml b/libp2p/Cargo.toml index ae23dcf0db5..39d01a5c5c7 100644 --- a/libp2p/Cargo.toml +++ b/libp2p/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p" edition = "2021" rust-version = { workspace = true } description = "Peer-to-peer networking library" -version = "0.54.2" +version = "0.55.0" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/misc/server/Dockerfile b/misc/server/Dockerfile index 12a8982eb3f..8b5aac2ae82 100644 --- a/misc/server/Dockerfile +++ b/misc/server/Dockerfile @@ -1,5 +1,5 @@ # syntax=docker/dockerfile:1.5-labs -FROM rust:1.81.0 as chef +FROM rust:1.83.0 as chef RUN wget -q -O- https://github.com/LukeMathWalker/cargo-chef/releases/download/v0.1.62/cargo-chef-x86_64-unknown-linux-gnu.tar.gz | tar -zx -C /usr/local/bin WORKDIR /app diff --git a/protocols/perf/Dockerfile b/protocols/perf/Dockerfile index f68ea6ef211..bb3124df02f 100644 --- a/protocols/perf/Dockerfile +++ b/protocols/perf/Dockerfile @@ -1,5 +1,5 @@ # syntax=docker/dockerfile:1.5-labs -FROM rust:1.81.0 as builder +FROM rust:1.83.0 as builder # Run with access to the target cache to speed up builds WORKDIR /workspace From 63c073174a3a477af179d2af5eb8474c43a7515e Mon Sep 17 00:00:00 2001 From: Elena Frank Date: Thu, 9 Jan 2025 16:52:03 +0700 Subject: [PATCH 21/56] chore: address clippy lints for Rust 1.85.0-beta Pull-Request: #5802. --- muxers/mplex/src/codec.rs | 12 ++++++------ protocols/kad/src/kbucket/bucket.rs | 4 ++-- protocols/kad/src/query/peers/closest/disjoint.rs | 1 - 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/muxers/mplex/src/codec.rs b/muxers/mplex/src/codec.rs index a4a04d1964d..20ee6bb4ed6 100644 --- a/muxers/mplex/src/codec.rs +++ b/muxers/mplex/src/codec.rs @@ -299,7 +299,7 @@ impl Encoder for Codec { role: Endpoint::Listener, }, data, - } => (num << 3 | 1, data), + } => ((num << 3) | 1, data), Frame::Data { stream_id: LocalStreamId { @@ -307,35 +307,35 @@ impl Encoder for Codec { role: Endpoint::Dialer, }, data, - } => (num << 3 | 2, data), + } => ((num << 3) | 2, data), Frame::Close { stream_id: LocalStreamId { num, role: Endpoint::Listener, }, - } => (num << 3 | 3, Bytes::new()), + } => ((num << 3) | 3, Bytes::new()), Frame::Close { stream_id: LocalStreamId { num, role: Endpoint::Dialer, }, - } => (num << 3 | 4, Bytes::new()), + } => ((num << 3) | 4, Bytes::new()), Frame::Reset { stream_id: LocalStreamId { num, role: Endpoint::Listener, }, - } => (num << 3 | 5, Bytes::new()), + } => ((num << 3) | 5, Bytes::new()), Frame::Reset { stream_id: LocalStreamId { num, role: Endpoint::Dialer, }, - } => (num << 3 | 6, Bytes::new()), + } => ((num << 3) | 6, Bytes::new()), }; let mut header_buf = encode::u64_buffer(); diff --git a/protocols/kad/src/kbucket/bucket.rs b/protocols/kad/src/kbucket/bucket.rs index 244525238ec..cbc6adf4d5c 100644 --- a/protocols/kad/src/kbucket/bucket.rs +++ b/protocols/kad/src/kbucket/bucket.rs @@ -225,8 +225,8 @@ where // The bucket is full with connected nodes. Drop the pending node. return None; } - debug_assert!(self.first_connected_pos.map_or(true, |p| p > 0)); // (*) - // The pending node will be inserted. + debug_assert!(self.first_connected_pos.is_none_or(|p| p > 0)); // (*) + // The pending node will be inserted. let inserted = pending.node.clone(); // A connected pending node goes at the end of the list for // the connected peers, removing the least-recently connected. diff --git a/protocols/kad/src/query/peers/closest/disjoint.rs b/protocols/kad/src/query/peers/closest/disjoint.rs index 70ded360c7e..a26a31b5215 100644 --- a/protocols/kad/src/query/peers/closest/disjoint.rs +++ b/protocols/kad/src/query/peers/closest/disjoint.rs @@ -552,7 +552,6 @@ mod tests { .flatten() .collect::>() .into_iter() - .map(Key::from) .collect::>(); deduplicated.sort_unstable_by(|a, b| { From 28387f29f9cc57b57653de90832ff5f7464c43a0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 9 Jan 2025 10:02:03 +0000 Subject: [PATCH 22/56] deps: bump Swatinem/rust-cache from 2.7.5 to 2.7.7 Pull-Request: #5775. --- .github/workflows/cache-factory.yml | 2 +- .github/workflows/ci.yml | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/cache-factory.yml b/.github/workflows/cache-factory.yml index 7623b56f450..939df1c4b8e 100644 --- a/.github/workflows/cache-factory.yml +++ b/.github/workflows/cache-factory.yml @@ -22,7 +22,7 @@ jobs: - uses: dtolnay/rust-toolchain@stable - - uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2.7.5 + - uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7 with: shared-key: stable-cache diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f8cff086990..a1ab56aec49 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,7 +40,7 @@ jobs: - uses: dtolnay/rust-toolchain@stable - - uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2.7.5 + - uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7 with: shared-key: stable-cache save-if: false @@ -149,7 +149,7 @@ jobs: - uses: r7kamura/rust-problem-matchers@9fe7ca9f6550e5d6358e179d451cc25ea6b54f98 #v1.5.0 - - uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2.7.5 + - uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7 with: key: ${{ matrix.target }} save-if: ${{ github.ref == 'refs/heads/master' }} @@ -174,7 +174,7 @@ jobs: - uses: r7kamura/rust-problem-matchers@9fe7ca9f6550e5d6358e179d451cc25ea6b54f98 #v1.5.0 - - uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2.7.5 + - uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7 with: save-if: ${{ github.ref == 'refs/heads/master' }} @@ -195,7 +195,7 @@ jobs: - uses: r7kamura/rust-problem-matchers@9fe7ca9f6550e5d6358e179d451cc25ea6b54f98 #v1.5.0 - - uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2.7.5 + - uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7 with: key: ${{ matrix.features }} save-if: ${{ github.ref == 'refs/heads/master' }} @@ -212,7 +212,7 @@ jobs: - uses: r7kamura/rust-problem-matchers@9fe7ca9f6550e5d6358e179d451cc25ea6b54f98 #v1.5.0 - - uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2.7.5 + - uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7 with: save-if: ${{ github.ref == 'refs/heads/master' }} @@ -238,7 +238,7 @@ jobs: - uses: r7kamura/rust-problem-matchers@9fe7ca9f6550e5d6358e179d451cc25ea6b54f98 #v1.5.0 - - uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2.7.5 + - uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7 with: save-if: ${{ github.ref == 'refs/heads/master' }} @@ -254,7 +254,7 @@ jobs: - uses: r7kamura/rust-problem-matchers@9fe7ca9f6550e5d6358e179d451cc25ea6b54f98 #v1.5.0 - - uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2.7.5 + - uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7 with: save-if: ${{ github.ref == 'refs/heads/master' }} @@ -273,7 +273,7 @@ jobs: - uses: r7kamura/rust-problem-matchers@9fe7ca9f6550e5d6358e179d451cc25ea6b54f98 #v1.5.0 - - uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2.7.5 + - uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7 with: shared-key: stable-cache save-if: false @@ -365,7 +365,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2.7.5 + - uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7 - run: cargo install --version 0.10.0 pb-rs --locked @@ -391,7 +391,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2.7.5 + - uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7 - run: cargo metadata --locked --format-version=1 > /dev/null cargo-deny: From 4b4f1973b1179543c124f940f81d6111b20cd4ca Mon Sep 17 00:00:00 2001 From: DrHuangMHT Date: Thu, 9 Jan 2025 20:24:55 +0800 Subject: [PATCH 23/56] refactor: mark {In, Out}boundOpenInfo as deprecated Mark `{In, Out}boundOpenInfo` as deprecated. May close #3268. Pull-Request: #5242. --- .../src/v2/client/handler/dial_back.rs | 13 ++---- .../src/v2/client/handler/dial_request.rs | 15 ++----- .../src/v2/server/handler/dial_back.rs | 13 ++---- .../src/v2/server/handler/dial_request.rs | 13 ++---- protocols/dcutr/src/handler/relayed.rs | 29 ++++--------- protocols/gossipsub/src/handler.rs | 16 ++----- protocols/identify/src/handler.rs | 21 +++------- protocols/kad/src/handler.rs | 19 ++------- protocols/perf/src/client/handler.rs | 15 ++----- protocols/perf/src/server/handler.rs | 13 ++---- protocols/ping/src/handler.rs | 11 ++--- protocols/relay/src/behaviour/handler.rs | 17 +++----- protocols/relay/src/priv_client/handler.rs | 15 ++----- protocols/request-response/src/handler.rs | 23 +++------- protocols/stream/src/handler.rs | 19 ++------- swarm/benches/connection_handler.rs | 12 +----- swarm/src/behaviour/toggle.rs | 4 +- swarm/src/connection.rs | 42 +++++-------------- swarm/src/connection/pool.rs | 1 + swarm/src/dummy.rs | 15 ++----- swarm/src/handler.rs | 11 +++-- swarm/src/handler/either.rs | 1 + swarm/src/handler/map_in.rs | 1 + swarm/src/handler/map_out.rs | 1 + swarm/src/handler/multi.rs | 2 + swarm/src/handler/one_shot.rs | 13 ++---- swarm/src/handler/pending.rs | 13 ++---- swarm/src/handler/select.rs | 2 + swarm/tests/connection_close.rs | 13 ++---- 29 files changed, 105 insertions(+), 278 deletions(-) diff --git a/protocols/autonat/src/v2/client/handler/dial_back.rs b/protocols/autonat/src/v2/client/handler/dial_back.rs index ef544a4c77a..7cdf194343a 100644 --- a/protocols/autonat/src/v2/client/handler/dial_back.rs +++ b/protocols/autonat/src/v2/client/handler/dial_back.rs @@ -35,16 +35,14 @@ impl ConnectionHandler for Handler { type InboundOpenInfo = (); type OutboundOpenInfo = (); - fn listen_protocol(&self) -> SubstreamProtocol { + fn listen_protocol(&self) -> SubstreamProtocol { SubstreamProtocol::new(ReadyUpgrade::new(DIAL_BACK_PROTOCOL), ()) } fn poll( &mut self, cx: &mut Context<'_>, - ) -> Poll< - ConnectionHandlerEvent, - > { + ) -> Poll> { loop { match self.inbound.poll_next_unpin(cx) { Poll::Pending => return Poll::Pending, @@ -68,12 +66,7 @@ impl ConnectionHandler for Handler { fn on_connection_event( &mut self, - event: ConnectionEvent< - Self::InboundProtocol, - Self::OutboundProtocol, - Self::InboundOpenInfo, - Self::OutboundOpenInfo, - >, + event: ConnectionEvent, ) { match event { ConnectionEvent::FullyNegotiatedInbound(FullyNegotiatedInbound { diff --git a/protocols/autonat/src/v2/client/handler/dial_request.rs b/protocols/autonat/src/v2/client/handler/dial_request.rs index fff83ad9453..61f564505eb 100644 --- a/protocols/autonat/src/v2/client/handler/dial_request.rs +++ b/protocols/autonat/src/v2/client/handler/dial_request.rs @@ -72,7 +72,7 @@ pub struct Handler { queued_events: VecDeque< ConnectionHandlerEvent< ::OutboundProtocol, - ::OutboundOpenInfo, + (), ::ToBehaviour, >, >, @@ -121,16 +121,14 @@ impl ConnectionHandler for Handler { type InboundOpenInfo = (); type OutboundOpenInfo = (); - fn listen_protocol(&self) -> SubstreamProtocol { + fn listen_protocol(&self) -> SubstreamProtocol { SubstreamProtocol::new(DeniedUpgrade, ()) } fn poll( &mut self, cx: &mut Context<'_>, - ) -> Poll< - ConnectionHandlerEvent, - > { + ) -> Poll> { if let Some(event) = self.queued_events.pop_front() { return Poll::Ready(event); } @@ -161,12 +159,7 @@ impl ConnectionHandler for Handler { fn on_connection_event( &mut self, - event: ConnectionEvent< - Self::InboundProtocol, - Self::OutboundProtocol, - Self::InboundOpenInfo, - Self::OutboundOpenInfo, - >, + event: ConnectionEvent, ) { match event { ConnectionEvent::DialUpgradeError(DialUpgradeError { error, .. }) => { diff --git a/protocols/autonat/src/v2/server/handler/dial_back.rs b/protocols/autonat/src/v2/server/handler/dial_back.rs index 61593da318d..8adb33509ef 100644 --- a/protocols/autonat/src/v2/server/handler/dial_back.rs +++ b/protocols/autonat/src/v2/server/handler/dial_back.rs @@ -46,16 +46,14 @@ impl ConnectionHandler for Handler { type InboundOpenInfo = (); type OutboundOpenInfo = (); - fn listen_protocol(&self) -> SubstreamProtocol { + fn listen_protocol(&self) -> SubstreamProtocol { SubstreamProtocol::new(DeniedUpgrade, ()) } fn poll( &mut self, cx: &mut Context<'_>, - ) -> Poll< - ConnectionHandlerEvent, - > { + ) -> Poll> { if let Poll::Ready(result) = self.outbound.poll_unpin(cx) { return Poll::Ready(ConnectionHandlerEvent::NotifyBehaviour( result @@ -76,12 +74,7 @@ impl ConnectionHandler for Handler { fn on_connection_event( &mut self, - event: ConnectionEvent< - Self::InboundProtocol, - Self::OutboundProtocol, - Self::InboundOpenInfo, - Self::OutboundOpenInfo, - >, + event: ConnectionEvent, ) { match event { ConnectionEvent::FullyNegotiatedOutbound(FullyNegotiatedOutbound { diff --git a/protocols/autonat/src/v2/server/handler/dial_request.rs b/protocols/autonat/src/v2/server/handler/dial_request.rs index 5058e0f3f42..22cab2b9cab 100644 --- a/protocols/autonat/src/v2/server/handler/dial_request.rs +++ b/protocols/autonat/src/v2/server/handler/dial_request.rs @@ -81,16 +81,14 @@ where type InboundOpenInfo = (); type OutboundOpenInfo = (); - fn listen_protocol(&self) -> SubstreamProtocol { + fn listen_protocol(&self) -> SubstreamProtocol { SubstreamProtocol::new(ReadyUpgrade::new(DIAL_REQUEST_PROTOCOL), ()) } fn poll( &mut self, cx: &mut Context<'_>, - ) -> Poll< - ConnectionHandlerEvent, - > { + ) -> Poll> { loop { match self.inbound.poll_unpin(cx) { Poll::Ready(Ok(event)) => { @@ -117,12 +115,7 @@ where fn on_connection_event( &mut self, - event: ConnectionEvent< - Self::InboundProtocol, - Self::OutboundProtocol, - Self::InboundOpenInfo, - Self::OutboundOpenInfo, - >, + event: ConnectionEvent, ) { match event { ConnectionEvent::FullyNegotiatedInbound(FullyNegotiatedInbound { diff --git a/protocols/dcutr/src/handler/relayed.rs b/protocols/dcutr/src/handler/relayed.rs index 0d6e1b5e889..47813493e9e 100644 --- a/protocols/dcutr/src/handler/relayed.rs +++ b/protocols/dcutr/src/handler/relayed.rs @@ -65,7 +65,7 @@ pub struct Handler { queued_events: VecDeque< ConnectionHandlerEvent< ::OutboundProtocol, - ::OutboundOpenInfo, + (), ::ToBehaviour, >, >, @@ -98,10 +98,7 @@ impl Handler { &mut self, FullyNegotiatedInbound { protocol: output, .. - }: FullyNegotiatedInbound< - ::InboundProtocol, - ::InboundOpenInfo, - >, + }: FullyNegotiatedInbound<::InboundProtocol>, ) { match output { future::Either::Left(stream) => { @@ -130,10 +127,7 @@ impl Handler { &mut self, FullyNegotiatedOutbound { protocol: stream, .. - }: FullyNegotiatedOutbound< - ::OutboundProtocol, - ::OutboundOpenInfo, - >, + }: FullyNegotiatedOutbound<::OutboundProtocol>, ) { assert!( self.endpoint.is_listener(), @@ -156,7 +150,7 @@ impl Handler { fn on_listen_upgrade_error( &mut self, ListenUpgradeError { error, .. }: ListenUpgradeError< - ::InboundOpenInfo, + (), ::InboundProtocol, >, ) { @@ -168,7 +162,7 @@ impl Handler { fn on_dial_upgrade_error( &mut self, DialUpgradeError { error, .. }: DialUpgradeError< - ::OutboundOpenInfo, + (), ::OutboundProtocol, >, ) { @@ -196,7 +190,7 @@ impl ConnectionHandler for Handler { type OutboundOpenInfo = (); type InboundOpenInfo = (); - fn listen_protocol(&self) -> SubstreamProtocol { + fn listen_protocol(&self) -> SubstreamProtocol { match self.endpoint { ConnectedPoint::Dialer { .. } => { SubstreamProtocol::new(Either::Left(ReadyUpgrade::new(PROTOCOL_NAME)), ()) @@ -236,9 +230,7 @@ impl ConnectionHandler for Handler { fn poll( &mut self, cx: &mut Context<'_>, - ) -> Poll< - ConnectionHandlerEvent, - > { + ) -> Poll> { // Return queued events. if let Some(event) = self.queued_events.pop_front() { return Poll::Ready(event); @@ -295,12 +287,7 @@ impl ConnectionHandler for Handler { fn on_connection_event( &mut self, - event: ConnectionEvent< - Self::InboundProtocol, - Self::OutboundProtocol, - Self::InboundOpenInfo, - Self::OutboundOpenInfo, - >, + event: ConnectionEvent, ) { match event { ConnectionEvent::FullyNegotiatedInbound(fully_negotiated_inbound) => { diff --git a/protocols/gossipsub/src/handler.rs b/protocols/gossipsub/src/handler.rs index e66b606896b..f93e993a854 100644 --- a/protocols/gossipsub/src/handler.rs +++ b/protocols/gossipsub/src/handler.rs @@ -198,7 +198,6 @@ impl EnabledHandler { &mut self, FullyNegotiatedOutbound { protocol, .. }: FullyNegotiatedOutbound< ::OutboundProtocol, - ::OutboundOpenInfo, >, ) { let (substream, peer_kind) = protocol; @@ -221,7 +220,7 @@ impl EnabledHandler { ) -> Poll< ConnectionHandlerEvent< ::OutboundProtocol, - ::OutboundOpenInfo, + (), ::ToBehaviour, >, > { @@ -427,7 +426,7 @@ impl ConnectionHandler for Handler { type OutboundOpenInfo = (); type OutboundProtocol = ProtocolConfig; - fn listen_protocol(&self) -> SubstreamProtocol { + fn listen_protocol(&self) -> SubstreamProtocol { match self { Handler::Enabled(handler) => { SubstreamProtocol::new(either::Either::Left(handler.listen_protocol.clone()), ()) @@ -462,9 +461,7 @@ impl ConnectionHandler for Handler { fn poll( &mut self, cx: &mut Context<'_>, - ) -> Poll< - ConnectionHandlerEvent, - > { + ) -> Poll> { match self { Handler::Enabled(handler) => handler.poll(cx), Handler::Disabled(DisabledHandler::ProtocolUnsupported { peer_kind_sent }) => { @@ -483,12 +480,7 @@ impl ConnectionHandler for Handler { fn on_connection_event( &mut self, - event: ConnectionEvent< - Self::InboundProtocol, - Self::OutboundProtocol, - Self::InboundOpenInfo, - Self::OutboundOpenInfo, - >, + event: ConnectionEvent, ) { match self { Handler::Enabled(handler) => { diff --git a/protocols/identify/src/handler.rs b/protocols/identify/src/handler.rs index 6e5af290cd2..7acdfceb0a6 100644 --- a/protocols/identify/src/handler.rs +++ b/protocols/identify/src/handler.rs @@ -159,10 +159,7 @@ impl Handler { &mut self, FullyNegotiatedInbound { protocol: output, .. - }: FullyNegotiatedInbound< - ::InboundProtocol, - ::InboundOpenInfo, - >, + }: FullyNegotiatedInbound<::InboundProtocol>, ) { match output { future::Either::Left(stream) => { @@ -198,10 +195,7 @@ impl Handler { &mut self, FullyNegotiatedOutbound { protocol: output, .. - }: FullyNegotiatedOutbound< - ::OutboundProtocol, - ::OutboundOpenInfo, - >, + }: FullyNegotiatedOutbound<::OutboundProtocol>, ) { match output { future::Either::Left(stream) => { @@ -303,7 +297,7 @@ impl ConnectionHandler for Handler { type OutboundOpenInfo = (); type InboundOpenInfo = (); - fn listen_protocol(&self) -> SubstreamProtocol { + fn listen_protocol(&self) -> SubstreamProtocol { SubstreamProtocol::new( SelectUpgrade::new( ReadyUpgrade::new(PROTOCOL_NAME), @@ -334,7 +328,7 @@ impl ConnectionHandler for Handler { fn poll( &mut self, cx: &mut Context<'_>, - ) -> Poll> { + ) -> Poll> { if let Some(event) = self.events.pop() { return Poll::Ready(event); } @@ -413,12 +407,7 @@ impl ConnectionHandler for Handler { fn on_connection_event( &mut self, - event: ConnectionEvent< - Self::InboundProtocol, - Self::OutboundProtocol, - Self::InboundOpenInfo, - Self::OutboundOpenInfo, - >, + event: ConnectionEvent, ) { match event { ConnectionEvent::FullyNegotiatedInbound(fully_negotiated_inbound) => { diff --git a/protocols/kad/src/handler.rs b/protocols/kad/src/handler.rs index 6837e3d499e..b848cf94410 100644 --- a/protocols/kad/src/handler.rs +++ b/protocols/kad/src/handler.rs @@ -476,10 +476,7 @@ impl Handler { FullyNegotiatedOutbound { protocol: stream, info: (), - }: FullyNegotiatedOutbound< - ::OutboundProtocol, - ::OutboundOpenInfo, - >, + }: FullyNegotiatedOutbound<::OutboundProtocol>, ) { if let Some(sender) = self.pending_streams.pop_front() { let _ = sender.send(Ok(stream)); @@ -500,7 +497,6 @@ impl Handler { &mut self, FullyNegotiatedInbound { protocol, .. }: FullyNegotiatedInbound< ::InboundProtocol, - ::InboundOpenInfo, >, ) { // If `self.allow_listening` is false, then we produced a `DeniedUpgrade` and `protocol` @@ -608,7 +604,7 @@ impl ConnectionHandler for Handler { type OutboundOpenInfo = (); type InboundOpenInfo = (); - fn listen_protocol(&self) -> SubstreamProtocol { + fn listen_protocol(&self) -> SubstreamProtocol { match self.mode { Mode::Server => SubstreamProtocol::new(Either::Left(self.protocol_config.clone()), ()), Mode::Client => SubstreamProtocol::new(Either::Right(upgrade::DeniedUpgrade), ()), @@ -719,9 +715,7 @@ impl ConnectionHandler for Handler { fn poll( &mut self, cx: &mut Context<'_>, - ) -> Poll< - ConnectionHandlerEvent, - > { + ) -> Poll> { loop { match &mut self.protocol_status { Some(status) if !status.reported => { @@ -788,12 +782,7 @@ impl ConnectionHandler for Handler { fn on_connection_event( &mut self, - event: ConnectionEvent< - Self::InboundProtocol, - Self::OutboundProtocol, - Self::InboundOpenInfo, - Self::OutboundOpenInfo, - >, + event: ConnectionEvent, ) { match event { ConnectionEvent::FullyNegotiatedOutbound(fully_negotiated_outbound) => { diff --git a/protocols/perf/src/client/handler.rs b/protocols/perf/src/client/handler.rs index fc427d8134c..043790822b5 100644 --- a/protocols/perf/src/client/handler.rs +++ b/protocols/perf/src/client/handler.rs @@ -58,7 +58,7 @@ pub struct Handler { queued_events: VecDeque< ConnectionHandlerEvent< ::OutboundProtocol, - ::OutboundOpenInfo, + (), ::ToBehaviour, >, >, @@ -92,7 +92,7 @@ impl ConnectionHandler for Handler { type OutboundOpenInfo = (); type InboundOpenInfo = (); - fn listen_protocol(&self) -> SubstreamProtocol { + fn listen_protocol(&self) -> SubstreamProtocol { SubstreamProtocol::new(DeniedUpgrade, ()) } @@ -106,12 +106,7 @@ impl ConnectionHandler for Handler { fn on_connection_event( &mut self, - event: ConnectionEvent< - Self::InboundProtocol, - Self::OutboundProtocol, - Self::InboundOpenInfo, - Self::OutboundOpenInfo, - >, + event: ConnectionEvent, ) { match event { // TODO: remove when Rust 1.82 is MSRV @@ -161,9 +156,7 @@ impl ConnectionHandler for Handler { fn poll( &mut self, cx: &mut Context<'_>, - ) -> Poll< - ConnectionHandlerEvent, - > { + ) -> Poll> { if let Some(event) = self.queued_events.pop_front() { return Poll::Ready(event); } diff --git a/protocols/perf/src/server/handler.rs b/protocols/perf/src/server/handler.rs index a78485cd9b5..6ecb19dbc18 100644 --- a/protocols/perf/src/server/handler.rs +++ b/protocols/perf/src/server/handler.rs @@ -70,7 +70,7 @@ impl ConnectionHandler for Handler { type OutboundOpenInfo = Infallible; type InboundOpenInfo = (); - fn listen_protocol(&self) -> SubstreamProtocol { + fn listen_protocol(&self) -> SubstreamProtocol { SubstreamProtocol::new(ReadyUpgrade::new(crate::PROTOCOL_NAME), ()) } @@ -82,12 +82,7 @@ impl ConnectionHandler for Handler { fn on_connection_event( &mut self, - event: ConnectionEvent< - Self::InboundProtocol, - Self::OutboundProtocol, - Self::InboundOpenInfo, - Self::OutboundOpenInfo, - >, + event: ConnectionEvent, ) { match event { ConnectionEvent::FullyNegotiatedInbound(FullyNegotiatedInbound { @@ -129,9 +124,7 @@ impl ConnectionHandler for Handler { fn poll( &mut self, cx: &mut Context<'_>, - ) -> Poll< - ConnectionHandlerEvent, - > { + ) -> Poll> { loop { match self.inbound.poll_unpin(cx) { Poll::Ready(Ok(Ok(stats))) => { diff --git a/protocols/ping/src/handler.rs b/protocols/ping/src/handler.rs index c7d65c64500..510ff0553de 100644 --- a/protocols/ping/src/handler.rs +++ b/protocols/ping/src/handler.rs @@ -179,7 +179,7 @@ impl Handler { fn on_dial_upgrade_error( &mut self, DialUpgradeError { error, .. }: DialUpgradeError< - ::OutboundOpenInfo, + (), ::OutboundProtocol, >, ) { @@ -229,7 +229,7 @@ impl ConnectionHandler for Handler { type OutboundOpenInfo = (); type InboundOpenInfo = (); - fn listen_protocol(&self) -> SubstreamProtocol, ()> { + fn listen_protocol(&self) -> SubstreamProtocol> { SubstreamProtocol::new(ReadyUpgrade::new(PROTOCOL_NAME), ()) } @@ -340,12 +340,7 @@ impl ConnectionHandler for Handler { fn on_connection_event( &mut self, - event: ConnectionEvent< - Self::InboundProtocol, - Self::OutboundProtocol, - Self::InboundOpenInfo, - Self::OutboundOpenInfo, - >, + event: ConnectionEvent, ) { match event { ConnectionEvent::FullyNegotiatedInbound(FullyNegotiatedInbound { diff --git a/protocols/relay/src/behaviour/handler.rs b/protocols/relay/src/behaviour/handler.rs index 0a4fe11c00a..d714bf04fc9 100644 --- a/protocols/relay/src/behaviour/handler.rs +++ b/protocols/relay/src/behaviour/handler.rs @@ -343,7 +343,7 @@ pub struct Handler { queued_events: VecDeque< ConnectionHandlerEvent< ::OutboundProtocol, - ::OutboundOpenInfo, + (), ::ToBehaviour, >, >, @@ -447,7 +447,7 @@ impl Handler { fn on_dial_upgrade_error( &mut self, DialUpgradeError { error, .. }: DialUpgradeError< - ::OutboundOpenInfo, + (), ::OutboundProtocol, >, ) { @@ -494,7 +494,7 @@ impl ConnectionHandler for Handler { type OutboundProtocol = ReadyUpgrade; type OutboundOpenInfo = (); - fn listen_protocol(&self) -> SubstreamProtocol { + fn listen_protocol(&self) -> SubstreamProtocol { SubstreamProtocol::new(ReadyUpgrade::new(HOP_PROTOCOL_NAME), ()) } @@ -598,9 +598,7 @@ impl ConnectionHandler for Handler { fn poll( &mut self, cx: &mut Context<'_>, - ) -> Poll< - ConnectionHandlerEvent, - > { + ) -> Poll> { // Return queued events. if let Some(event) = self.queued_events.pop_front() { return Poll::Ready(event); @@ -876,12 +874,7 @@ impl ConnectionHandler for Handler { fn on_connection_event( &mut self, - event: ConnectionEvent< - Self::InboundProtocol, - Self::OutboundProtocol, - Self::InboundOpenInfo, - Self::OutboundOpenInfo, - >, + event: ConnectionEvent, ) { match event { ConnectionEvent::FullyNegotiatedInbound(FullyNegotiatedInbound { diff --git a/protocols/relay/src/priv_client/handler.rs b/protocols/relay/src/priv_client/handler.rs index 8f60b689ec8..d2e4db56b4c 100644 --- a/protocols/relay/src/priv_client/handler.rs +++ b/protocols/relay/src/priv_client/handler.rs @@ -107,7 +107,7 @@ pub struct Handler { queued_events: VecDeque< ConnectionHandlerEvent< ::OutboundProtocol, - ::OutboundOpenInfo, + (), ::ToBehaviour, >, >, @@ -241,7 +241,7 @@ impl ConnectionHandler for Handler { type OutboundProtocol = ReadyUpgrade; type OutboundOpenInfo = (); - fn listen_protocol(&self) -> SubstreamProtocol { + fn listen_protocol(&self) -> SubstreamProtocol { SubstreamProtocol::new(ReadyUpgrade::new(STOP_PROTOCOL_NAME), ()) } @@ -267,9 +267,7 @@ impl ConnectionHandler for Handler { fn poll( &mut self, cx: &mut Context<'_>, - ) -> Poll< - ConnectionHandlerEvent, - > { + ) -> Poll> { loop { // Reservations match self.inflight_reserve_requests.poll_unpin(cx) { @@ -426,12 +424,7 @@ impl ConnectionHandler for Handler { fn on_connection_event( &mut self, - event: ConnectionEvent< - Self::InboundProtocol, - Self::OutboundProtocol, - Self::InboundOpenInfo, - Self::OutboundOpenInfo, - >, + event: ConnectionEvent, ) { match event { ConnectionEvent::FullyNegotiatedInbound(FullyNegotiatedInbound { diff --git a/protocols/request-response/src/handler.rs b/protocols/request-response/src/handler.rs index 133cff87f40..d70ddc5c0ae 100644 --- a/protocols/request-response/src/handler.rs +++ b/protocols/request-response/src/handler.rs @@ -127,10 +127,7 @@ where FullyNegotiatedInbound { protocol: (mut stream, protocol), info: (), - }: FullyNegotiatedInbound< - ::InboundProtocol, - ::InboundOpenInfo, - >, + }: FullyNegotiatedInbound<::InboundProtocol>, ) { let mut codec = self.codec.clone(); let request_id = self.next_inbound_request_id(); @@ -178,10 +175,7 @@ where FullyNegotiatedOutbound { protocol: (mut stream, protocol), info: (), - }: FullyNegotiatedOutbound< - ::OutboundProtocol, - ::OutboundOpenInfo, - >, + }: FullyNegotiatedOutbound<::OutboundProtocol>, ) { let message = self .requested_outbound @@ -219,7 +213,7 @@ where fn on_dial_upgrade_error( &mut self, DialUpgradeError { error, info: () }: DialUpgradeError< - ::OutboundOpenInfo, + (), ::OutboundProtocol, >, ) { @@ -256,7 +250,7 @@ where fn on_listen_upgrade_error( &mut self, ListenUpgradeError { error, .. }: ListenUpgradeError< - ::InboundOpenInfo, + (), ::InboundProtocol, >, ) { @@ -383,7 +377,7 @@ where type OutboundOpenInfo = (); type InboundOpenInfo = (); - fn listen_protocol(&self) -> SubstreamProtocol { + fn listen_protocol(&self) -> SubstreamProtocol { SubstreamProtocol::new( Protocol { protocols: self.inbound_protocols.clone(), @@ -473,12 +467,7 @@ where fn on_connection_event( &mut self, - event: ConnectionEvent< - Self::InboundProtocol, - Self::OutboundProtocol, - Self::InboundOpenInfo, - Self::OutboundOpenInfo, - >, + event: ConnectionEvent, ) { match event { ConnectionEvent::FullyNegotiatedInbound(fully_negotiated_inbound) => { diff --git a/protocols/stream/src/handler.rs b/protocols/stream/src/handler.rs index d626f48fb09..5fc903f5980 100644 --- a/protocols/stream/src/handler.rs +++ b/protocols/stream/src/handler.rs @@ -52,9 +52,7 @@ impl ConnectionHandler for Handler { type InboundOpenInfo = (); type OutboundOpenInfo = (); - fn listen_protocol( - &self, - ) -> swarm::SubstreamProtocol { + fn listen_protocol(&self) -> swarm::SubstreamProtocol { swarm::SubstreamProtocol::new( Upgrade { supported_protocols: Shared::lock(&self.shared).supported_inbound_protocols(), @@ -66,13 +64,7 @@ impl ConnectionHandler for Handler { fn poll( &mut self, cx: &mut Context<'_>, - ) -> Poll< - swarm::ConnectionHandlerEvent< - Self::OutboundProtocol, - Self::OutboundOpenInfo, - Self::ToBehaviour, - >, - > { + ) -> Poll> { if self.pending_upgrade.is_some() { return Poll::Pending; } @@ -104,12 +96,7 @@ impl ConnectionHandler for Handler { fn on_connection_event( &mut self, - event: ConnectionEvent< - Self::InboundProtocol, - Self::OutboundProtocol, - Self::InboundOpenInfo, - Self::OutboundOpenInfo, - >, + event: ConnectionEvent, ) { match event { ConnectionEvent::FullyNegotiatedInbound(FullyNegotiatedInbound { diff --git a/swarm/benches/connection_handler.rs b/swarm/benches/connection_handler.rs index a5e47528308..3ae75288208 100644 --- a/swarm/benches/connection_handler.rs +++ b/swarm/benches/connection_handler.rs @@ -281,9 +281,7 @@ impl ConnectionHandler for SpinningHandler { type OutboundOpenInfo = (); - fn listen_protocol( - &self, - ) -> libp2p_swarm::SubstreamProtocol { + fn listen_protocol(&self) -> libp2p_swarm::SubstreamProtocol { libp2p_swarm::SubstreamProtocol::new(Upgrade(self.protocols), ()) } @@ -291,11 +289,7 @@ impl ConnectionHandler for SpinningHandler { &mut self, cx: &mut std::task::Context<'_>, ) -> std::task::Poll< - libp2p_swarm::ConnectionHandlerEvent< - Self::OutboundProtocol, - Self::OutboundOpenInfo, - Self::ToBehaviour, - >, + libp2p_swarm::ConnectionHandlerEvent, > { if self.iter_count == usize::MAX { return std::task::Poll::Pending; @@ -322,8 +316,6 @@ impl ConnectionHandler for SpinningHandler { _event: libp2p_swarm::handler::ConnectionEvent< Self::InboundProtocol, Self::OutboundProtocol, - Self::InboundOpenInfo, - Self::OutboundOpenInfo, >, ) { } diff --git a/swarm/src/behaviour/toggle.rs b/swarm/src/behaviour/toggle.rs index e70e6cf9896..a706187a40c 100644 --- a/swarm/src/behaviour/toggle.rs +++ b/swarm/src/behaviour/toggle.rs @@ -200,6 +200,7 @@ impl ToggleConnectionHandler where TInner: ConnectionHandler, { + #[expect(deprecated)] // TODO: Remove when {In, Out}boundOpenInfo is fully removed. fn on_fully_negotiated_inbound( &mut self, FullyNegotiatedInbound { @@ -231,7 +232,7 @@ where panic!("Unexpected Either::Right in enabled `on_fully_negotiated_inbound`.") } } - + #[expect(deprecated)] // TODO: Remove when {In, Out}boundOpenInfo is fully removed. fn on_listen_upgrade_error( &mut self, ListenUpgradeError { info, error: err }: ListenUpgradeError< @@ -267,6 +268,7 @@ where } } +#[expect(deprecated)] // TODO: Remove when {In, Out}boundOpenInfo is fully removed. impl ConnectionHandler for ToggleConnectionHandler where TInner: ConnectionHandler, diff --git a/swarm/src/connection.rs b/swarm/src/connection.rs index a1c7b2a2f20..8e913aa80e5 100644 --- a/swarm/src/connection.rs +++ b/swarm/src/connection.rs @@ -123,6 +123,7 @@ where /// The underlying handler. handler: THandler, /// Futures that upgrade incoming substreams. + #[expect(deprecated)] // TODO: Remove when {In, Out}boundOpenInfo is fully removed. negotiating_in: FuturesUnordered< StreamUpgrade< THandler::InboundOpenInfo, @@ -131,6 +132,7 @@ where >, >, /// Futures that upgrade outgoing substreams. + #[expect(deprecated)] // TODO: Remove when {In, Out}boundOpenInfo is fully removed. negotiating_out: FuturesUnordered< StreamUpgrade< THandler::OutboundOpenInfo, @@ -155,6 +157,7 @@ where /// /// The upgrade timeout is already ticking here so this may fail in case the remote is not /// quick enough in providing us with a new stream. + #[expect(deprecated)] // TODO: Remove when {In, Out}boundOpenInfo is fully removed. requested_substreams: FuturesUnordered< SubstreamRequested, >, @@ -168,6 +171,7 @@ where stream_counter: ActiveStreamCounter, } +#[expect(deprecated)] // TODO: Remove when {In, Out}boundOpenInfo is fully removed. impl fmt::Debug for Connection where THandler: ConnectionHandler + fmt::Debug, @@ -1189,20 +1193,13 @@ mod tests { type InboundOpenInfo = (); type OutboundOpenInfo = (); - fn listen_protocol( - &self, - ) -> SubstreamProtocol { + fn listen_protocol(&self) -> SubstreamProtocol { SubstreamProtocol::new(DeniedUpgrade, ()).with_timeout(self.upgrade_timeout) } fn on_connection_event( &mut self, - event: ConnectionEvent< - Self::InboundProtocol, - Self::OutboundProtocol, - Self::InboundOpenInfo, - Self::OutboundOpenInfo, - >, + event: ConnectionEvent, ) { match event { // TODO: remove when Rust 1.82 is MSRV @@ -1242,13 +1239,7 @@ mod tests { fn poll( &mut self, _: &mut Context<'_>, - ) -> Poll< - ConnectionHandlerEvent< - Self::OutboundProtocol, - Self::OutboundOpenInfo, - Self::ToBehaviour, - >, - > { + ) -> Poll> { if self.outbound_requested { self.outbound_requested = false; return Poll::Ready(ConnectionHandlerEvent::OutboundSubstreamRequest { @@ -1269,9 +1260,7 @@ mod tests { type InboundOpenInfo = (); type OutboundOpenInfo = (); - fn listen_protocol( - &self, - ) -> SubstreamProtocol { + fn listen_protocol(&self) -> SubstreamProtocol { SubstreamProtocol::new( ManyProtocolsUpgrade { protocols: Vec::from_iter(self.active_protocols.clone()), @@ -1282,12 +1271,7 @@ mod tests { fn on_connection_event( &mut self, - event: ConnectionEvent< - Self::InboundProtocol, - Self::OutboundProtocol, - Self::InboundOpenInfo, - Self::OutboundOpenInfo, - >, + event: ConnectionEvent, ) { match event { ConnectionEvent::LocalProtocolsChange(ProtocolsChange::Added(added)) => { @@ -1319,13 +1303,7 @@ mod tests { fn poll( &mut self, _: &mut Context<'_>, - ) -> Poll< - ConnectionHandlerEvent< - Self::OutboundProtocol, - Self::OutboundOpenInfo, - Self::ToBehaviour, - >, - > { + ) -> Poll> { if let Some(event) = self.events.pop() { return Poll::Ready(event); } diff --git a/swarm/src/connection/pool.rs b/swarm/src/connection/pool.rs index 49cc774b2b7..f21a7307105 100644 --- a/swarm/src/connection/pool.rs +++ b/swarm/src/connection/pool.rs @@ -553,6 +553,7 @@ where /// Polls the connection pool for events. #[tracing::instrument(level = "debug", name = "Pool::poll", skip(self, cx))] + #[expect(deprecated)] // TODO: Remove when {In, Out}boundOpenInfo is fully removed. pub(crate) fn poll(&mut self, cx: &mut Context<'_>) -> Poll> where THandler: ConnectionHandler + 'static, diff --git a/swarm/src/dummy.rs b/swarm/src/dummy.rs index 5452c382cd4..f8137bdbeee 100644 --- a/swarm/src/dummy.rs +++ b/swarm/src/dummy.rs @@ -71,9 +71,9 @@ impl crate::handler::ConnectionHandler for ConnectionHandler { type InboundProtocol = DeniedUpgrade; type OutboundProtocol = DeniedUpgrade; type InboundOpenInfo = (); - type OutboundOpenInfo = Infallible; + type OutboundOpenInfo = (); - fn listen_protocol(&self) -> SubstreamProtocol { + fn listen_protocol(&self) -> SubstreamProtocol { SubstreamProtocol::new(DeniedUpgrade, ()) } @@ -86,20 +86,13 @@ impl crate::handler::ConnectionHandler for ConnectionHandler { fn poll( &mut self, _: &mut Context<'_>, - ) -> Poll< - ConnectionHandlerEvent, - > { + ) -> Poll> { Poll::Pending } fn on_connection_event( &mut self, - event: ConnectionEvent< - Self::InboundProtocol, - Self::OutboundProtocol, - Self::InboundOpenInfo, - Self::OutboundOpenInfo, - >, + event: ConnectionEvent, ) { match event { // TODO: remove when Rust 1.82 is MSRV diff --git a/swarm/src/handler.rs b/swarm/src/handler.rs index 3d0407b4f70..d9293fa41de 100644 --- a/swarm/src/handler.rs +++ b/swarm/src/handler.rs @@ -98,6 +98,7 @@ use crate::{connection::AsStrHashEq, StreamProtocol}; /// Implementors of this trait should keep in mind that the connection can be closed at any time. /// When a connection is closed gracefully, the substreams used by the handler may still /// continue reading data until the remote closes its side of the connection. +#[expect(deprecated)] // TODO: Remove when {In, Out}boundOpenInfo is fully removed. pub trait ConnectionHandler: Send + 'static { /// A type representing the message(s) a /// [`NetworkBehaviour`](crate::behaviour::NetworkBehaviour) can send to a [`ConnectionHandler`] @@ -112,8 +113,10 @@ pub trait ConnectionHandler: Send + 'static { /// The outbound upgrade for the protocol(s) used by the handler. type OutboundProtocol: OutboundUpgradeSend; /// The type of additional information returned from `listen_protocol`. + #[deprecated = "Track data in ConnectionHandler instead."] type InboundOpenInfo: Send + 'static; /// The type of additional information passed to an `OutboundSubstreamRequest`. + #[deprecated = "Track data in ConnectionHandler instead."] type OutboundOpenInfo: Send + 'static; /// The [`InboundUpgrade`](libp2p_core::upgrade::InboundUpgrade) to apply on inbound @@ -224,7 +227,7 @@ pub trait ConnectionHandler: Send + 'static { /// Enumeration with the list of the possible stream events /// to pass to [`on_connection_event`](ConnectionHandler::on_connection_event). #[non_exhaustive] -pub enum ConnectionEvent<'a, IP: InboundUpgradeSend, OP: OutboundUpgradeSend, IOI, OOI> { +pub enum ConnectionEvent<'a, IP: InboundUpgradeSend, OP: OutboundUpgradeSend, IOI = (), OOI = ()> { /// Informs the handler about the output of a successful upgrade on a new inbound substream. FullyNegotiatedInbound(FullyNegotiatedInbound), /// Informs the handler about the output of a successful upgrade on a new outbound stream. @@ -318,7 +321,7 @@ impl /// [`ConnectionHandler`] implementation to stop a malicious remote node to open and keep alive /// an excessive amount of inbound substreams. #[derive(Debug)] -pub struct FullyNegotiatedInbound { +pub struct FullyNegotiatedInbound { pub protocol: IP::Output, pub info: IOI, } @@ -329,7 +332,7 @@ pub struct FullyNegotiatedInbound { /// The `protocol` field is the information that was previously passed to /// [`ConnectionHandlerEvent::OutboundSubstreamRequest`]. #[derive(Debug)] -pub struct FullyNegotiatedOutbound { +pub struct FullyNegotiatedOutbound { pub protocol: OP::Output, pub info: OOI, } @@ -524,7 +527,7 @@ pub struct ListenUpgradeError { /// The inbound substream protocol(s) are defined by [`ConnectionHandler::listen_protocol`] /// and the outbound substream protocol(s) by [`ConnectionHandlerEvent::OutboundSubstreamRequest`]. #[derive(Copy, Clone, Debug, PartialEq, Eq)] -pub struct SubstreamProtocol { +pub struct SubstreamProtocol { upgrade: TUpgrade, info: TInfo, timeout: Duration, diff --git a/swarm/src/handler/either.rs b/swarm/src/handler/either.rs index 1dc62e0eb2a..a349726f454 100644 --- a/swarm/src/handler/either.rs +++ b/swarm/src/handler/either.rs @@ -77,6 +77,7 @@ where /// Implementation of a [`ConnectionHandler`] that represents either of two [`ConnectionHandler`] /// implementations. +#[expect(deprecated)] // TODO: Remove when {In, Out}boundOpenInfo is fully removed. impl ConnectionHandler for Either where L: ConnectionHandler, diff --git a/swarm/src/handler/map_in.rs b/swarm/src/handler/map_in.rs index 55885b351bb..7a5166cab75 100644 --- a/swarm/src/handler/map_in.rs +++ b/swarm/src/handler/map_in.rs @@ -47,6 +47,7 @@ impl MapInEvent ConnectionHandler for MapInEvent where diff --git a/swarm/src/handler/map_out.rs b/swarm/src/handler/map_out.rs index 6d05551aeec..9bb0e2bc554 100644 --- a/swarm/src/handler/map_out.rs +++ b/swarm/src/handler/map_out.rs @@ -43,6 +43,7 @@ impl MapOutEvent { } } +#[expect(deprecated)] // TODO: Remove when {In, Out}boundOpenInfo is fully removed. impl ConnectionHandler for MapOutEvent where TConnectionHandler: ConnectionHandler, diff --git a/swarm/src/handler/multi.rs b/swarm/src/handler/multi.rs index 73af1b1109e..4f4d64f65fe 100644 --- a/swarm/src/handler/multi.rs +++ b/swarm/src/handler/multi.rs @@ -86,6 +86,7 @@ where Ok(m) } + #[expect(deprecated)] // TODO: Remove when {In, Out}boundOpenInfo is fully removed. fn on_listen_upgrade_error( &mut self, ListenUpgradeError { @@ -107,6 +108,7 @@ where } } +#[expect(deprecated)] // TODO: Remove when {In, Out}boundOpenInfo is fully removed. impl ConnectionHandler for MultiHandler where K: Clone + Debug + Hash + Eq + Send + 'static, diff --git a/swarm/src/handler/one_shot.rs b/swarm/src/handler/one_shot.rs index 29f2811522b..c623008dd90 100644 --- a/swarm/src/handler/one_shot.rs +++ b/swarm/src/handler/one_shot.rs @@ -129,7 +129,7 @@ where type OutboundOpenInfo = (); type InboundOpenInfo = (); - fn listen_protocol(&self) -> SubstreamProtocol { + fn listen_protocol(&self) -> SubstreamProtocol { self.listen_protocol.clone() } @@ -140,9 +140,7 @@ where fn poll( &mut self, _: &mut Context<'_>, - ) -> Poll< - ConnectionHandlerEvent, - > { + ) -> Poll> { if !self.events_out.is_empty() { return Poll::Ready(ConnectionHandlerEvent::NotifyBehaviour( self.events_out.remove(0), @@ -169,12 +167,7 @@ where fn on_connection_event( &mut self, - event: ConnectionEvent< - Self::InboundProtocol, - Self::OutboundProtocol, - Self::InboundOpenInfo, - Self::OutboundOpenInfo, - >, + event: ConnectionEvent, ) { match event { ConnectionEvent::FullyNegotiatedInbound(FullyNegotiatedInbound { diff --git a/swarm/src/handler/pending.rs b/swarm/src/handler/pending.rs index 483c4b3d6e8..8223c544593 100644 --- a/swarm/src/handler/pending.rs +++ b/swarm/src/handler/pending.rs @@ -51,7 +51,7 @@ impl ConnectionHandler for PendingConnectionHandler { type OutboundOpenInfo = Infallible; type InboundOpenInfo = (); - fn listen_protocol(&self) -> SubstreamProtocol { + fn listen_protocol(&self) -> SubstreamProtocol { SubstreamProtocol::new(PendingUpgrade::new(self.protocol_name.clone()), ()) } @@ -64,20 +64,13 @@ impl ConnectionHandler for PendingConnectionHandler { fn poll( &mut self, _: &mut Context<'_>, - ) -> Poll< - ConnectionHandlerEvent, - > { + ) -> Poll> { Poll::Pending } fn on_connection_event( &mut self, - event: ConnectionEvent< - Self::InboundProtocol, - Self::OutboundProtocol, - Self::InboundOpenInfo, - Self::OutboundOpenInfo, - >, + event: ConnectionEvent, ) { match event { // TODO: remove when Rust 1.82 is MSRV diff --git a/swarm/src/handler/select.rs b/swarm/src/handler/select.rs index 0f6dbe988ff..f4c926f1a0e 100644 --- a/swarm/src/handler/select.rs +++ b/swarm/src/handler/select.rs @@ -152,6 +152,7 @@ where TProto1: ConnectionHandler, TProto2: ConnectionHandler, { + #[expect(deprecated)] // TODO: Remove when {In, Out}boundOpenInfo is fully removed. fn on_listen_upgrade_error( &mut self, ListenUpgradeError { @@ -181,6 +182,7 @@ where } } +#[expect(deprecated)] // TODO: Remove when {In, Out}boundOpenInfo is fully removed. impl ConnectionHandler for ConnectionHandlerSelect where TProto1: ConnectionHandler, diff --git a/swarm/tests/connection_close.rs b/swarm/tests/connection_close.rs index bc71216870a..0d95626b2f0 100644 --- a/swarm/tests/connection_close.rs +++ b/swarm/tests/connection_close.rs @@ -103,7 +103,7 @@ impl ConnectionHandler for HandlerWithState { type InboundOpenInfo = (); type OutboundOpenInfo = (); - fn listen_protocol(&self) -> SubstreamProtocol { + fn listen_protocol(&self) -> SubstreamProtocol { SubstreamProtocol::new(DeniedUpgrade, ()) } @@ -114,9 +114,7 @@ impl ConnectionHandler for HandlerWithState { fn poll( &mut self, _: &mut Context<'_>, - ) -> Poll< - ConnectionHandlerEvent, - > { + ) -> Poll> { Poll::Pending } @@ -137,12 +135,7 @@ impl ConnectionHandler for HandlerWithState { fn on_connection_event( &mut self, - _: ConnectionEvent< - Self::InboundProtocol, - Self::OutboundProtocol, - Self::InboundOpenInfo, - Self::OutboundOpenInfo, - >, + _: ConnectionEvent, ) { } } From 75b6dfe9fa3f8f54ce52d25d700d6cd60601b58a Mon Sep 17 00:00:00 2001 From: Elena Frank Date: Thu, 9 Jan 2025 19:35:30 +0700 Subject: [PATCH 24/56] chore(identify): fix changelog entry Amendment to #5778. Merged CHANGELOG entries of `0.45.1` and `0.46.0`. Version `0.45.1` has been superseded by `0.46.0` before it was released. Pull-Request: #5803. --- protocols/identify/CHANGELOG.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/protocols/identify/CHANGELOG.md b/protocols/identify/CHANGELOG.md index e9f7b017574..66c839dfa98 100644 --- a/protocols/identify/CHANGELOG.md +++ b/protocols/identify/CHANGELOG.md @@ -1,15 +1,12 @@ ## 0.46.0 +- Add `hide_listen_addrs` option to prevent leaking (local) listen addresses. + See [PR 5507](https://github.com/libp2p/rust-libp2p/pull/5507). - Make `identify::Config` fields private and add getter functions. See [PR 5663](https://github.com/libp2p/rust-libp2p/pull/5663). - Discard `Info`s received from remote peers that contain a public key that doesn't match their peer ID. See [PR 5707](https://github.com/libp2p/rust-libp2p/pull/5707). -## 0.45.1 - -- Add `hide_listen_addrs` option to prevent leaking (local) listen addresses. - See [PR 5507](https://github.com/libp2p/rust-libp2p/pull/5507). - ## 0.45.0 - Address translation is moved here from `libp2p-core`. From 40ddf7ef4823ffb29f3d25cf6df7d076646666a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Thu, 9 Jan 2025 19:41:22 +0000 Subject: [PATCH 25/56] chore(ci): fix wasm tests see here https://github.com/rust-lang/compiler-team/issues/607 for more info Pull-Request: #5805. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a1ab56aec49..2519f7e45f8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -133,7 +133,7 @@ jobs: os: ubuntu-latest - target: "wasm32-unknown-emscripten" os: ubuntu-latest - - target: "wasm32-wasi" + - target: "wasm32-wasip1" os: ubuntu-latest - target: "x86_64-apple-darwin" os: macos-latest From b3fcca8b8418a793220faafb3c0a35d118ff68d3 Mon Sep 17 00:00:00 2001 From: DrHuangMHT Date: Fri, 10 Jan 2025 20:50:06 +0800 Subject: [PATCH 26/56] chore(swarm): append missing changelog Add missing changelog entry for #5242. Pull-Request: #5806. --- libp2p/CHANGELOG.md | 7 +++++++ swarm/CHANGELOG.md | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/libp2p/CHANGELOG.md b/libp2p/CHANGELOG.md index 9e7194e2a69..59bf2e81383 100644 --- a/libp2p/CHANGELOG.md +++ b/libp2p/CHANGELOG.md @@ -15,6 +15,13 @@ - Expose swarm builder phase errors. See [PR 5726](https://github.com/libp2p/rust-libp2p/pull/5726). +- Deprecate `ConnectionHandler::{InboundOpenInfo, OutboundOpenInfo}` associated type. + Previously, users could tag pending sub streams with custom data and retrieve the data + after the substream has been negotiated. + But substreams themselves are completely interchangeable, users should instead track + additional data inside `ConnectionHandler` after negotiation. + See [PR 5242](https://github.com/libp2p/rust-libp2p/pull/5242). + ## 0.54.1 - Update individual crates. diff --git a/swarm/CHANGELOG.md b/swarm/CHANGELOG.md index f1ad994bd1b..250d347430b 100644 --- a/swarm/CHANGELOG.md +++ b/swarm/CHANGELOG.md @@ -12,6 +12,13 @@ - Update default for idle-connection-timeout to 10s. See [PR 4967](https://github.com/libp2p/rust-libp2p/pull/4967). +- Deprecate `ConnectionHandler::{InboundOpenInfo, OutboundOpenInfo}` associated type. + Previously, users could tag pending sub streams with custom data and retrieve the data + after the substream has been negotiated. + But substreams themselves are completely interchangeable, users should instead track + additional data inside `ConnectionHandler` after negotiation. + See [PR 5242](https://github.com/libp2p/rust-libp2p/pull/5242). + ## 0.45.1 - Update `libp2p-swarm-derive` to version `0.35.0`, see [PR 5545] From a8b7e0ed383b61bf17d68b371b657a6e8a9d6435 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 10 Jan 2025 16:58:17 +0000 Subject: [PATCH 27/56] ci(mergify): upgrade configuration to current format Pull-Request: #5683. --- .github/mergify.yml | 84 ++++++++++++++++----------------------------- 1 file changed, 30 insertions(+), 54 deletions(-) diff --git a/.github/mergify.yml b/.github/mergify.yml index 38f025c7814..a439be11b10 100644 --- a/.github/mergify.yml +++ b/.github/mergify.yml @@ -1,57 +1,17 @@ -defaults: - actions: - queue: - method: squash - commit_message_template: | - {{ title }} - - {{ body | get_section("## Description", "") }} - - Pull-Request: #{{ number }}. - - {{ body | get_section("## Attributions", "") }} - pull_request_rules: - name: Ask to resolve conflict conditions: - conflict - -author=dependabot[bot] - or: - - -draft # Don't report conflicts on regular draft. - - and: # Do report conflicts on draft that are scheduled for the next major release. - - draft - - milestone~=v[0-9]\.[0-9]{2} + - -draft # Don't report conflicts on regular draft. + - and: # Do report conflicts on draft that are scheduled for the next major release. + - draft + - milestone~=v[0-9]\.[0-9]{2} actions: comment: - message: This pull request has merge conflicts. Could you please resolve them @{{author}}? 🙏 - - - name: Add to merge queue - conditions: - # All branch protection rules are implicit: https://docs.mergify.com/conditions/#about-branch-protection - - label=send-it - - base=master - actions: - queue: - name: default - - # Adds the Pr to the batch queue, so that we can run the interop tests. See the `external_prs` queue for more info. - - name: Add to batch merge queue - conditions: - # All branch protection rules are implicit: https://docs.mergify.com/conditions/#about-branch-protection - - label=send-it-batch - - base=master - actions: - queue: - name: external_prs - - - name: Add approved dependabot PRs to merge queue - conditions: - # All branch protection rules are implicit: https://docs.mergify.com/conditions/#about-branch-protection - - author=dependabot[bot] - - base=master - actions: - queue: - name: default + message: This pull request has merge conflicts. Could you please resolve them + @{{author}}? 🙏 - name: Remove reviews on updates after PR is queued for merging conditions: @@ -61,7 +21,8 @@ pull_request_rules: - author!=dependabot[bot] actions: dismiss_reviews: - message: Approvals have been dismissed because the PR was updated after the `send-it` label was applied. + message: Approvals have been dismissed because the PR was updated after the + `send-it` label was applied. changes_requested: false - name: Approve trivial maintainer PRs @@ -83,11 +44,26 @@ pull_request_rules: review: type: APPROVE + - name: Add approved dependabot PRs to merge queue + conditions: + # All branch protection rules are implicit: https://docs.mergify.com/conditions/#about-branch-protection + - author=dependabot[bot] + - base=master + actions: + queue: + queue_rules: - - name: default - conditions: [] - # External PR's don't have access to secrets and variables, therefore they don't run the interop tests. - # using a batch queue allows to circumvent that as mergify creates it from an internal branch. - - name: external_prs - conditions: [] - batch_size: 1 + - name: Add to merge queue + queue_conditions: + - label=send-it + - base=master + merge_conditions: [] + merge_method: squash + commit_message_template: | + {{ title }} + + {{ body | get_section("## Description", "") }} + + Pull-Request: #{{ number }}. + + {{ body | get_section("## Attributions", "") }} From ba8da162eaa5a930c9b484bc0223d3bf86082577 Mon Sep 17 00:00:00 2001 From: Elena Frank Date: Sat, 11 Jan 2025 00:51:11 +0700 Subject: [PATCH 28/56] fix(tcp): make `TCP_NODELAY` actually the default Nagle's algorithm is actually disabled by setting `TCP_NODELAY` to _true_. In the current master, it is set to _false_, i.e. Nagle's algorithm is enabled. This PR sets `TCP_NODELAY` per default to `true` and fixes the description of `tcp::Config::new`. Fixes #4890. Pull-Request: #5764. --- Cargo.lock | 2 +- Cargo.toml | 2 +- transports/tcp/CHANGELOG.md | 5 +++++ transports/tcp/Cargo.toml | 2 +- transports/tcp/src/lib.rs | 14 ++++++-------- 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 252429064af..ab23ee14020 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3359,7 +3359,7 @@ dependencies = [ [[package]] name = "libp2p-tcp" -version = "0.42.0" +version = "0.42.1" dependencies = [ "async-io", "async-std", diff --git a/Cargo.toml b/Cargo.toml index bd793d4f2c1..b10883e1441 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -103,7 +103,7 @@ libp2p-stream = { version = "0.2.0-alpha.1", path = "protocols/stream" } libp2p-swarm = { version = "0.45.2", path = "swarm" } libp2p-swarm-derive = { version = "=0.35.0", path = "swarm-derive" } # `libp2p-swarm-derive` may not be compatible with different `libp2p-swarm` non-breaking releases. E.g. `libp2p-swarm` might introduce a new enum variant `FromSwarm` (which is `#[non-exhaustive]`) in a non-breaking release. Older versions of `libp2p-swarm-derive` would not forward this enum variant within the `NetworkBehaviour` hierarchy. Thus the version pinning is required. libp2p-swarm-test = { version = "0.5.0", path = "swarm-test" } -libp2p-tcp = { version = "0.42.0", path = "transports/tcp" } +libp2p-tcp = { version = "0.42.1", path = "transports/tcp" } libp2p-tls = { version = "0.5.0", path = "transports/tls" } libp2p-uds = { version = "0.41.0", path = "transports/uds" } libp2p-upnp = { version = "0.3.1", path = "protocols/upnp" } diff --git a/transports/tcp/CHANGELOG.md b/transports/tcp/CHANGELOG.md index 107d0d13ece..6d9c51b45be 100644 --- a/transports/tcp/CHANGELOG.md +++ b/transports/tcp/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.42.1 + +- Fix the disabling of Nagle's algorithm, which requires setting `TCP_NODELAY` to _true_. + See [PR 5764](https://github.com/libp2p/rust-libp2p/pull/5764) + ## 0.42.0 - Implement refactored `Transport`. diff --git a/transports/tcp/Cargo.toml b/transports/tcp/Cargo.toml index 61c31e49639..93078d0db30 100644 --- a/transports/tcp/Cargo.toml +++ b/transports/tcp/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-tcp" edition = "2021" rust-version = { workspace = true } description = "TCP/IP transport protocol for libp2p" -version = "0.42.0" +version = "0.42.1" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/transports/tcp/src/lib.rs b/transports/tcp/src/lib.rs index 5d3e46bcb09..07250f75655 100644 --- a/transports/tcp/src/lib.rs +++ b/transports/tcp/src/lib.rs @@ -59,8 +59,8 @@ use socket2::{Domain, Socket, Type}; pub struct Config { /// TTL to set for opened sockets, or `None` to keep default. ttl: Option, - /// `TCP_NODELAY` to set for opened sockets, or `None` to keep default. - nodelay: Option, + /// `TCP_NODELAY` to set for opened sockets. + nodelay: bool, /// Size of the listen backlog for listen sockets. backlog: u32, } @@ -130,7 +130,7 @@ impl PortReuse { impl Config { /// Creates a new configuration for a TCP/IP transport: /// - /// * Nagle's algorithm, i.e. `TCP_NODELAY`, is _enabled_. See [`Config::nodelay`]. + /// * Nagle's algorithm is _disabled_, i.e. `TCP_NODELAY` _enabled_. See [`Config::nodelay`]. /// * Reuse of listening ports is _disabled_. See [`Config::port_reuse`]. /// * No custom `IP_TTL` is set. The default of the OS TCP stack applies. See [`Config::ttl`]. /// * The size of the listen backlog for new listening sockets is `1024`. See @@ -138,7 +138,7 @@ impl Config { pub fn new() -> Self { Self { ttl: None, - nodelay: Some(false), // Disable Nagle's algorithm by default + nodelay: true, // Disable Nagle's algorithm by default. backlog: 1024, } } @@ -151,7 +151,7 @@ impl Config { /// Configures the `TCP_NODELAY` option for new sockets. pub fn nodelay(mut self, value: bool) -> Self { - self.nodelay = Some(value); + self.nodelay = value; self } @@ -198,9 +198,7 @@ impl Config { if let Some(ttl) = self.ttl { socket.set_ttl(ttl)?; } - if let Some(nodelay) = self.nodelay { - socket.set_nodelay(nodelay)?; - } + socket.set_nodelay(self.nodelay)?; socket.set_reuse_address(true)?; #[cfg(all(unix, not(any(target_os = "solaris", target_os = "illumos"))))] if port_use == PortUse::Reuse { From e6b02daa80f90b59e2aafed3484448e49a366e79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Fri, 10 Jan 2025 21:11:58 +0000 Subject: [PATCH 29/56] chore(ci): update mergify script With #5683 the automatically merge of `send-it` labeled PR's was lost. This PR brings it back Pull-Request: #5808. --- .github/mergify.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/mergify.yml b/.github/mergify.yml index a439be11b10..316be305382 100644 --- a/.github/mergify.yml +++ b/.github/mergify.yml @@ -52,8 +52,16 @@ pull_request_rules: actions: queue: + - name: Add send-it labeled PRs to merge queue + conditions: + # All branch protection rules are implicit: https://docs.mergify.com/conditions/#about-branch-protection + - base=master + - label=send-it + actions: + queue: + queue_rules: - - name: Add to merge queue + - name: default merge queue queue_conditions: - label=send-it - base=master From ded5d96c802561be612d3a3b5283c293f1e65a7a Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Fri, 10 Jan 2025 22:31:38 +0100 Subject: [PATCH 30/56] chore(interop-tests): remove static linking flags for dependency builds When building the dependencies, we are not linking anything so we don't need to specify the static linking flags. Pull-Request: #5121. --- interop-tests/Dockerfile.chromium | 2 +- interop-tests/Dockerfile.native | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/interop-tests/Dockerfile.chromium b/interop-tests/Dockerfile.chromium index 4ccb142b4a3..73a9ab82ee7 100644 --- a/interop-tests/Dockerfile.chromium +++ b/interop-tests/Dockerfile.chromium @@ -14,7 +14,7 @@ FROM chef AS builder COPY --from=planner /app/recipe.json recipe.json # Build dependencies - this is the caching Docker layer! RUN cargo chef cook --release --package interop-tests --target wasm32-unknown-unknown --recipe-path recipe.json -RUN RUSTFLAGS='-C target-feature=+crt-static' cargo chef cook --release --package interop-tests --target x86_64-unknown-linux-gnu --bin wasm_ping --recipe-path recipe.json +RUN cargo chef cook --release --package interop-tests --bin wasm_ping --recipe-path recipe.json # Build application COPY . . RUN wasm-pack build --target web interop-tests diff --git a/interop-tests/Dockerfile.native b/interop-tests/Dockerfile.native index f0b078d9492..fab50dc50ad 100644 --- a/interop-tests/Dockerfile.native +++ b/interop-tests/Dockerfile.native @@ -9,7 +9,7 @@ RUN cargo chef prepare --recipe-path recipe.json FROM chef AS builder COPY --from=planner /app/recipe.json recipe.json # Build dependencies - this is the caching Docker layer! -RUN RUSTFLAGS='-C target-feature=+crt-static' cargo chef cook --release --package interop-tests --target $(rustc -vV | grep host | awk '{print $2}') --bin native_ping --recipe-path recipe.json +RUN cargo chef cook --release --package interop-tests --bin native_ping --recipe-path recipe.json # Build application COPY . . RUN RUSTFLAGS='-C target-feature=+crt-static' cargo build --release --package interop-tests --target $(rustc -vV | grep host | awk '{print $2}') --bin native_ping From 1442ca0779b6e73e3ff8b58ce9333415ecfd3031 Mon Sep 17 00:00:00 2001 From: Breno Teodoro <54450520+brenodt@users.noreply.github.com> Date: Sun, 12 Jan 2025 17:34:33 -0300 Subject: [PATCH 31/56] deps(if-watch): update if-watch to v3.2.1 Bumps the `if-watch` version to 3.2.1, aiming to fix #5628. Since this [`if-watch` PR](https://github.com/libp2p/if-watch/pull/37), the `system-configuration` version has been updated, which enables compiling for iOS targets. Pull-Request: #5758. --- Cargo.toml | 1 + protocols/mdns/Cargo.toml | 2 +- transports/quic/Cargo.toml | 2 +- transports/tcp/Cargo.toml | 2 +- transports/webrtc/Cargo.toml | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b10883e1441..3940ebc2b4c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -124,6 +124,7 @@ futures = "0.3.30" futures-bounded = { version = "0.2.4" } futures-rustls = { version = "0.26.0", default-features = false } getrandom = "0.2" +if-watch = "3.2.1" hickory-proto = { version = "0.25.0-alpha.4", default-features = false } hickory-resolver = { version = "0.25.0-alpha.4", default-features = false } multiaddr = "0.18.1" diff --git a/protocols/mdns/Cargo.toml b/protocols/mdns/Cargo.toml index ba86a82d5bb..e8fee81e98d 100644 --- a/protocols/mdns/Cargo.toml +++ b/protocols/mdns/Cargo.toml @@ -14,7 +14,7 @@ categories = ["network-programming", "asynchronous"] async-std = { version = "1.12.0", optional = true } async-io = { version = "2.3.3", optional = true } futures = { workspace = true } -if-watch = "3.2.0" +if-watch = { workspace = true } libp2p-core = { workspace = true } libp2p-swarm = { workspace = true } libp2p-identity = { workspace = true } diff --git a/transports/quic/Cargo.toml b/transports/quic/Cargo.toml index 1c35b293049..c0d4f17a916 100644 --- a/transports/quic/Cargo.toml +++ b/transports/quic/Cargo.toml @@ -12,7 +12,7 @@ license = "MIT" async-std = { version = "1.12.0", optional = true } futures = { workspace = true } futures-timer = "3.0.3" -if-watch = "3.2.0" +if-watch = { workspace = true } libp2p-core = { workspace = true } libp2p-tls = { workspace = true } libp2p-identity = { workspace = true } diff --git a/transports/tcp/Cargo.toml b/transports/tcp/Cargo.toml index 93078d0db30..73c25d85d48 100644 --- a/transports/tcp/Cargo.toml +++ b/transports/tcp/Cargo.toml @@ -14,7 +14,7 @@ categories = ["network-programming", "asynchronous"] async-io = { version = "2.3.3", optional = true } futures = { workspace = true } futures-timer = "3.0" -if-watch = "3.2.0" +if-watch = { workspace = true } libc = "0.2.155" libp2p-core = { workspace = true } socket2 = { version = "0.5.7", features = ["all"] } diff --git a/transports/webrtc/Cargo.toml b/transports/webrtc/Cargo.toml index d43be5720d4..41dec91ba43 100644 --- a/transports/webrtc/Cargo.toml +++ b/transports/webrtc/Cargo.toml @@ -15,7 +15,7 @@ async-trait = "0.1" futures = { workspace = true } futures-timer = "3" hex = "0.4" -if-watch = "3.2" +if-watch = { workspace = true } libp2p-core = { workspace = true } libp2p-noise = { workspace = true } libp2p-identity = { workspace = true } From d57081fb0b75c40c8d273fd123490d3a1561e409 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Mon, 13 Jan 2025 12:36:16 +0000 Subject: [PATCH 32/56] chore(ci): update mergify script missed this, with this dependabot is not able to merge PR's by itself as it needs the `send-it` label. also add a clause for the dismiss of stale approvals to not do so when the last commit was done by one of the `rust-libp2p` maintainers, so that we don't dismiss approvals if the last commit was a merge of master into the PR that is necessary before merging the PR. Latest example of this happening [here](https://github.com/libp2p/rust-libp2p/pull/5758#issuecomment-2585904938) Pull-Request: #5809. --- .github/mergify.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/mergify.yml b/.github/mergify.yml index 316be305382..0d519b38a94 100644 --- a/.github/mergify.yml +++ b/.github/mergify.yml @@ -19,6 +19,8 @@ pull_request_rules: - label=send-it - author!=@libp2p/rust-libp2p-maintainers - author!=dependabot[bot] + # Do not remove approvals if last commit was a merge of master into the branch, required for the PR to be merged. + - commits[-1].author!=@libp2p/rust-libp2p-maintainers actions: dismiss_reviews: message: Approvals have been dismissed because the PR was updated after the @@ -61,9 +63,8 @@ pull_request_rules: queue: queue_rules: - - name: default merge queue + - name: default queue_conditions: - - label=send-it - base=master merge_conditions: [] merge_method: squash From 0177ddfe6a54d541ad91e84dc6cd99ea40427b3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Mon, 13 Jan 2025 14:38:59 +0000 Subject: [PATCH 33/56] chore(test-utils): revert #5725 We cannot publish the crates using `libp2p-test-utils`, as cargo seems to required `dev-dependencies` to also be published Pull-Request: #5810. --- Cargo.lock | 44 ++++++++----------- Cargo.toml | 2 - misc/multistream-select/Cargo.toml | 2 +- misc/multistream-select/src/dialer_select.rs | 14 +++--- misc/test-utils/CHANGELOG.md | 4 -- misc/test-utils/Cargo.toml | 17 ------- misc/test-utils/src/lib.rs | 15 ------- muxers/mplex/Cargo.toml | 2 +- muxers/mplex/benches/split_send_size.rs | 5 ++- muxers/mplex/src/io.rs | 10 ++++- protocols/autonat/Cargo.toml | 2 +- protocols/autonat/tests/autonatv2.rs | 17 +++++-- protocols/dcutr/Cargo.toml | 2 +- protocols/dcutr/tests/lib.rs | 5 ++- protocols/gossipsub/Cargo.toml | 2 +- protocols/gossipsub/src/behaviour/tests.rs | 5 ++- protocols/gossipsub/tests/smoke.rs | 5 ++- protocols/identify/Cargo.toml | 2 +- protocols/identify/tests/smoke.rs | 33 ++++++++++---- protocols/kad/Cargo.toml | 2 +- protocols/kad/src/behaviour/test.rs | 4 +- protocols/kad/src/handler.rs | 5 ++- protocols/kad/tests/client_mode.rs | 17 +++++-- protocols/mdns/Cargo.toml | 2 +- protocols/mdns/tests/use-async-std.rs | 17 +++++-- protocols/mdns/tests/use-tokio.rs | 13 ++++-- protocols/perf/Cargo.toml | 1 - protocols/perf/tests/lib.rs | 5 ++- protocols/relay/Cargo.toml | 3 +- protocols/relay/tests/lib.rs | 29 +++++++++--- protocols/rendezvous/Cargo.toml | 2 +- protocols/rendezvous/tests/rendezvous.rs | 37 ++++++++++++---- protocols/request-response/Cargo.toml | 2 +- .../request-response/tests/error_reporting.rs | 30 ++++++++++--- .../request-response/tests/peer_address.rs | 5 ++- protocols/request-response/tests/ping.rs | 5 ++- protocols/stream/Cargo.toml | 2 +- protocols/stream/tests/lib.rs | 17 ++++--- swarm/Cargo.toml | 2 +- swarm/src/connection.rs | 13 ++++-- swarm/src/lib.rs | 4 +- transports/dns/Cargo.toml | 2 +- transports/dns/src/lib.rs | 4 +- transports/noise/Cargo.toml | 2 +- transports/noise/tests/smoke.rs | 5 ++- transports/plaintext/Cargo.toml | 2 +- transports/plaintext/tests/smoke.rs | 5 ++- transports/quic/Cargo.toml | 2 +- transports/quic/tests/smoke.rs | 41 ++++++++++++----- transports/tcp/Cargo.toml | 2 +- transports/tcp/src/lib.rs | 28 +++++++++--- transports/webrtc/Cargo.toml | 3 +- transports/webrtc/tests/smoke.rs | 9 +++- 53 files changed, 330 insertions(+), 180 deletions(-) delete mode 100644 misc/test-utils/CHANGELOG.md delete mode 100644 misc/test-utils/Cargo.toml delete mode 100644 misc/test-utils/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index ab23ee14020..ac65510b669 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2730,7 +2730,6 @@ dependencies = [ "libp2p-request-response", "libp2p-swarm", "libp2p-swarm-test", - "libp2p-test-utils", "quick-protobuf", "quick-protobuf-codec", "rand 0.8.5", @@ -2738,6 +2737,7 @@ dependencies = [ "thiserror 2.0.9", "tokio", "tracing", + "tracing-subscriber", "web-time 1.1.0", ] @@ -2801,7 +2801,6 @@ dependencies = [ "libp2p-swarm", "libp2p-swarm-test", "libp2p-tcp", - "libp2p-test-utils", "libp2p-yamux", "lru", "quick-protobuf", @@ -2809,6 +2808,7 @@ dependencies = [ "thiserror 2.0.9", "tokio", "tracing", + "tracing-subscriber", "web-time 1.1.0", ] @@ -2823,11 +2823,11 @@ dependencies = [ "hickory-resolver", "libp2p-core", "libp2p-identity", - "libp2p-test-utils", "parking_lot", "smallvec", "tokio", "tracing", + "tracing-subscriber", ] [[package]] @@ -2870,7 +2870,6 @@ dependencies = [ "libp2p-identity", "libp2p-swarm", "libp2p-swarm-test", - "libp2p-test-utils", "prometheus-client", "quick-protobuf", "quick-protobuf-codec", @@ -2881,6 +2880,7 @@ dependencies = [ "sha2 0.10.8", "tokio", "tracing", + "tracing-subscriber", "web-time 1.1.0", ] @@ -2898,12 +2898,12 @@ dependencies = [ "libp2p-identity", "libp2p-swarm", "libp2p-swarm-test", - "libp2p-test-utils", "quick-protobuf", "quick-protobuf-codec", "smallvec", "thiserror 2.0.9", "tracing", + "tracing-subscriber", ] [[package]] @@ -2951,7 +2951,6 @@ dependencies = [ "libp2p-noise", "libp2p-swarm", "libp2p-swarm-test", - "libp2p-test-utils", "libp2p-yamux", "quick-protobuf", "quick-protobuf-codec", @@ -2962,6 +2961,7 @@ dependencies = [ "smallvec", "thiserror 2.0.9", "tracing", + "tracing-subscriber", "uint", "web-time 1.1.0", ] @@ -2979,12 +2979,12 @@ dependencies = [ "libp2p-identity", "libp2p-swarm", "libp2p-swarm-test", - "libp2p-test-utils", "rand 0.8.5", "smallvec", "socket2", "tokio", "tracing", + "tracing-subscriber", ] [[package]] @@ -3035,13 +3035,13 @@ dependencies = [ "libp2p-muxer-test-harness", "libp2p-plaintext", "libp2p-tcp", - "libp2p-test-utils", "nohash-hasher", "parking_lot", "quickcheck-ext", "rand 0.8.5", "smallvec", "tracing", + "tracing-subscriber", "unsigned-varint", ] @@ -3066,7 +3066,6 @@ dependencies = [ "futures_ringbuf", "libp2p-core", "libp2p-identity", - "libp2p-test-utils", "multiaddr", "multihash", "once_cell", @@ -3077,6 +3076,7 @@ dependencies = [ "static_assertions", "thiserror 2.0.9", "tracing", + "tracing-subscriber", "x25519-dalek", "zeroize", ] @@ -3096,7 +3096,6 @@ dependencies = [ "libp2p-swarm", "libp2p-swarm-test", "libp2p-tcp", - "libp2p-test-utils", "libp2p-tls", "libp2p-yamux", "serde", @@ -3135,11 +3134,11 @@ dependencies = [ "futures_ringbuf", "libp2p-core", "libp2p-identity", - "libp2p-test-utils", "quick-protobuf", "quick-protobuf-codec", "quickcheck-ext", "tracing", + "tracing-subscriber", ] [[package]] @@ -3176,7 +3175,6 @@ dependencies = [ "libp2p-muxer-test-harness", "libp2p-noise", "libp2p-tcp", - "libp2p-test-utils", "libp2p-tls", "libp2p-yamux", "quickcheck", @@ -3188,6 +3186,7 @@ dependencies = [ "thiserror 2.0.9", "tokio", "tracing", + "tracing-subscriber", ] [[package]] @@ -3206,7 +3205,6 @@ dependencies = [ "libp2p-plaintext", "libp2p-swarm", "libp2p-swarm-test", - "libp2p-test-utils", "libp2p-yamux", "quick-protobuf", "quick-protobuf-codec", @@ -3215,6 +3213,7 @@ dependencies = [ "static_assertions", "thiserror 2.0.9", "tracing", + "tracing-subscriber", "web-time 1.1.0", ] @@ -3232,13 +3231,13 @@ dependencies = [ "libp2p-request-response", "libp2p-swarm", "libp2p-swarm-test", - "libp2p-test-utils", "quick-protobuf", "quick-protobuf-codec", "rand 0.8.5", "thiserror 2.0.9", "tokio", "tracing", + "tracing-subscriber", "web-time 1.1.0", ] @@ -3257,12 +3256,12 @@ dependencies = [ "libp2p-identity", "libp2p-swarm", "libp2p-swarm-test", - "libp2p-test-utils", "rand 0.8.5", "serde", "serde_json", "smallvec", "tracing", + "tracing-subscriber", ] [[package]] @@ -3292,10 +3291,10 @@ dependencies = [ "libp2p-identity", "libp2p-swarm", "libp2p-swarm-test", - "libp2p-test-utils", "rand 0.8.5", "tokio", "tracing", + "tracing-subscriber", ] [[package]] @@ -3317,7 +3316,6 @@ dependencies = [ "libp2p-plaintext", "libp2p-swarm-derive", "libp2p-swarm-test", - "libp2p-test-utils", "libp2p-yamux", "lru", "multistream-select", @@ -3327,6 +3325,7 @@ dependencies = [ "smallvec", "tokio", "tracing", + "tracing-subscriber", "trybuild", "wasm-bindgen-futures", "web-time 1.1.0", @@ -3368,16 +3367,9 @@ dependencies = [ "if-watch", "libc", "libp2p-core", - "libp2p-test-utils", "socket2", "tokio", "tracing", -] - -[[package]] -name = "libp2p-test-utils" -version = "0.1.0" -dependencies = [ "tracing-subscriber", ] @@ -3439,7 +3431,6 @@ dependencies = [ "libp2p-core", "libp2p-identity", "libp2p-noise", - "libp2p-test-utils", "libp2p-webrtc-utils", "multihash", "quickcheck", @@ -3450,6 +3441,7 @@ dependencies = [ "tokio", "tokio-util", "tracing", + "tracing-subscriber", "webrtc", "webrtc-ice", ] @@ -3867,12 +3859,12 @@ dependencies = [ "bytes", "futures", "futures_ringbuf", - "libp2p-test-utils", "pin-project", "quickcheck-ext", "rw-stream-sink", "smallvec", "tracing", + "tracing-subscriber", "unsigned-varint", ] diff --git a/Cargo.toml b/Cargo.toml index 3940ebc2b4c..eecd6a3759c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,7 +30,6 @@ members = [ "misc/quickcheck-ext", "misc/rw-stream-sink", "misc/server", - "misc/test-utils", "misc/webrtc-utils", "muxers/mplex", "muxers/test-harness", @@ -114,7 +113,6 @@ libp2p-websocket = { version = "0.44.1", path = "transports/websocket" } libp2p-websocket-websys = { version = "0.4.1", path = "transports/websocket-websys" } libp2p-webtransport-websys = { version = "0.4.1", path = "transports/webtransport-websys" } libp2p-yamux = { version = "0.46.0", path = "muxers/yamux" } -libp2p-test-utils = { version = "0.1.0", path = "misc/test-utils" } # External dependencies async-std-resolver = { version = "0.25.0-alpha.4", default-features = false } diff --git a/misc/multistream-select/Cargo.toml b/misc/multistream-select/Cargo.toml index 66ab434b613..d11ad4e2709 100644 --- a/misc/multistream-select/Cargo.toml +++ b/misc/multistream-select/Cargo.toml @@ -23,7 +23,7 @@ async-std = { version = "1.6.2", features = ["attributes"] } futures_ringbuf = "0.4.0" quickcheck = { workspace = true } rw-stream-sink = { workspace = true } -libp2p-test-utils = { workspace = true } +tracing-subscriber = { workspace = true, features = ["env-filter"] } # 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/misc/multistream-select/src/dialer_select.rs b/misc/multistream-select/src/dialer_select.rs index bd537e7fc7b..1d13e94910d 100644 --- a/misc/multistream-select/src/dialer_select.rs +++ b/misc/multistream-select/src/dialer_select.rs @@ -214,9 +214,9 @@ mod tests { future::timeout, net::{TcpListener, TcpStream}, }; - use libp2p_test_utils::EnvFilter; use quickcheck::{Arbitrary, Gen, GenRange}; use tracing::metadata::LevelFilter; + use tracing_subscriber::EnvFilter; use super::*; use crate::listener_select_proto; @@ -275,11 +275,13 @@ mod tests { ListenerProtos(listen_protos): ListenerProtos, DialPayload(dial_payload): DialPayload, ) { - libp2p_test_utils::with_env_filter( - EnvFilter::builder() - .with_default_directive(LevelFilter::DEBUG.into()) - .from_env_lossy(), - ); + let _ = tracing_subscriber::fmt() + .with_env_filter( + EnvFilter::builder() + .with_default_directive(LevelFilter::DEBUG.into()) + .from_env_lossy(), + ) + .try_init(); async_std::task::block_on(async move { let listener = TcpListener::bind("0.0.0.0:0").await.unwrap(); diff --git a/misc/test-utils/CHANGELOG.md b/misc/test-utils/CHANGELOG.md deleted file mode 100644 index 0b8ed3ab931..00000000000 --- a/misc/test-utils/CHANGELOG.md +++ /dev/null @@ -1,4 +0,0 @@ -## 0.1.0 - -- Introduce 'test-utils` crate. - See [PR 5725](https://github.com/libp2p/rust-libp2p/pull/5725). \ No newline at end of file diff --git a/misc/test-utils/Cargo.toml b/misc/test-utils/Cargo.toml deleted file mode 100644 index 438bcabcf2a..00000000000 --- a/misc/test-utils/Cargo.toml +++ /dev/null @@ -1,17 +0,0 @@ -[package] -name = "libp2p-test-utils" -version = "0.1.0" -edition = "2021" -authors = ["Krishang Shah "] -license = "MIT" -repository = "https://github.com/libp2p/rust-libp2p" -publish = false - -[package.metadata.release] -release = false - -[dependencies] -tracing-subscriber = { workspace = true, features = ["env-filter"] } - -[lints] -workspace = true diff --git a/misc/test-utils/src/lib.rs b/misc/test-utils/src/lib.rs deleted file mode 100644 index 1155c79b614..00000000000 --- a/misc/test-utils/src/lib.rs +++ /dev/null @@ -1,15 +0,0 @@ -pub use tracing_subscriber::EnvFilter; - -/// Initializes logging with the default environment filter (`RUST_LOG`). -pub fn with_default_env_filter() { - with_env_filter(EnvFilter::from_default_env()); -} - -/// Initializes logging with a custom environment filter. -/// Logs are written to standard error (`stderr`). -pub fn with_env_filter(filter: impl Into) { - let _ = tracing_subscriber::fmt() - .with_env_filter(filter) - .with_writer(std::io::stderr) - .try_init(); -} diff --git a/muxers/mplex/Cargo.toml b/muxers/mplex/Cargo.toml index 78650218f4b..7f887c8b3b8 100644 --- a/muxers/mplex/Cargo.toml +++ b/muxers/mplex/Cargo.toml @@ -32,7 +32,7 @@ libp2p-muxer-test-harness = { path = "../test-harness" } libp2p-plaintext = { workspace = true } libp2p-tcp = { workspace = true, features = ["async-io"] } quickcheck = { workspace = true } -libp2p-test-utils = { workspace = true } +tracing-subscriber = { workspace = true, features = ["env-filter"] } [[bench]] name = "split_send_size" diff --git a/muxers/mplex/benches/split_send_size.rs b/muxers/mplex/benches/split_send_size.rs index 7a0e9780ca7..b0dd4babff7 100644 --- a/muxers/mplex/benches/split_send_size.rs +++ b/muxers/mplex/benches/split_send_size.rs @@ -38,6 +38,7 @@ use libp2p_identity as identity; use libp2p_identity::PeerId; use libp2p_mplex as mplex; use libp2p_plaintext as plaintext; +use tracing_subscriber::EnvFilter; type BenchTransport = transport::Boxed<(PeerId, muxing::StreamMuxerBox)>; @@ -54,7 +55,9 @@ const BENCH_SIZES: [usize; 8] = [ ]; fn prepare(c: &mut Criterion) { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let payload: Vec = vec![1; 1024 * 1024]; diff --git a/muxers/mplex/src/io.rs b/muxers/mplex/src/io.rs index eeea4ce734f..ac93fd3865e 100644 --- a/muxers/mplex/src/io.rs +++ b/muxers/mplex/src/io.rs @@ -1231,7 +1231,10 @@ mod tests { #[test] fn max_buffer_behaviour() { - libp2p_test_utils::with_default_env_filter(); + use tracing_subscriber::EnvFilter; + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); fn prop(cfg: MplexConfig, overflow: NonZeroU8) { let mut r_buf = BytesMut::new(); @@ -1366,7 +1369,10 @@ mod tests { #[test] fn close_on_error() { - libp2p_test_utils::with_default_env_filter(); + use tracing_subscriber::EnvFilter; + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); fn prop(cfg: MplexConfig, num_streams: NonZeroU8) { let num_streams = cmp::min(cfg.max_substreams, num_streams.get() as usize); diff --git a/protocols/autonat/Cargo.toml b/protocols/autonat/Cargo.toml index 8ad4492fbff..294cdd54de4 100644 --- a/protocols/autonat/Cargo.toml +++ b/protocols/autonat/Cargo.toml @@ -37,7 +37,7 @@ thiserror = { workspace = true, optional = true } [dev-dependencies] tokio = { workspace = true, features = ["macros", "rt", "sync"] } libp2p-swarm-test = { path = "../../swarm-test" } -libp2p-test-utils = { workspace = true } +tracing-subscriber = { version = "0.3", features = ["env-filter"] } libp2p-identify = { workspace = true } libp2p-swarm = { workspace = true, features = ["macros"] } diff --git a/protocols/autonat/tests/autonatv2.rs b/protocols/autonat/tests/autonatv2.rs index 1e278f5554f..49866a9adb5 100644 --- a/protocols/autonat/tests/autonatv2.rs +++ b/protocols/autonat/tests/autonatv2.rs @@ -11,10 +11,13 @@ use libp2p_swarm::{ use libp2p_swarm_test::SwarmExt; use rand_core::OsRng; use tokio::sync::oneshot; +use tracing_subscriber::EnvFilter; #[tokio::test] async fn confirm_successful() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let (mut alice, mut bob) = start_and_connect().await; let cor_server_peer = *alice.local_peer_id(); @@ -125,7 +128,9 @@ async fn confirm_successful() { #[tokio::test] async fn dial_back_to_unsupported_protocol() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let (mut alice, mut bob) = bootstrap().await; let alice_peer_id = *alice.local_peer_id(); @@ -221,7 +226,9 @@ async fn dial_back_to_unsupported_protocol() { #[tokio::test] async fn dial_back_to_non_libp2p() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let (mut alice, mut bob) = bootstrap().await; let alice_peer_id = *alice.local_peer_id(); @@ -307,7 +314,9 @@ async fn dial_back_to_non_libp2p() { #[tokio::test] async fn dial_back_to_not_supporting() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let (mut alice, mut bob) = bootstrap().await; let alice_peer_id = *alice.local_peer_id(); diff --git a/protocols/dcutr/Cargo.toml b/protocols/dcutr/Cargo.toml index 7bc05671aa2..31acb42f2af 100644 --- a/protocols/dcutr/Cargo.toml +++ b/protocols/dcutr/Cargo.toml @@ -34,7 +34,7 @@ libp2p-swarm = { workspace = true, features = ["macros"] } libp2p-swarm-test = { path = "../../swarm-test" } libp2p-tcp = { workspace = true, features = ["async-io"] } libp2p-yamux = { workspace = true } -libp2p-test-utils = { workspace = true } +tracing-subscriber = { workspace = true, features = ["env-filter"] } tokio = { workspace = true, features = ["rt", "macros"] } # Passing arguments to the docsrs builder in order to properly document cfg's. diff --git a/protocols/dcutr/tests/lib.rs b/protocols/dcutr/tests/lib.rs index ce7119cebcf..a35c9a50cfe 100644 --- a/protocols/dcutr/tests/lib.rs +++ b/protocols/dcutr/tests/lib.rs @@ -32,10 +32,13 @@ use libp2p_plaintext as plaintext; use libp2p_relay as relay; use libp2p_swarm::{Config, NetworkBehaviour, Swarm, SwarmEvent}; use libp2p_swarm_test::SwarmExt as _; +use tracing_subscriber::EnvFilter; #[tokio::test] async fn connect() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let mut relay = build_relay(); let mut dst = build_client(); diff --git a/protocols/gossipsub/Cargo.toml b/protocols/gossipsub/Cargo.toml index 328d4367204..0262348429e 100644 --- a/protocols/gossipsub/Cargo.toml +++ b/protocols/gossipsub/Cargo.toml @@ -45,7 +45,7 @@ prometheus-client = { workspace = true } libp2p-core = { workspace = true } libp2p-swarm-test = { path = "../../swarm-test" } quickcheck = { workspace = true } -libp2p-test-utils = { workspace = true } +tracing-subscriber = { workspace = true, features = ["env-filter"] } tokio = { workspace = true, features = ["rt", "rt-multi-thread", "time", "macros"] } # Passing arguments to the docsrs builder in order to properly document cfg's. diff --git a/protocols/gossipsub/src/behaviour/tests.rs b/protocols/gossipsub/src/behaviour/tests.rs index bed74ecdce7..c79ed7f4cf9 100644 --- a/protocols/gossipsub/src/behaviour/tests.rs +++ b/protocols/gossipsub/src/behaviour/tests.rs @@ -4766,7 +4766,10 @@ fn test_limit_number_of_message_ids_inside_ihave() { #[test] fn test_iwant_penalties() { - libp2p_test_utils::with_default_env_filter(); + // use tracing_subscriber::EnvFilter; + // let _ = tracing_subscriber::fmt() + // .with_env_filter(EnvFilter::from_default_env()) + // .try_init(); let config = ConfigBuilder::default() .iwant_followup_time(Duration::from_secs(4)) .build() diff --git a/protocols/gossipsub/tests/smoke.rs b/protocols/gossipsub/tests/smoke.rs index d5fec2c1985..85038665b4d 100644 --- a/protocols/gossipsub/tests/smoke.rs +++ b/protocols/gossipsub/tests/smoke.rs @@ -31,6 +31,7 @@ use libp2p_swarm_test::SwarmExt as _; use quickcheck::{QuickCheck, TestResult}; use rand::{seq::SliceRandom, SeedableRng}; use tokio::{runtime::Runtime, time}; +use tracing_subscriber::EnvFilter; struct Graph { nodes: SelectAll>, @@ -131,7 +132,9 @@ async fn build_node() -> Swarm { #[test] fn multi_hop_propagation() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); fn prop(num_nodes: u8, seed: u64) -> TestResult { if !(2..=50).contains(&num_nodes) { diff --git a/protocols/identify/Cargo.toml b/protocols/identify/Cargo.toml index 9c4f8ea3707..2fb2eaed1ba 100644 --- a/protocols/identify/Cargo.toml +++ b/protocols/identify/Cargo.toml @@ -29,7 +29,7 @@ either = "1.12.0" async-std = { version = "1.6.2", features = ["attributes"] } libp2p-swarm-test = { path = "../../swarm-test" } libp2p-swarm = { workspace = true, features = ["macros"] } -libp2p-test-utils = { workspace = true } +tracing-subscriber = { workspace = true, features = ["env-filter"] } # 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/protocols/identify/tests/smoke.rs b/protocols/identify/tests/smoke.rs index a152bd75b19..0d2818df0a4 100644 --- a/protocols/identify/tests/smoke.rs +++ b/protocols/identify/tests/smoke.rs @@ -9,10 +9,13 @@ use libp2p_identify as identify; use libp2p_identity::Keypair; use libp2p_swarm::{Swarm, SwarmEvent}; use libp2p_swarm_test::SwarmExt; +use tracing_subscriber::EnvFilter; #[async_std::test] async fn periodic_identify() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let mut swarm1 = Swarm::new_ephemeral(|identity| { identify::Behaviour::new( @@ -81,7 +84,9 @@ async fn periodic_identify() { } #[async_std::test] async fn only_emits_address_candidate_once_per_connection() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let mut swarm1 = Swarm::new_ephemeral(|identity| { identify::Behaviour::new( @@ -151,7 +156,9 @@ async fn only_emits_address_candidate_once_per_connection() { #[async_std::test] async fn emits_unique_listen_addresses() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let mut swarm1 = Swarm::new_ephemeral(|identity| { identify::Behaviour::new( @@ -221,7 +228,9 @@ async fn emits_unique_listen_addresses() { #[async_std::test] async fn hides_listen_addresses() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let mut swarm1 = Swarm::new_ephemeral(|identity| { identify::Behaviour::new( @@ -290,7 +299,9 @@ async fn hides_listen_addresses() { #[async_std::test] async fn identify_push() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let mut swarm1 = Swarm::new_ephemeral(|identity| { identify::Behaviour::new(identify::Config::new("a".to_string(), identity.public())) @@ -340,7 +351,9 @@ async fn identify_push() { #[async_std::test] async fn discover_peer_after_disconnect() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let mut swarm1 = Swarm::new_ephemeral(|identity| { identify::Behaviour::new(identify::Config::new("a".to_string(), identity.public())) @@ -391,7 +404,9 @@ async fn discover_peer_after_disconnect() { #[async_std::test] async fn configured_interval_starts_after_first_identify() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let identify_interval = Duration::from_secs(5); @@ -429,7 +444,9 @@ async fn configured_interval_starts_after_first_identify() { #[async_std::test] async fn reject_mismatched_public_key() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let mut honest_swarm = Swarm::new_ephemeral(|identity| { identify::Behaviour::new( diff --git a/protocols/kad/Cargo.toml b/protocols/kad/Cargo.toml index 757c0aed189..0e4fb608d15 100644 --- a/protocols/kad/Cargo.toml +++ b/protocols/kad/Cargo.toml @@ -41,7 +41,7 @@ libp2p-swarm = { path = "../../swarm", features = ["macros"] } libp2p-swarm-test = { path = "../../swarm-test" } libp2p-yamux = { workspace = true } quickcheck = { workspace = true } -libp2p-test-utils = { workspace = true } +tracing-subscriber = { workspace = true, features = ["env-filter"] } [features] serde = ["dep:serde", "bytes/serde"] diff --git a/protocols/kad/src/behaviour/test.rs b/protocols/kad/src/behaviour/test.rs index ab8c980c30c..467865dd225 100644 --- a/protocols/kad/src/behaviour/test.rs +++ b/protocols/kad/src/behaviour/test.rs @@ -323,7 +323,9 @@ fn query_iter() { #[test] fn unresponsive_not_returned_direct() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) + .try_init(); // Build one node. It contains fake addresses to non-existing nodes. We ask it to find a // random peer. We make sure that no fake address is returned. diff --git a/protocols/kad/src/handler.rs b/protocols/kad/src/handler.rs index b848cf94410..a3bb19447cb 100644 --- a/protocols/kad/src/handler.rs +++ b/protocols/kad/src/handler.rs @@ -1057,6 +1057,7 @@ fn process_kad_response(event: KadResponseMsg, query_id: QueryId) -> HandlerEven #[cfg(test)] mod tests { use quickcheck::{Arbitrary, Gen}; + use tracing_subscriber::EnvFilter; use super::*; @@ -1071,7 +1072,9 @@ mod tests { #[test] fn compute_next_protocol_status_test() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); fn prop(now_supported: bool, current: Option) { let new = compute_new_protocol_status(now_supported, current); diff --git a/protocols/kad/tests/client_mode.rs b/protocols/kad/tests/client_mode.rs index 09e24c6f6ea..3275c525890 100644 --- a/protocols/kad/tests/client_mode.rs +++ b/protocols/kad/tests/client_mode.rs @@ -3,12 +3,15 @@ use libp2p_identity as identity; use libp2p_kad::{store::MemoryStore, Behaviour, Config, Event, Mode}; use libp2p_swarm::{Swarm, SwarmEvent}; use libp2p_swarm_test::SwarmExt; +use tracing_subscriber::EnvFilter; use Event::*; use MyBehaviourEvent::*; #[async_std::test] async fn server_gets_added_to_routing_table_by_client() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let mut client = Swarm::new_ephemeral(MyBehaviour::new); let mut server = Swarm::new_ephemeral(MyBehaviour::new); @@ -38,7 +41,9 @@ async fn server_gets_added_to_routing_table_by_client() { #[async_std::test] async fn two_servers_add_each_other_to_routing_table() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let mut server1 = Swarm::new_ephemeral(MyBehaviour::new); let mut server2 = Swarm::new_ephemeral(MyBehaviour::new); @@ -77,7 +82,9 @@ async fn two_servers_add_each_other_to_routing_table() { #[async_std::test] async fn adding_an_external_addresses_activates_server_mode_on_existing_connections() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let mut client = Swarm::new_ephemeral(MyBehaviour::new); let mut server = Swarm::new_ephemeral(MyBehaviour::new); @@ -113,7 +120,9 @@ async fn adding_an_external_addresses_activates_server_mode_on_existing_connecti #[async_std::test] async fn set_client_to_server_mode() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let mut client = Swarm::new_ephemeral(MyBehaviour::new); client.behaviour_mut().kad.set_mode(Some(Mode::Client)); diff --git a/protocols/mdns/Cargo.toml b/protocols/mdns/Cargo.toml index e8fee81e98d..84acc0592d7 100644 --- a/protocols/mdns/Cargo.toml +++ b/protocols/mdns/Cargo.toml @@ -34,7 +34,7 @@ async-std = { version = "1.9.0", features = ["attributes"] } libp2p-swarm = { workspace = true, features = ["tokio", "async-std"] } tokio = { workspace = true, features = ["macros", "rt", "rt-multi-thread", "time"] } libp2p-swarm-test = { path = "../../swarm-test" } -libp2p-test-utils = { workspace = true } +tracing-subscriber = { workspace = true, features = ["env-filter"] } [[test]] name = "use-async-std" diff --git a/protocols/mdns/tests/use-async-std.rs b/protocols/mdns/tests/use-async-std.rs index 9ee2b7659ea..df08b39af07 100644 --- a/protocols/mdns/tests/use-async-std.rs +++ b/protocols/mdns/tests/use-async-std.rs @@ -24,17 +24,22 @@ use futures::future::Either; use libp2p_mdns::{async_io::Behaviour, Config, Event}; use libp2p_swarm::{Swarm, SwarmEvent}; use libp2p_swarm_test::SwarmExt as _; +use tracing_subscriber::EnvFilter; #[async_std::test] async fn test_discovery_async_std_ipv4() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); run_discovery_test(Config::default()).await } #[async_std::test] async fn test_discovery_async_std_ipv6() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let config = Config { enable_ipv6: true, @@ -45,7 +50,9 @@ async fn test_discovery_async_std_ipv6() { #[async_std::test] async fn test_expired_async_std() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let config = Config { ttl: Duration::from_secs(1), @@ -78,7 +85,9 @@ async fn test_expired_async_std() { #[async_std::test] async fn test_no_expiration_on_close_async_std() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let config = Config { ttl: Duration::from_secs(120), query_interval: Duration::from_secs(10), diff --git a/protocols/mdns/tests/use-tokio.rs b/protocols/mdns/tests/use-tokio.rs index a48f84217a3..0ec90a52b90 100644 --- a/protocols/mdns/tests/use-tokio.rs +++ b/protocols/mdns/tests/use-tokio.rs @@ -23,17 +23,22 @@ use futures::future::Either; use libp2p_mdns::{tokio::Behaviour, Config, Event}; use libp2p_swarm::{Swarm, SwarmEvent}; use libp2p_swarm_test::SwarmExt as _; +use tracing_subscriber::EnvFilter; #[tokio::test] async fn test_discovery_tokio_ipv4() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); run_discovery_test(Config::default()).await } #[tokio::test] async fn test_discovery_tokio_ipv6() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let config = Config { enable_ipv6: true, @@ -44,7 +49,9 @@ async fn test_discovery_tokio_ipv6() { #[tokio::test] async fn test_expired_tokio() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let config = Config { ttl: Duration::from_secs(1), diff --git a/protocols/perf/Cargo.toml b/protocols/perf/Cargo.toml index 0b994447525..645abc9bcfb 100644 --- a/protocols/perf/Cargo.toml +++ b/protocols/perf/Cargo.toml @@ -29,7 +29,6 @@ serde_json = "1.0" thiserror = { workspace = true } tracing = { workspace = true } tracing-subscriber = { workspace = true, features = ["env-filter"] } -libp2p-test-utils = { workspace = true } tokio = { workspace = true, features = ["macros", "rt", "rt-multi-thread"] } [dev-dependencies] diff --git a/protocols/perf/tests/lib.rs b/protocols/perf/tests/lib.rs index c265b0e2e61..017d475befd 100644 --- a/protocols/perf/tests/lib.rs +++ b/protocols/perf/tests/lib.rs @@ -24,10 +24,13 @@ use libp2p_perf::{ }; use libp2p_swarm::{Swarm, SwarmEvent}; use libp2p_swarm_test::SwarmExt; +use tracing_subscriber::EnvFilter; #[tokio::test] async fn perf() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let mut server = Swarm::new_ephemeral(|_| server::Behaviour::new()); let server_peer_id = *server.local_peer_id(); diff --git a/protocols/relay/Cargo.toml b/protocols/relay/Cargo.toml index e7e447e7d16..6c2c7b90304 100644 --- a/protocols/relay/Cargo.toml +++ b/protocols/relay/Cargo.toml @@ -36,7 +36,8 @@ libp2p-swarm = { workspace = true, features = ["macros", "async-std"] } libp2p-swarm-test = { workspace = true } libp2p-yamux = { workspace = true } quickcheck = { workspace = true } -libp2p-test-utils = { workspace = true } +tracing-subscriber = { workspace = true, features = ["env-filter"] } + # 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/protocols/relay/tests/lib.rs b/protocols/relay/tests/lib.rs index da6f549c091..3181e60db74 100644 --- a/protocols/relay/tests/lib.rs +++ b/protocols/relay/tests/lib.rs @@ -40,10 +40,13 @@ use libp2p_plaintext as plaintext; use libp2p_relay as relay; use libp2p_swarm::{dial_opts::DialOpts, Config, DialError, NetworkBehaviour, Swarm, SwarmEvent}; use libp2p_swarm_test::SwarmExt; +use tracing_subscriber::EnvFilter; #[test] fn reservation() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let mut pool = LocalPool::new(); let relay_addr = Multiaddr::empty().with(Protocol::Memory(rand::random::())); @@ -84,7 +87,9 @@ fn reservation() { #[test] fn new_reservation_to_same_relay_replaces_old() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let mut pool = LocalPool::new(); let relay_addr = Multiaddr::empty().with(Protocol::Memory(rand::random::())); @@ -181,7 +186,9 @@ fn new_reservation_to_same_relay_replaces_old() { #[test] fn connect() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let mut pool = LocalPool::new(); let relay_addr = Multiaddr::empty().with(Protocol::Memory(rand::random::())); @@ -265,7 +272,9 @@ async fn connection_established_to( #[test] fn handle_dial_failure() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let mut pool = LocalPool::new(); let relay_addr = Multiaddr::empty().with(Protocol::Memory(rand::random::())); @@ -284,7 +293,9 @@ fn handle_dial_failure() { #[test] fn propagate_reservation_error_to_listener() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let mut pool = LocalPool::new(); let relay_addr = Multiaddr::empty().with(Protocol::Memory(rand::random::())); @@ -331,7 +342,9 @@ fn propagate_reservation_error_to_listener() { #[test] fn propagate_connect_error_to_unknown_peer_to_dialer() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let mut pool = LocalPool::new(); let relay_addr = Multiaddr::empty().with(Protocol::Memory(rand::random::())); @@ -385,7 +398,9 @@ fn propagate_connect_error_to_unknown_peer_to_dialer() { #[test] fn reuse_connection() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let mut pool = LocalPool::new(); let relay_addr = Multiaddr::empty().with(Protocol::Memory(rand::random::())); diff --git a/protocols/rendezvous/Cargo.toml b/protocols/rendezvous/Cargo.toml index 104dc6ad1d4..9521913cd30 100644 --- a/protocols/rendezvous/Cargo.toml +++ b/protocols/rendezvous/Cargo.toml @@ -32,7 +32,7 @@ libp2p-swarm = { workspace = true, features = ["macros", "tokio"] } libp2p-swarm-test = { path = "../../swarm-test" } rand = "0.8" tokio = { workspace = true, features = [ "rt-multi-thread", "time", "macros", "sync", "process", "fs", "net" ] } -libp2p-test-utils = { workspace = true } +tracing-subscriber = { workspace = true, features = ["env-filter"] } # 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/protocols/rendezvous/tests/rendezvous.rs b/protocols/rendezvous/tests/rendezvous.rs index 98aa9dab62d..2305c2ef412 100644 --- a/protocols/rendezvous/tests/rendezvous.rs +++ b/protocols/rendezvous/tests/rendezvous.rs @@ -27,10 +27,13 @@ use libp2p_rendezvous as rendezvous; use libp2p_rendezvous::client::RegisterError; use libp2p_swarm::{DialError, Swarm, SwarmEvent}; use libp2p_swarm_test::SwarmExt; +use tracing_subscriber::EnvFilter; #[tokio::test] async fn given_successful_registration_then_successful_discovery() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let namespace = rendezvous::Namespace::from_static("some-namespace"); let ([mut alice, mut bob], mut robert) = new_server_with_connected_clients(rendezvous::server::Config::default()).await; @@ -83,7 +86,9 @@ async fn given_successful_registration_then_successful_discovery() { #[tokio::test] async fn should_return_error_when_no_external_addresses() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let namespace = rendezvous::Namespace::from_static("some-namespace"); let server = new_server(rendezvous::server::Config::default()).await; let mut client = Swarm::new_ephemeral(rendezvous::client::Behaviour::new); @@ -98,7 +103,9 @@ async fn should_return_error_when_no_external_addresses() { #[tokio::test] async fn given_successful_registration_then_refresh_ttl() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let namespace = rendezvous::Namespace::from_static("some-namespace"); let ([mut alice, mut bob], mut robert) = new_server_with_connected_clients(rendezvous::server::Config::default()).await; @@ -164,7 +171,9 @@ async fn given_successful_registration_then_refresh_ttl() { #[tokio::test] async fn given_successful_registration_then_refresh_external_addrs() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let namespace = rendezvous::Namespace::from_static("some-namespace"); let ([mut alice], mut robert) = new_server_with_connected_clients(rendezvous::server::Config::default()).await; @@ -215,7 +224,9 @@ async fn given_successful_registration_then_refresh_external_addrs() { #[tokio::test] async fn given_invalid_ttl_then_unsuccessful_registration() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let namespace = rendezvous::Namespace::from_static("some-namespace"); let ([mut alice], mut robert) = new_server_with_connected_clients(rendezvous::server::Config::default()).await; @@ -242,7 +253,9 @@ async fn given_invalid_ttl_then_unsuccessful_registration() { #[tokio::test] async fn discover_allows_for_dial_by_peer_id() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let namespace = rendezvous::Namespace::from_static("some-namespace"); let ([mut alice, mut bob], robert) = new_server_with_connected_clients(rendezvous::server::Config::default()).await; @@ -297,7 +310,9 @@ async fn discover_allows_for_dial_by_peer_id() { #[tokio::test] async fn eve_cannot_register() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let namespace = rendezvous::Namespace::from_static("some-namespace"); let mut robert = new_server(rendezvous::server::Config::default()).await; let mut eve = new_impersonating_client().await; @@ -323,7 +338,9 @@ async fn eve_cannot_register() { // test if charlie can operate as client and server simultaneously #[tokio::test] async fn can_combine_client_and_server() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let namespace = rendezvous::Namespace::from_static("some-namespace"); let ([mut alice], mut robert) = new_server_with_connected_clients(rendezvous::server::Config::default()).await; @@ -359,7 +376,9 @@ async fn can_combine_client_and_server() { #[tokio::test] async fn registration_on_clients_expire() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let namespace = rendezvous::Namespace::from_static("some-namespace"); let ([mut alice, mut bob], robert) = new_server_with_connected_clients(rendezvous::server::Config::default().with_min_ttl(1)) diff --git a/protocols/request-response/Cargo.toml b/protocols/request-response/Cargo.toml index cb78f536ae4..5cd711dd051 100644 --- a/protocols/request-response/Cargo.toml +++ b/protocols/request-response/Cargo.toml @@ -35,7 +35,7 @@ rand = "0.8" libp2p-swarm-test = { path = "../../swarm-test" } futures_ringbuf = "0.4.0" serde = { version = "1.0", features = ["derive"] } -libp2p-test-utils = { workspace = true } +tracing-subscriber = { workspace = true, features = ["env-filter"] } # 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/protocols/request-response/tests/error_reporting.rs b/protocols/request-response/tests/error_reporting.rs index 281701f5cc3..2108b6006c5 100644 --- a/protocols/request-response/tests/error_reporting.rs +++ b/protocols/request-response/tests/error_reporting.rs @@ -12,10 +12,13 @@ use libp2p_swarm_test::SwarmExt; use request_response::{ Codec, InboundFailure, InboundRequestId, OutboundFailure, OutboundRequestId, ResponseChannel, }; +use tracing_subscriber::EnvFilter; #[async_std::test] async fn report_outbound_failure_on_read_response() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let (peer1_id, mut swarm1) = new_swarm(); let (peer2_id, mut swarm2) = new_swarm(); @@ -69,7 +72,10 @@ async fn report_outbound_failure_on_read_response() { #[async_std::test] async fn report_outbound_failure_on_write_request() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); + let (peer1_id, mut swarm1) = new_swarm(); let (_peer2_id, mut swarm2) = new_swarm(); @@ -109,7 +115,9 @@ async fn report_outbound_failure_on_write_request() { #[async_std::test] async fn report_outbound_timeout_on_read_response() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); // `swarm1` needs to have a bigger timeout to avoid racing let (peer1_id, mut swarm1) = new_swarm_with_timeout(Duration::from_millis(200)); @@ -154,7 +162,9 @@ async fn report_outbound_timeout_on_read_response() { #[async_std::test] async fn report_outbound_failure_on_max_streams() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); // `swarm2` will be able to handle only 1 stream per time. let swarm2_config = request_response::Config::default() @@ -204,7 +214,9 @@ async fn report_outbound_failure_on_max_streams() { #[async_std::test] async fn report_inbound_failure_on_read_request() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let (peer1_id, mut swarm1) = new_swarm(); let (_peer2_id, mut swarm2) = new_swarm(); @@ -239,7 +251,9 @@ async fn report_inbound_failure_on_read_request() { #[async_std::test] async fn report_inbound_failure_on_write_response() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let (peer1_id, mut swarm1) = new_swarm(); let (peer2_id, mut swarm2) = new_swarm(); @@ -303,7 +317,9 @@ async fn report_inbound_failure_on_write_response() { #[async_std::test] async fn report_inbound_timeout_on_write_response() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); // `swarm2` needs to have a bigger timeout to avoid racing let (peer1_id, mut swarm1) = new_swarm_with_timeout(Duration::from_millis(100)); diff --git a/protocols/request-response/tests/peer_address.rs b/protocols/request-response/tests/peer_address.rs index 714091fc682..603e2d09dc0 100644 --- a/protocols/request-response/tests/peer_address.rs +++ b/protocols/request-response/tests/peer_address.rs @@ -6,11 +6,14 @@ use libp2p_request_response::ProtocolSupport; use libp2p_swarm::{StreamProtocol, Swarm, SwarmEvent}; use libp2p_swarm_test::SwarmExt; use serde::{Deserialize, Serialize}; +use tracing_subscriber::EnvFilter; #[async_std::test] #[cfg(feature = "cbor")] async fn dial_succeeds_after_adding_peers_address() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let protocols = iter::once((StreamProtocol::new("/ping/1"), ProtocolSupport::Full)); let config = request_response::Config::default(); diff --git a/protocols/request-response/tests/ping.rs b/protocols/request-response/tests/ping.rs index 12458a0e5e7..94adedac2d7 100644 --- a/protocols/request-response/tests/ping.rs +++ b/protocols/request-response/tests/ping.rs @@ -30,11 +30,14 @@ use libp2p_swarm::{StreamProtocol, Swarm, SwarmEvent}; use libp2p_swarm_test::SwarmExt; use rand::Rng; use serde::{Deserialize, Serialize}; +use tracing_subscriber::EnvFilter; #[async_std::test] #[cfg(feature = "cbor")] async fn is_response_outbound() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let ping = Ping("ping".to_string().into_bytes()); let offline_peer = PeerId::random(); diff --git a/protocols/stream/Cargo.toml b/protocols/stream/Cargo.toml index adb7a797794..d9c9276cb12 100644 --- a/protocols/stream/Cargo.toml +++ b/protocols/stream/Cargo.toml @@ -20,7 +20,7 @@ rand = "0.8" [dev-dependencies] libp2p-swarm-test = { workspace = true } tokio = { workspace = true, features = ["full"] } -libp2p-test-utils = { workspace = true } +tracing-subscriber = { workspace = true, features = ["env-filter"] } [lints] workspace = true diff --git a/protocols/stream/tests/lib.rs b/protocols/stream/tests/lib.rs index 425b49adfaf..cd6caaced5e 100644 --- a/protocols/stream/tests/lib.rs +++ b/protocols/stream/tests/lib.rs @@ -5,20 +5,23 @@ use libp2p_identity::PeerId; use libp2p_stream as stream; use libp2p_swarm::{StreamProtocol, Swarm}; use libp2p_swarm_test::SwarmExt as _; -use libp2p_test_utils::EnvFilter; use stream::OpenStreamError; use tracing::level_filters::LevelFilter; +use tracing_subscriber::EnvFilter; const PROTOCOL: StreamProtocol = StreamProtocol::new("/test"); #[tokio::test] async fn dropping_incoming_streams_deregisters() { - libp2p_test_utils::with_env_filter( - EnvFilter::builder() - .with_default_directive(LevelFilter::DEBUG.into()) - .from_env() - .unwrap(), - ); + let _ = tracing_subscriber::fmt() + .with_env_filter( + EnvFilter::builder() + .with_default_directive(LevelFilter::DEBUG.into()) + .from_env() + .unwrap(), + ) + .with_test_writer() + .try_init(); let mut swarm1 = Swarm::new_ephemeral(|_| stream::Behaviour::new()); let mut swarm2 = Swarm::new_ephemeral(|_| stream::Behaviour::new()); diff --git a/swarm/Cargo.toml b/swarm/Cargo.toml index b7e0fd73b5e..cf027d96ec0 100644 --- a/swarm/Cargo.toml +++ b/swarm/Cargo.toml @@ -55,7 +55,7 @@ criterion = { version = "0.5", features = ["async_tokio"] } once_cell = "1.19.0" trybuild = "1.0.95" tokio = { workspace = true, features = ["time", "rt", "macros", "rt-multi-thread"] } -libp2p-test-utils = { workspace = true } +tracing-subscriber = { workspace = true, features = ["env-filter"] } [[test]] name = "swarm_derive" diff --git a/swarm/src/connection.rs b/swarm/src/connection.rs index 8e913aa80e5..bf688f41f0d 100644 --- a/swarm/src/connection.rs +++ b/swarm/src/connection.rs @@ -801,13 +801,16 @@ mod tests { StreamMuxer, }; use quickcheck::*; + use tracing_subscriber::EnvFilter; use super::*; use crate::dummy; #[test] fn max_negotiating_inbound_streams() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); fn prop(max_negotiating_inbound_streams: u8) { let max_negotiating_inbound_streams: usize = max_negotiating_inbound_streams.into(); @@ -975,7 +978,9 @@ mod tests { #[test] fn checked_add_fraction_can_add_u64_max() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) + .try_init(); let start = Instant::now(); let duration = checked_add_fraction(start, Duration::from_secs(u64::MAX)); @@ -985,7 +990,9 @@ mod tests { #[test] fn compute_new_shutdown_does_not_panic() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); #[derive(Debug)] struct ArbitraryShutdown(Shutdown); diff --git a/swarm/src/lib.rs b/swarm/src/lib.rs index f9c4c71c76f..91513c83559 100644 --- a/swarm/src/lib.rs +++ b/swarm/src/lib.rs @@ -2303,7 +2303,9 @@ mod tests { #[tokio::test] async fn aborting_pending_connection_surfaces_error() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) + .try_init(); let mut dialer = new_test_swarm(Config::with_tokio_executor()); let mut listener = new_test_swarm(Config::with_tokio_executor()); diff --git a/transports/dns/Cargo.toml b/transports/dns/Cargo.toml index a07e795397b..2a12c34a383 100644 --- a/transports/dns/Cargo.toml +++ b/transports/dns/Cargo.toml @@ -25,7 +25,7 @@ tracing = { workspace = true } libp2p-identity = { workspace = true, features = ["rand"] } tokio = { workspace = true, features = ["rt", "time"] } async-std-crate = { package = "async-std", version = "1.6" } -libp2p-test-utils = { workspace = true } +tracing-subscriber = { workspace = true, features = ["env-filter"] } [features] async-std = ["async-std-resolver"] diff --git a/transports/dns/src/lib.rs b/transports/dns/src/lib.rs index 581942b8b7e..7e3cf5d3c37 100644 --- a/transports/dns/src/lib.rs +++ b/transports/dns/src/lib.rs @@ -629,7 +629,9 @@ mod tests { #[test] fn basic_resolve() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) + .try_init(); #[derive(Clone)] struct CustomTransport; diff --git a/transports/noise/Cargo.toml b/transports/noise/Cargo.toml index a1b712dbdaf..d0e2f9004ce 100644 --- a/transports/noise/Cargo.toml +++ b/transports/noise/Cargo.toml @@ -34,7 +34,7 @@ snow = { version = "0.9.5", features = ["default-resolver"], default-features = [dev-dependencies] futures_ringbuf = "0.4.0" quickcheck = { workspace = true } -libp2p-test-utils = { workspace = true } +tracing-subscriber = { workspace = true, features = ["env-filter"] } libp2p-identity = { workspace = true, features = ["rand"] } # Passing arguments to the docsrs builder in order to properly document cfg's. diff --git a/transports/noise/tests/smoke.rs b/transports/noise/tests/smoke.rs index cd9702b1c2f..abc5a038f93 100644 --- a/transports/noise/tests/smoke.rs +++ b/transports/noise/tests/smoke.rs @@ -29,6 +29,7 @@ use libp2p_core::{ use libp2p_identity as identity; use libp2p_noise as noise; use quickcheck::*; +use tracing_subscriber::EnvFilter; #[allow(dead_code)] fn core_upgrade_compat() { @@ -43,7 +44,9 @@ fn core_upgrade_compat() { #[test] fn xx() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); fn prop(mut messages: Vec) -> bool { messages.truncate(5); let server_id = identity::Keypair::generate_ed25519(); diff --git a/transports/plaintext/Cargo.toml b/transports/plaintext/Cargo.toml index 95f8f5af065..9e1e5449158 100644 --- a/transports/plaintext/Cargo.toml +++ b/transports/plaintext/Cargo.toml @@ -24,7 +24,7 @@ quick-protobuf-codec = { workspace = true } libp2p-identity = { workspace = true, features = ["ed25519", "rand"] } quickcheck = { workspace = true } futures_ringbuf = "0.4.0" -libp2p-test-utils = { workspace = true } +tracing-subscriber = { workspace = true, features = ["env-filter"] } # 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/plaintext/tests/smoke.rs b/transports/plaintext/tests/smoke.rs index ee8cec46c0b..f77f23d3ad3 100644 --- a/transports/plaintext/tests/smoke.rs +++ b/transports/plaintext/tests/smoke.rs @@ -23,10 +23,13 @@ use libp2p_core::upgrade::InboundConnectionUpgrade; use libp2p_identity as identity; use libp2p_plaintext as plaintext; use quickcheck::QuickCheck; +use tracing_subscriber::EnvFilter; #[test] fn variable_msg_length() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); fn prop(msg: Vec) { let msg_to_send = msg.clone(); diff --git a/transports/quic/Cargo.toml b/transports/quic/Cargo.toml index c0d4f17a916..ce225e21447 100644 --- a/transports/quic/Cargo.toml +++ b/transports/quic/Cargo.toml @@ -43,7 +43,7 @@ libp2p-tcp = { workspace = true, features = ["async-io"] } libp2p-yamux = { workspace = true } quickcheck = "1" tokio = { workspace = true, features = ["macros", "rt-multi-thread", "time"] } -libp2p-test-utils = { workspace = true } +tracing-subscriber = { workspace = true, features = ["env-filter"] } [[test]] name = "stream_compliance" diff --git a/transports/quic/tests/smoke.rs b/transports/quic/tests/smoke.rs index f0a8bd97d70..5fbef84649e 100644 --- a/transports/quic/tests/smoke.rs +++ b/transports/quic/tests/smoke.rs @@ -33,6 +33,7 @@ use libp2p_tcp as tcp; use libp2p_yamux as yamux; use quic::Provider; use rand::RngCore; +use tracing_subscriber::EnvFilter; #[cfg(feature = "tokio")] #[tokio::test] @@ -49,7 +50,9 @@ async fn async_std_smoke() { #[cfg(feature = "tokio")] #[tokio::test] async fn endpoint_reuse() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let (_, mut a_transport) = create_default_transport::(); let (_, mut b_transport) = create_default_transport::(); @@ -74,7 +77,9 @@ async fn endpoint_reuse() { #[cfg(feature = "async-std")] #[async_std::test] async fn ipv4_dial_ipv6() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let (a_peer_id, mut a_transport) = create_default_transport::(); let (b_peer_id, mut b_transport) = create_default_transport::(); @@ -94,7 +99,9 @@ async fn ipv4_dial_ipv6() { async fn wrapped_with_delay() { use libp2p_core::transport::DialOpts; - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); struct DialDelay(Arc>>); @@ -264,7 +271,9 @@ async fn tcp_and_quic() { #[cfg(feature = "async-std")] #[test] fn concurrent_connections_and_streams_async_std() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); quickcheck::QuickCheck::new() .min_tests_passed(1) @@ -275,7 +284,9 @@ fn concurrent_connections_and_streams_async_std() { #[cfg(feature = "tokio")] #[test] fn concurrent_connections_and_streams_tokio() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let rt = tokio::runtime::Runtime::new().unwrap(); let _guard = rt.enter(); @@ -292,7 +303,9 @@ async fn draft_29_support() { use futures::{future::poll_fn, select}; use libp2p_core::transport::TransportError; - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let (_, mut a_transport) = create_transport::(|cfg| cfg.support_draft_29 = true); @@ -367,7 +380,9 @@ async fn draft_29_support() { #[cfg(feature = "async-std")] #[async_std::test] async fn backpressure() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let max_stream_data = quic::Config::new(&generate_tls_keypair()).max_stream_data; let (mut stream_a, mut stream_b) = build_streams::().await; @@ -391,7 +406,9 @@ async fn backpressure() { #[cfg(feature = "async-std")] #[async_std::test] async fn read_after_peer_dropped_stream() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let (mut stream_a, mut stream_b) = build_streams::().await; let data = vec![0; 10]; @@ -411,7 +428,9 @@ async fn read_after_peer_dropped_stream() { #[async_std::test] #[should_panic] async fn write_after_peer_dropped_stream() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let (stream_a, mut stream_b) = build_streams::().await; drop(stream_a); futures_timer::Delay::new(Duration::from_millis(100)).await; @@ -465,7 +484,9 @@ async fn test_local_listener_reuse() { } async fn smoke() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let (a_peer_id, mut a_transport) = create_default_transport::

(); let (b_peer_id, mut b_transport) = create_default_transport::

(); diff --git a/transports/tcp/Cargo.toml b/transports/tcp/Cargo.toml index 73c25d85d48..e74fdda5d63 100644 --- a/transports/tcp/Cargo.toml +++ b/transports/tcp/Cargo.toml @@ -28,7 +28,7 @@ async-io = ["dep:async-io", "if-watch/smol"] [dev-dependencies] async-std = { version = "1.6.5", features = ["attributes"] } tokio = { workspace = true, features = ["full"] } -libp2p-test-utils = { workspace = true } +tracing-subscriber = { workspace = true, features = ["env-filter"] } # 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/tcp/src/lib.rs b/transports/tcp/src/lib.rs index 07250f75655..7eb25c81e92 100644 --- a/transports/tcp/src/lib.rs +++ b/transports/tcp/src/lib.rs @@ -760,7 +760,9 @@ mod tests { #[test] fn communicating_between_dialer_and_listener() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) + .try_init(); async fn listener(addr: Multiaddr, mut ready_tx: mpsc::Sender) { let mut tcp = Transport::::default().boxed(); @@ -839,7 +841,9 @@ mod tests { #[test] fn wildcard_expansion() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) + .try_init(); async fn listener(addr: Multiaddr, mut ready_tx: mpsc::Sender) { let mut tcp = Transport::::default().boxed(); @@ -917,7 +921,9 @@ mod tests { #[test] fn port_reuse_dialing() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) + .try_init(); async fn listener( addr: Multiaddr, @@ -1034,7 +1040,9 @@ mod tests { #[test] fn port_reuse_listening() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) + .try_init(); async fn listen_twice(addr: Multiaddr) { let mut tcp = Transport::::new(Config::new()); @@ -1088,7 +1096,9 @@ mod tests { #[test] fn listen_port_0() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) + .try_init(); async fn listen(addr: Multiaddr) -> Multiaddr { let mut tcp = Transport::::default().boxed(); @@ -1123,7 +1133,9 @@ mod tests { #[test] fn listen_invalid_addr() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) + .try_init(); fn test(addr: Multiaddr) { #[cfg(feature = "async-io")] @@ -1144,7 +1156,9 @@ mod tests { #[test] fn test_remove_listener() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) + .try_init(); async fn cycle_listeners() -> bool { let mut tcp = Transport::::default().boxed(); diff --git a/transports/webrtc/Cargo.toml b/transports/webrtc/Cargo.toml index 41dec91ba43..44c5fbbe192 100644 --- a/transports/webrtc/Cargo.toml +++ b/transports/webrtc/Cargo.toml @@ -39,7 +39,8 @@ pem = ["webrtc?/pem"] libp2p-identity = { workspace = true, features = ["rand"] } tokio = { workspace = true, features = ["full"] } quickcheck = "1.0.3" -libp2p-test-utils = { workspace = true } +tracing-subscriber = { workspace = true, features = ["env-filter"] } + [[test]] name = "smoke" diff --git a/transports/webrtc/tests/smoke.rs b/transports/webrtc/tests/smoke.rs index e27e3cee672..5f67c09d962 100644 --- a/transports/webrtc/tests/smoke.rs +++ b/transports/webrtc/tests/smoke.rs @@ -42,10 +42,13 @@ use libp2p_core::{ use libp2p_identity::PeerId; use libp2p_webrtc as webrtc; use rand::{thread_rng, RngCore}; +use tracing_subscriber::EnvFilter; #[tokio::test] async fn smoke() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let (a_peer_id, mut a_transport) = create_transport(); let (b_peer_id, mut b_transport) = create_transport(); @@ -62,7 +65,9 @@ async fn smoke() { // Note: This test should likely be ported to the muxer compliance test suite. #[test] fn concurrent_connections_and_streams_tokio() { - libp2p_test_utils::with_default_env_filter(); + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); let rt = tokio::runtime::Runtime::new().unwrap(); let _guard = rt.enter(); From 4449024545c40494dd6ccb7bb39c525f9d459680 Mon Sep 17 00:00:00 2001 From: Elena Frank Date: Tue, 14 Jan 2025 20:53:25 +0700 Subject: [PATCH 34/56] fix: minor version bump packages affected by #5676 By switching from `void::Void` to `std::convert::Infallible`, #5676 changed the output types of some `NetworkBehavior` implementations in different protocols. This can cause a type mismatch for the user and therefore is a breaking change. #5678 (follow-up PR that version-bumped the crates affected by #5676) only bumped the patch version of the affected crates. The current PR now changes it to a minor version bump for all crates where types in a `NetworkBehavior` implementation were affected. It also reverts the version bump and CHANGELOG entry in `libp2p-quic` that was added with #5678, because that crate was never touched by the original PR. Pull-Request: #5811. --- Cargo.lock | 18 +++++++++--------- Cargo.toml | 18 +++++++++--------- core/CHANGELOG.md | 2 +- core/Cargo.toml | 2 +- examples/stream/Cargo.toml | 2 +- misc/allow-block-list/CHANGELOG.md | 2 +- misc/allow-block-list/Cargo.toml | 2 +- misc/connection-limits/CHANGELOG.md | 2 +- misc/connection-limits/Cargo.toml | 2 +- misc/memory-connection-limits/CHANGELOG.md | 2 +- misc/memory-connection-limits/Cargo.toml | 2 +- protocols/autonat/CHANGELOG.md | 2 +- protocols/autonat/Cargo.toml | 2 +- protocols/ping/CHANGELOG.md | 2 +- protocols/ping/Cargo.toml | 2 +- protocols/request-response/CHANGELOG.md | 8 +++----- protocols/stream/CHANGELOG.md | 2 +- protocols/stream/Cargo.toml | 2 +- swarm/CHANGELOG.md | 2 +- swarm/Cargo.toml | 2 +- transports/quic/CHANGELOG.md | 5 ----- transports/quic/Cargo.toml | 2 +- 22 files changed, 39 insertions(+), 46 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ac65510b669..92c77a63044 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2704,7 +2704,7 @@ dependencies = [ [[package]] name = "libp2p-allow-block-list" -version = "0.4.1" +version = "0.5.0" dependencies = [ "async-std", "libp2p-core", @@ -2716,7 +2716,7 @@ dependencies = [ [[package]] name = "libp2p-autonat" -version = "0.13.1" +version = "0.14.0" dependencies = [ "async-trait", "asynchronous-codec", @@ -2743,7 +2743,7 @@ dependencies = [ [[package]] name = "libp2p-connection-limits" -version = "0.4.1" +version = "0.5.0" dependencies = [ "async-std", "libp2p-core", @@ -2759,7 +2759,7 @@ dependencies = [ [[package]] name = "libp2p-core" -version = "0.42.1" +version = "0.43.0" dependencies = [ "async-std", "either", @@ -2989,7 +2989,7 @@ dependencies = [ [[package]] name = "libp2p-memory-connection-limits" -version = "0.3.1" +version = "0.4.0" dependencies = [ "libp2p-core", "libp2p-identify", @@ -3109,7 +3109,7 @@ dependencies = [ [[package]] name = "libp2p-ping" -version = "0.45.1" +version = "0.46.0" dependencies = [ "futures", "futures-timer", @@ -3164,7 +3164,7 @@ dependencies = [ [[package]] name = "libp2p-quic" -version = "0.11.2" +version = "0.11.1" dependencies = [ "async-std", "futures", @@ -3284,7 +3284,7 @@ dependencies = [ [[package]] name = "libp2p-stream" -version = "0.2.0-alpha.1" +version = "0.3.0-alpha" dependencies = [ "futures", "libp2p-core", @@ -3299,7 +3299,7 @@ dependencies = [ [[package]] name = "libp2p-swarm" -version = "0.45.2" +version = "0.46.0" dependencies = [ "async-std", "criterion", diff --git a/Cargo.toml b/Cargo.toml index eecd6a3759c..16885c4eded 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -73,10 +73,10 @@ rust-version = "1.83.0" [workspace.dependencies] libp2p = { version = "0.55.0", path = "libp2p" } -libp2p-allow-block-list = { version = "0.4.1", path = "misc/allow-block-list" } -libp2p-autonat = { version = "0.13.1", path = "protocols/autonat" } -libp2p-connection-limits = { version = "0.4.1", path = "misc/connection-limits" } -libp2p-core = { version = "0.42.1", path = "core" } +libp2p-allow-block-list = { version = "0.5.0", path = "misc/allow-block-list" } +libp2p-autonat = { version = "0.14.0", path = "protocols/autonat" } +libp2p-connection-limits = { version = "0.5.0", path = "misc/connection-limits" } +libp2p-core = { version = "0.43.0", path = "core" } libp2p-dcutr = { version = "0.12.1", path = "protocols/dcutr" } libp2p-dns = { version = "0.42.1", path = "transports/dns" } libp2p-floodsub = { version = "0.45.0", path = "protocols/floodsub" } @@ -85,21 +85,21 @@ libp2p-identify = { version = "0.46.0", path = "protocols/identify" } libp2p-identity = { version = "0.2.10" } libp2p-kad = { version = "0.47.0", path = "protocols/kad" } libp2p-mdns = { version = "0.46.1", path = "protocols/mdns" } -libp2p-memory-connection-limits = { version = "0.3.1", path = "misc/memory-connection-limits" } +libp2p-memory-connection-limits = { version = "0.4.0", path = "misc/memory-connection-limits" } libp2p-metrics = { version = "0.15.0", path = "misc/metrics" } libp2p-mplex = { version = "0.42.0", path = "muxers/mplex" } libp2p-noise = { version = "0.45.1", path = "transports/noise" } libp2p-perf = { version = "0.4.0", path = "protocols/perf" } -libp2p-ping = { version = "0.45.1", path = "protocols/ping" } +libp2p-ping = { version = "0.46.0", path = "protocols/ping" } libp2p-plaintext = { version = "0.42.0", path = "transports/plaintext" } libp2p-pnet = { version = "0.25.0", path = "transports/pnet" } -libp2p-quic = { version = "0.11.2", path = "transports/quic" } +libp2p-quic = { version = "0.11.1", path = "transports/quic" } libp2p-relay = { version = "0.18.1", path = "protocols/relay" } libp2p-rendezvous = { version = "0.15.1", path = "protocols/rendezvous" } libp2p-request-response = { version = "0.28.0", path = "protocols/request-response" } libp2p-server = { version = "0.12.6", path = "misc/server" } -libp2p-stream = { version = "0.2.0-alpha.1", path = "protocols/stream" } -libp2p-swarm = { version = "0.45.2", path = "swarm" } +libp2p-stream = { version = "0.3.0-alpha", path = "protocols/stream" } +libp2p-swarm = { version = "0.46.0", path = "swarm" } libp2p-swarm-derive = { version = "=0.35.0", path = "swarm-derive" } # `libp2p-swarm-derive` may not be compatible with different `libp2p-swarm` non-breaking releases. E.g. `libp2p-swarm` might introduce a new enum variant `FromSwarm` (which is `#[non-exhaustive]`) in a non-breaking release. Older versions of `libp2p-swarm-derive` would not forward this enum variant within the `NetworkBehaviour` hierarchy. Thus the version pinning is required. libp2p-swarm-test = { version = "0.5.0", path = "swarm-test" } libp2p-tcp = { version = "0.42.1", path = "transports/tcp" } diff --git a/core/CHANGELOG.md b/core/CHANGELOG.md index 68b1f99cc2a..003120954e7 100644 --- a/core/CHANGELOG.md +++ b/core/CHANGELOG.md @@ -1,4 +1,4 @@ -## 0.42.1 +## 0.43.0 - Added `libp2p::core::util::unreachable` that is a drop-in replacement of `void::unreachable`. See [PR 5676](https://github.com/libp2p/rust-libp2p/pull/5676). diff --git a/core/Cargo.toml b/core/Cargo.toml index 162800b96c2..df07375ef8b 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-core" edition = "2021" rust-version = { workspace = true } description = "Core traits and structs of libp2p" -version = "0.42.1" +version = "0.43.0" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/examples/stream/Cargo.toml b/examples/stream/Cargo.toml index ba31d4d9e13..03d7ea425e5 100644 --- a/examples/stream/Cargo.toml +++ b/examples/stream/Cargo.toml @@ -12,7 +12,7 @@ release = false anyhow = "1" futures = { workspace = true } libp2p = { path = "../../libp2p", features = [ "tokio", "quic"] } -libp2p-stream = { path = "../../protocols/stream", version = "0.2.0-alpha" } +libp2p-stream = { path = "../../protocols/stream", version = "0.3.0-alpha" } rand = "0.8" tokio = { workspace = true, features = ["full"] } tracing = { workspace = true } diff --git a/misc/allow-block-list/CHANGELOG.md b/misc/allow-block-list/CHANGELOG.md index e7f68f6f8fe..da71a4620a3 100644 --- a/misc/allow-block-list/CHANGELOG.md +++ b/misc/allow-block-list/CHANGELOG.md @@ -1,4 +1,4 @@ -## 0.4.1 +## 0.5.0 - Add getters & setters for the allowed/blocked peers. Return a `bool` for every "insert/remove" function, informing if a change was performed. diff --git a/misc/allow-block-list/Cargo.toml b/misc/allow-block-list/Cargo.toml index c169be87056..859380a68a5 100644 --- a/misc/allow-block-list/Cargo.toml +++ b/misc/allow-block-list/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-allow-block-list" edition = "2021" rust-version = { workspace = true } description = "Allow/block list connection management for libp2p." -version = "0.4.1" +version = "0.5.0" license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" keywords = ["peer-to-peer", "libp2p", "networking"] diff --git a/misc/connection-limits/CHANGELOG.md b/misc/connection-limits/CHANGELOG.md index f2722b3745a..492b6973a04 100644 --- a/misc/connection-limits/CHANGELOG.md +++ b/misc/connection-limits/CHANGELOG.md @@ -1,4 +1,4 @@ -## 0.4.1 +## 0.5.0 - Deprecate `void` crate. See [PR 5676](https://github.com/libp2p/rust-libp2p/pull/5676). diff --git a/misc/connection-limits/Cargo.toml b/misc/connection-limits/Cargo.toml index a0ecfd9da39..21e53ff385c 100644 --- a/misc/connection-limits/Cargo.toml +++ b/misc/connection-limits/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-connection-limits" edition = "2021" rust-version = { workspace = true } description = "Connection limits for libp2p." -version = "0.4.1" +version = "0.5.0" license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" keywords = ["peer-to-peer", "libp2p", "networking"] diff --git a/misc/memory-connection-limits/CHANGELOG.md b/misc/memory-connection-limits/CHANGELOG.md index bf198e27c65..090deabcb9c 100644 --- a/misc/memory-connection-limits/CHANGELOG.md +++ b/misc/memory-connection-limits/CHANGELOG.md @@ -1,4 +1,4 @@ -## 0.3.1 +## 0.4.0 - Deprecate `void` crate. See [PR 5676](https://github.com/libp2p/rust-libp2p/pull/5676). diff --git a/misc/memory-connection-limits/Cargo.toml b/misc/memory-connection-limits/Cargo.toml index 2d04b6cf2ac..3a4dd469ddf 100644 --- a/misc/memory-connection-limits/Cargo.toml +++ b/misc/memory-connection-limits/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-memory-connection-limits" edition = "2021" rust-version = { workspace = true } description = "Memory usage based connection limits for libp2p." -version = "0.3.1" +version = "0.4.0" license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" keywords = ["peer-to-peer", "libp2p", "networking"] diff --git a/protocols/autonat/CHANGELOG.md b/protocols/autonat/CHANGELOG.md index 75a40b8c5ad..d2f4ba13a76 100644 --- a/protocols/autonat/CHANGELOG.md +++ b/protocols/autonat/CHANGELOG.md @@ -1,4 +1,4 @@ -## 0.13.1 +## 0.14.0 - Verify that an incoming AutoNAT dial comes from a connected peer. See [PR 5597](https://github.com/libp2p/rust-libp2p/pull/5597). - Deprecate `void` crate. diff --git a/protocols/autonat/Cargo.toml b/protocols/autonat/Cargo.toml index 294cdd54de4..f614db56eb1 100644 --- a/protocols/autonat/Cargo.toml +++ b/protocols/autonat/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-autonat" edition = "2021" rust-version = { workspace = true } description = "NAT and firewall detection for libp2p" -version = "0.13.1" +version = "0.14.0" authors = [ "David Craven ", "Elena Frank ", diff --git a/protocols/ping/CHANGELOG.md b/protocols/ping/CHANGELOG.md index d6e71b2c2d0..8c3e38d46a3 100644 --- a/protocols/ping/CHANGELOG.md +++ b/protocols/ping/CHANGELOG.md @@ -1,4 +1,4 @@ -## 0.45.1 +## 0.46.0 - Deprecate `void` crate. See [PR 5676](https://github.com/libp2p/rust-libp2p/pull/5676). diff --git a/protocols/ping/Cargo.toml b/protocols/ping/Cargo.toml index 83f3b6460c9..7f4d0e30983 100644 --- a/protocols/ping/Cargo.toml +++ b/protocols/ping/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-ping" edition = "2021" rust-version = { workspace = true } description = "Ping protocol for libp2p" -version = "0.45.1" +version = "0.46.0" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/protocols/request-response/CHANGELOG.md b/protocols/request-response/CHANGELOG.md index 34fc27b7432..9d0c942920b 100644 --- a/protocols/request-response/CHANGELOG.md +++ b/protocols/request-response/CHANGELOG.md @@ -1,16 +1,14 @@ ## 0.28.0 +- Deprecate `void` crate. + See [PR 5676](https://github.com/libp2p/rust-libp2p/pull/5676). + - Add connection id to the events emitted by a request-response `Behaviour`. See [PR 5719](https://github.com/libp2p/rust-libp2p/pull/5719). - Allow configurable request and response sizes for `json` and `cbor` codec. See [PR 5792](https://github.com/libp2p/rust-libp2p/pull/5792). -## 0.27.1 - -- Deprecate `void` crate. - See [PR 5676](https://github.com/libp2p/rust-libp2p/pull/5676). - ## 0.27.0 diff --git a/protocols/stream/CHANGELOG.md b/protocols/stream/CHANGELOG.md index 6034104debd..0659f2d257b 100644 --- a/protocols/stream/CHANGELOG.md +++ b/protocols/stream/CHANGELOG.md @@ -1,4 +1,4 @@ -## 0.2.0-alpha.1 +## 0.3.0-alpha - Deprecate `void` crate. See [PR 5676](https://github.com/libp2p/rust-libp2p/pull/5676). diff --git a/protocols/stream/Cargo.toml b/protocols/stream/Cargo.toml index d9c9276cb12..5750b082d28 100644 --- a/protocols/stream/Cargo.toml +++ b/protocols/stream/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "libp2p-stream" -version = "0.2.0-alpha.1" +version = "0.3.0-alpha" edition = "2021" rust-version.workspace = true description = "Generic stream protocols for libp2p" diff --git a/swarm/CHANGELOG.md b/swarm/CHANGELOG.md index 250d347430b..90ff32c5cbb 100644 --- a/swarm/CHANGELOG.md +++ b/swarm/CHANGELOG.md @@ -1,4 +1,4 @@ -## 0.45.2 +## 0.46.0 - Don't report `NewExternalAddrCandidate` for confirmed external addresses. See [PR 5582](https://github.com/libp2p/rust-libp2p/pull/5582). diff --git a/swarm/Cargo.toml b/swarm/Cargo.toml index cf027d96ec0..b3d2520f97c 100644 --- a/swarm/Cargo.toml +++ b/swarm/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-swarm" edition = "2021" rust-version = { workspace = true } description = "The libp2p swarm" -version = "0.45.2" +version = "0.46.0" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/transports/quic/CHANGELOG.md b/transports/quic/CHANGELOG.md index 238cbebe6cf..6fc64c5df36 100644 --- a/transports/quic/CHANGELOG.md +++ b/transports/quic/CHANGELOG.md @@ -1,8 +1,3 @@ -## 0.11.2 - -- Deprecate `void` crate. - See [PR 5676](https://github.com/libp2p/rust-libp2p/pull/5676). - ## 0.11.1 - Update `libp2p-tls` to version `0.5.0`, see [PR 5547] diff --git a/transports/quic/Cargo.toml b/transports/quic/Cargo.toml index ce225e21447..81088fcfd43 100644 --- a/transports/quic/Cargo.toml +++ b/transports/quic/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "libp2p-quic" -version = "0.11.2" +version = "0.11.1" authors = ["Parity Technologies "] edition = "2021" rust-version = { workspace = true } From 9d3688dbd8673119485abcd71827a10f9962093c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Tue, 14 Jan 2025 14:08:30 +0000 Subject: [PATCH 35/56] chore: prepare libp2p-webrtc-websys 0.4.0 Pull-Request: #5807. --- Cargo.lock | 2 +- Cargo.toml | 2 +- transports/webrtc-websys/CHANGELOG.md | 6 ++++-- transports/webrtc-websys/Cargo.toml | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 92c77a63044..33ed98e5fe4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3469,7 +3469,7 @@ dependencies = [ [[package]] name = "libp2p-webrtc-websys" -version = "0.4.0-alpha.2" +version = "0.4.0" dependencies = [ "bytes", "futures", diff --git a/Cargo.toml b/Cargo.toml index 16885c4eded..7a512bd4009 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -108,7 +108,7 @@ libp2p-uds = { version = "0.41.0", path = "transports/uds" } libp2p-upnp = { version = "0.3.1", path = "protocols/upnp" } libp2p-webrtc = { version = "0.8.0-alpha", path = "transports/webrtc" } libp2p-webrtc-utils = { version = "0.3.0", path = "misc/webrtc-utils" } -libp2p-webrtc-websys = { version = "0.4.0-alpha.2", path = "transports/webrtc-websys" } +libp2p-webrtc-websys = { version = "0.4.0", path = "transports/webrtc-websys" } libp2p-websocket = { version = "0.44.1", path = "transports/websocket" } libp2p-websocket-websys = { version = "0.4.1", path = "transports/websocket-websys" } libp2p-webtransport-websys = { version = "0.4.1", path = "transports/webtransport-websys" } diff --git a/transports/webrtc-websys/CHANGELOG.md b/transports/webrtc-websys/CHANGELOG.md index 5b8f2efb3b0..26bd0c85254 100644 --- a/transports/webrtc-websys/CHANGELOG.md +++ b/transports/webrtc-websys/CHANGELOG.md @@ -1,7 +1,9 @@ -## 0.4.0-alpha.2 +## 0.4.0 +- Cut stable release. + See [PR 5807](https://github.com/libp2p/rust-libp2p/pull/5807) - Bump version of web-sys and update `__Nonexhaustive` to `__Invalid`. - See [PR 5569](https://github.com/libp2p/rust-libp2p/pull/5569) + See [PR 5569](https://github.com/libp2p/rust-libp2p/pull/5569) ## 0.4.0-alpha diff --git a/transports/webrtc-websys/Cargo.toml b/transports/webrtc-websys/Cargo.toml index 6d42d74f610..47cf252393f 100644 --- a/transports/webrtc-websys/Cargo.toml +++ b/transports/webrtc-websys/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT" name = "libp2p-webrtc-websys" repository = "https://github.com/libp2p/rust-libp2p" rust-version = { workspace = true } -version = "0.4.0-alpha.2" +version = "0.4.0" publish = true [dependencies] From 9698607c72ea7b8f5e661963ab0e24384aef1e4e Mon Sep 17 00:00:00 2001 From: Elena Frank Date: Wed, 15 Jan 2025 22:41:11 +0700 Subject: [PATCH 36/56] chore(*): prepare release Bump minor version of all crates that depend on `libp2p-core`, to avoid conflicting versions or `libp2p-core` being pulled in multiple times. Pull-Request: #5813. --- Cargo.lock | 44 ++++++++++----------- Cargo.toml | 44 ++++++++++----------- libp2p/CHANGELOG.md | 2 + misc/allow-block-list/CHANGELOG.md | 2 + misc/connection-limits/CHANGELOG.md | 2 + misc/memory-connection-limits/CHANGELOG.md | 2 + misc/metrics/CHANGELOG.md | 4 ++ misc/metrics/Cargo.toml | 2 +- misc/webrtc-utils/CHANGELOG.md | 4 ++ misc/webrtc-utils/Cargo.toml | 2 +- muxers/mplex/CHANGELOG.md | 4 ++ muxers/mplex/Cargo.toml | 2 +- muxers/yamux/CHANGELOG.md | 4 ++ muxers/yamux/Cargo.toml | 2 +- protocols/autonat/CHANGELOG.md | 2 + protocols/dcutr/CHANGELOG.md | 4 +- protocols/dcutr/Cargo.toml | 2 +- protocols/floodsub/CHANGELOG.md | 4 ++ protocols/floodsub/Cargo.toml | 2 +- protocols/gossipsub/CHANGELOG.md | 2 + protocols/identify/CHANGELOG.md | 2 + protocols/kad/CHANGELOG.md | 2 + protocols/mdns/CHANGELOG.md | 4 +- protocols/mdns/Cargo.toml | 2 +- protocols/perf/CHANGELOG.md | 2 + protocols/ping/CHANGELOG.md | 2 + protocols/relay/CHANGELOG.md | 4 +- protocols/relay/Cargo.toml | 2 +- protocols/rendezvous/CHANGELOG.md | 4 +- protocols/rendezvous/Cargo.toml | 2 +- protocols/request-response/CHANGELOG.md | 2 + protocols/stream/CHANGELOG.md | 2 + protocols/upnp/CHANGELOG.md | 5 ++- protocols/upnp/Cargo.toml | 2 +- swarm/CHANGELOG.md | 2 + transports/dns/CHANGELOG.md | 4 +- transports/dns/Cargo.toml | 2 +- transports/noise/CHANGELOG.md | 4 +- transports/noise/Cargo.toml | 2 +- transports/plaintext/CHANGELOG.md | 4 ++ transports/plaintext/Cargo.toml | 2 +- transports/pnet/CHANGELOG.md | 4 ++ transports/pnet/Cargo.toml | 2 +- transports/quic/CHANGELOG.md | 4 ++ transports/quic/Cargo.toml | 2 +- transports/tcp/CHANGELOG.md | 4 +- transports/tcp/Cargo.toml | 2 +- transports/tls/CHANGELOG.md | 4 ++ transports/tls/Cargo.toml | 2 +- transports/uds/CHANGELOG.md | 4 ++ transports/uds/Cargo.toml | 2 +- transports/webrtc-websys/CHANGELOG.md | 2 + transports/webrtc/CHANGELOG.md | 4 ++ transports/webrtc/Cargo.toml | 2 +- transports/websocket-websys/CHANGELOG.md | 4 +- transports/websocket-websys/Cargo.toml | 2 +- transports/websocket/CHANGELOG.md | 4 +- transports/websocket/Cargo.toml | 2 +- transports/webtransport-websys/CHANGELOG.md | 4 +- transports/webtransport-websys/Cargo.toml | 2 +- 60 files changed, 172 insertions(+), 77 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 33ed98e5fe4..a811dcc6de9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2786,7 +2786,7 @@ dependencies = [ [[package]] name = "libp2p-dcutr" -version = "0.12.1" +version = "0.13.0" dependencies = [ "asynchronous-codec", "either", @@ -2814,7 +2814,7 @@ dependencies = [ [[package]] name = "libp2p-dns" -version = "0.42.1" +version = "0.43.0" dependencies = [ "async-std", "async-std-resolver", @@ -2832,7 +2832,7 @@ dependencies = [ [[package]] name = "libp2p-floodsub" -version = "0.45.0" +version = "0.46.0" dependencies = [ "asynchronous-codec", "bytes", @@ -2968,7 +2968,7 @@ dependencies = [ [[package]] name = "libp2p-mdns" -version = "0.46.1" +version = "0.47.0" dependencies = [ "async-io", "async-std", @@ -3004,7 +3004,7 @@ dependencies = [ [[package]] name = "libp2p-metrics" -version = "0.15.0" +version = "0.16.0" dependencies = [ "futures", "libp2p-core", @@ -3023,7 +3023,7 @@ dependencies = [ [[package]] name = "libp2p-mplex" -version = "0.42.0" +version = "0.43.0" dependencies = [ "async-std", "asynchronous-codec", @@ -3058,7 +3058,7 @@ dependencies = [ [[package]] name = "libp2p-noise" -version = "0.45.1" +version = "0.46.0" dependencies = [ "asynchronous-codec", "bytes", @@ -3126,7 +3126,7 @@ dependencies = [ [[package]] name = "libp2p-plaintext" -version = "0.42.0" +version = "0.43.0" dependencies = [ "asynchronous-codec", "bytes", @@ -3143,7 +3143,7 @@ dependencies = [ [[package]] name = "libp2p-pnet" -version = "0.25.0" +version = "0.26.0" dependencies = [ "futures", "libp2p-core", @@ -3164,7 +3164,7 @@ dependencies = [ [[package]] name = "libp2p-quic" -version = "0.11.1" +version = "0.12.0" dependencies = [ "async-std", "futures", @@ -3191,7 +3191,7 @@ dependencies = [ [[package]] name = "libp2p-relay" -version = "0.18.1" +version = "0.19.0" dependencies = [ "asynchronous-codec", "bytes", @@ -3219,7 +3219,7 @@ dependencies = [ [[package]] name = "libp2p-rendezvous" -version = "0.15.1" +version = "0.16.0" dependencies = [ "async-trait", "asynchronous-codec", @@ -3358,7 +3358,7 @@ dependencies = [ [[package]] name = "libp2p-tcp" -version = "0.42.1" +version = "0.43.0" dependencies = [ "async-io", "async-std", @@ -3375,7 +3375,7 @@ dependencies = [ [[package]] name = "libp2p-tls" -version = "0.5.0" +version = "0.6.0" dependencies = [ "futures", "futures-rustls", @@ -3396,7 +3396,7 @@ dependencies = [ [[package]] name = "libp2p-uds" -version = "0.41.0" +version = "0.42.0" dependencies = [ "async-std", "futures", @@ -3408,7 +3408,7 @@ dependencies = [ [[package]] name = "libp2p-upnp" -version = "0.3.1" +version = "0.4.0" dependencies = [ "futures", "futures-timer", @@ -3421,7 +3421,7 @@ dependencies = [ [[package]] name = "libp2p-webrtc" -version = "0.8.0-alpha" +version = "0.9.0-alpha" dependencies = [ "async-trait", "futures", @@ -3448,7 +3448,7 @@ dependencies = [ [[package]] name = "libp2p-webrtc-utils" -version = "0.3.0" +version = "0.4.0" dependencies = [ "asynchronous-codec", "bytes", @@ -3489,7 +3489,7 @@ dependencies = [ [[package]] name = "libp2p-websocket" -version = "0.44.1" +version = "0.45.0" dependencies = [ "async-std", "either", @@ -3512,7 +3512,7 @@ dependencies = [ [[package]] name = "libp2p-websocket-websys" -version = "0.4.1" +version = "0.5.0" dependencies = [ "bytes", "futures", @@ -3530,7 +3530,7 @@ dependencies = [ [[package]] name = "libp2p-webtransport-websys" -version = "0.4.1" +version = "0.5.0" dependencies = [ "futures", "js-sys", @@ -3551,7 +3551,7 @@ dependencies = [ [[package]] name = "libp2p-yamux" -version = "0.46.0" +version = "0.47.0" dependencies = [ "async-std", "either", diff --git a/Cargo.toml b/Cargo.toml index 7a512bd4009..4b92b086326 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -77,42 +77,42 @@ libp2p-allow-block-list = { version = "0.5.0", path = "misc/allow-block-list" } libp2p-autonat = { version = "0.14.0", path = "protocols/autonat" } libp2p-connection-limits = { version = "0.5.0", path = "misc/connection-limits" } libp2p-core = { version = "0.43.0", path = "core" } -libp2p-dcutr = { version = "0.12.1", path = "protocols/dcutr" } -libp2p-dns = { version = "0.42.1", path = "transports/dns" } -libp2p-floodsub = { version = "0.45.0", path = "protocols/floodsub" } +libp2p-dcutr = { version = "0.13.0", path = "protocols/dcutr" } +libp2p-dns = { version = "0.43.0", path = "transports/dns" } +libp2p-floodsub = { version = "0.46.0", path = "protocols/floodsub" } libp2p-gossipsub = { version = "0.48.0", path = "protocols/gossipsub" } libp2p-identify = { version = "0.46.0", path = "protocols/identify" } libp2p-identity = { version = "0.2.10" } libp2p-kad = { version = "0.47.0", path = "protocols/kad" } -libp2p-mdns = { version = "0.46.1", path = "protocols/mdns" } +libp2p-mdns = { version = "0.47.0", path = "protocols/mdns" } libp2p-memory-connection-limits = { version = "0.4.0", path = "misc/memory-connection-limits" } -libp2p-metrics = { version = "0.15.0", path = "misc/metrics" } -libp2p-mplex = { version = "0.42.0", path = "muxers/mplex" } -libp2p-noise = { version = "0.45.1", path = "transports/noise" } +libp2p-metrics = { version = "0.16.0", path = "misc/metrics" } +libp2p-mplex = { version = "0.43.0", path = "muxers/mplex" } +libp2p-noise = { version = "0.46.0", path = "transports/noise" } libp2p-perf = { version = "0.4.0", path = "protocols/perf" } libp2p-ping = { version = "0.46.0", path = "protocols/ping" } -libp2p-plaintext = { version = "0.42.0", path = "transports/plaintext" } -libp2p-pnet = { version = "0.25.0", path = "transports/pnet" } -libp2p-quic = { version = "0.11.1", path = "transports/quic" } -libp2p-relay = { version = "0.18.1", path = "protocols/relay" } -libp2p-rendezvous = { version = "0.15.1", path = "protocols/rendezvous" } +libp2p-plaintext = { version = "0.43.0", path = "transports/plaintext" } +libp2p-pnet = { version = "0.26.0", path = "transports/pnet" } +libp2p-quic = { version = "0.12.0", path = "transports/quic" } +libp2p-relay = { version = "0.19.0", path = "protocols/relay" } +libp2p-rendezvous = { version = "0.16.0", path = "protocols/rendezvous" } libp2p-request-response = { version = "0.28.0", path = "protocols/request-response" } libp2p-server = { version = "0.12.6", path = "misc/server" } libp2p-stream = { version = "0.3.0-alpha", path = "protocols/stream" } libp2p-swarm = { version = "0.46.0", path = "swarm" } libp2p-swarm-derive = { version = "=0.35.0", path = "swarm-derive" } # `libp2p-swarm-derive` may not be compatible with different `libp2p-swarm` non-breaking releases. E.g. `libp2p-swarm` might introduce a new enum variant `FromSwarm` (which is `#[non-exhaustive]`) in a non-breaking release. Older versions of `libp2p-swarm-derive` would not forward this enum variant within the `NetworkBehaviour` hierarchy. Thus the version pinning is required. libp2p-swarm-test = { version = "0.5.0", path = "swarm-test" } -libp2p-tcp = { version = "0.42.1", path = "transports/tcp" } -libp2p-tls = { version = "0.5.0", path = "transports/tls" } -libp2p-uds = { version = "0.41.0", path = "transports/uds" } -libp2p-upnp = { version = "0.3.1", path = "protocols/upnp" } -libp2p-webrtc = { version = "0.8.0-alpha", path = "transports/webrtc" } -libp2p-webrtc-utils = { version = "0.3.0", path = "misc/webrtc-utils" } +libp2p-tcp = { version = "0.43.0", path = "transports/tcp" } +libp2p-tls = { version = "0.6.0", path = "transports/tls" } +libp2p-uds = { version = "0.42.0", path = "transports/uds" } +libp2p-upnp = { version = "0.4.0", path = "protocols/upnp" } +libp2p-webrtc = { version = "0.9.0-alpha", path = "transports/webrtc" } +libp2p-webrtc-utils = { version = "0.4.0", path = "misc/webrtc-utils" } libp2p-webrtc-websys = { version = "0.4.0", path = "transports/webrtc-websys" } -libp2p-websocket = { version = "0.44.1", path = "transports/websocket" } -libp2p-websocket-websys = { version = "0.4.1", path = "transports/websocket-websys" } -libp2p-webtransport-websys = { version = "0.4.1", path = "transports/webtransport-websys" } -libp2p-yamux = { version = "0.46.0", path = "muxers/yamux" } +libp2p-websocket = { version = "0.45.0", path = "transports/websocket" } +libp2p-websocket-websys = { version = "0.5.0", path = "transports/websocket-websys" } +libp2p-webtransport-websys = { version = "0.5.0", path = "transports/webtransport-websys" } +libp2p-yamux = { version = "0.47.0", path = "muxers/yamux" } # External dependencies async-std-resolver = { version = "0.25.0-alpha.4", default-features = false } diff --git a/libp2p/CHANGELOG.md b/libp2p/CHANGELOG.md index 59bf2e81383..91f1b5628f8 100644 --- a/libp2p/CHANGELOG.md +++ b/libp2p/CHANGELOG.md @@ -22,6 +22,8 @@ additional data inside `ConnectionHandler` after negotiation. See [PR 5242](https://github.com/libp2p/rust-libp2p/pull/5242). + + ## 0.54.1 - Update individual crates. diff --git a/misc/allow-block-list/CHANGELOG.md b/misc/allow-block-list/CHANGELOG.md index da71a4620a3..be7619269d0 100644 --- a/misc/allow-block-list/CHANGELOG.md +++ b/misc/allow-block-list/CHANGELOG.md @@ -6,6 +6,8 @@ - Deprecate `void` crate. See [PR 5676](https://github.com/libp2p/rust-libp2p/pull/5676). + + ## 0.4.0 diff --git a/misc/connection-limits/CHANGELOG.md b/misc/connection-limits/CHANGELOG.md index 492b6973a04..a84ff4deb32 100644 --- a/misc/connection-limits/CHANGELOG.md +++ b/misc/connection-limits/CHANGELOG.md @@ -3,6 +3,8 @@ - Deprecate `void` crate. See [PR 5676](https://github.com/libp2p/rust-libp2p/pull/5676). + + ## 0.4.0 diff --git a/misc/memory-connection-limits/CHANGELOG.md b/misc/memory-connection-limits/CHANGELOG.md index 090deabcb9c..ed16fa37eb3 100644 --- a/misc/memory-connection-limits/CHANGELOG.md +++ b/misc/memory-connection-limits/CHANGELOG.md @@ -3,6 +3,8 @@ - Deprecate `void` crate. See [PR 5676](https://github.com/libp2p/rust-libp2p/pull/5676). + + ## 0.3.0 diff --git a/misc/metrics/CHANGELOG.md b/misc/metrics/CHANGELOG.md index bd109c42811..fa57d50fa7a 100644 --- a/misc/metrics/CHANGELOG.md +++ b/misc/metrics/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.16.0 + + + ## 0.15.0 - Use `web-time` instead of `instant`. See [PR 5347](https://github.com/libp2p/rust-libp2p/pull/5347). diff --git a/misc/metrics/Cargo.toml b/misc/metrics/Cargo.toml index 0b7a3c93b2f..97cc581c671 100644 --- a/misc/metrics/Cargo.toml +++ b/misc/metrics/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-metrics" edition = "2021" rust-version = { workspace = true } description = "Metrics for libp2p" -version = "0.15.0" +version = "0.16.0" authors = ["Max Inden "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/misc/webrtc-utils/CHANGELOG.md b/misc/webrtc-utils/CHANGELOG.md index 3bb31610fa1..992f8354bba 100644 --- a/misc/webrtc-utils/CHANGELOG.md +++ b/misc/webrtc-utils/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.4.0 + + + ## 0.3.0 diff --git a/misc/webrtc-utils/Cargo.toml b/misc/webrtc-utils/Cargo.toml index 2c50a2f8ab7..bfcad64d08f 100644 --- a/misc/webrtc-utils/Cargo.toml +++ b/misc/webrtc-utils/Cargo.toml @@ -7,7 +7,7 @@ license = "MIT" name = "libp2p-webrtc-utils" repository = "https://github.com/libp2p/rust-libp2p" rust-version = { workspace = true } -version = "0.3.0" +version = "0.4.0" publish = true [dependencies] diff --git a/muxers/mplex/CHANGELOG.md b/muxers/mplex/CHANGELOG.md index f0c2c0353da..651a4d6182e 100644 --- a/muxers/mplex/CHANGELOG.md +++ b/muxers/mplex/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.43.0 + + + ## 0.42.0 diff --git a/muxers/mplex/Cargo.toml b/muxers/mplex/Cargo.toml index 7f887c8b3b8..2bd6a49bbc8 100644 --- a/muxers/mplex/Cargo.toml +++ b/muxers/mplex/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-mplex" edition = "2021" rust-version = { workspace = true } description = "Mplex multiplexing protocol for libp2p" -version = "0.42.0" +version = "0.43.0" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/muxers/yamux/CHANGELOG.md b/muxers/yamux/CHANGELOG.md index 855b3a33773..ace4c864f63 100644 --- a/muxers/yamux/CHANGELOG.md +++ b/muxers/yamux/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.47.0 + + + ## 0.46.0 diff --git a/muxers/yamux/Cargo.toml b/muxers/yamux/Cargo.toml index cd3f8347bd0..98beb55982c 100644 --- a/muxers/yamux/Cargo.toml +++ b/muxers/yamux/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-yamux" edition = "2021" rust-version = { workspace = true } description = "Yamux multiplexing protocol for libp2p" -version = "0.46.0" +version = "0.47.0" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/protocols/autonat/CHANGELOG.md b/protocols/autonat/CHANGELOG.md index d2f4ba13a76..e80dc4df437 100644 --- a/protocols/autonat/CHANGELOG.md +++ b/protocols/autonat/CHANGELOG.md @@ -5,6 +5,8 @@ See [PR 5676](https://github.com/libp2p/rust-libp2p/pull/5676). - Update to `libp2p-request-response` `v0.28.0`. + + ## 0.13.0 - Due to the refactor of `Transport` it's no longer required to create a seperate transport for diff --git a/protocols/dcutr/CHANGELOG.md b/protocols/dcutr/CHANGELOG.md index 80cac37321e..7fb02fabcbd 100644 --- a/protocols/dcutr/CHANGELOG.md +++ b/protocols/dcutr/CHANGELOG.md @@ -1,8 +1,10 @@ -## 0.12.1 +## 0.13.0 - Deprecate `void` crate. See [PR 5676](https://github.com/libp2p/rust-libp2p/pull/5676). + + ## 0.12.0 diff --git a/protocols/dcutr/Cargo.toml b/protocols/dcutr/Cargo.toml index 31acb42f2af..be02e890e7a 100644 --- a/protocols/dcutr/Cargo.toml +++ b/protocols/dcutr/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-dcutr" edition = "2021" rust-version = { workspace = true } description = "Direct connection upgrade through relay" -version = "0.12.1" +version = "0.13.0" authors = ["Max Inden "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/protocols/floodsub/CHANGELOG.md b/protocols/floodsub/CHANGELOG.md index 4192e0ea58d..65e1ee8251a 100644 --- a/protocols/floodsub/CHANGELOG.md +++ b/protocols/floodsub/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.46.0 + + + ## 0.45.0 diff --git a/protocols/floodsub/Cargo.toml b/protocols/floodsub/Cargo.toml index dcfde6383cc..15652bd46c0 100644 --- a/protocols/floodsub/Cargo.toml +++ b/protocols/floodsub/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-floodsub" edition = "2021" rust-version = { workspace = true } description = "Floodsub protocol for libp2p" -version = "0.45.0" +version = "0.46.0" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/protocols/gossipsub/CHANGELOG.md b/protocols/gossipsub/CHANGELOG.md index 94b9b922973..10a225a92fd 100644 --- a/protocols/gossipsub/CHANGELOG.md +++ b/protocols/gossipsub/CHANGELOG.md @@ -38,6 +38,8 @@ - Fixe an issue where an `InsufficientPeers` error could occur under certain conditions, despite having peers subscribed to a topic. See [PR 5793](https://github.com/libp2p/rust-libp2p/pull/5793). + + ## 0.47.0 diff --git a/protocols/identify/CHANGELOG.md b/protocols/identify/CHANGELOG.md index 66c839dfa98..708490db3fe 100644 --- a/protocols/identify/CHANGELOG.md +++ b/protocols/identify/CHANGELOG.md @@ -7,6 +7,8 @@ - Discard `Info`s received from remote peers that contain a public key that doesn't match their peer ID. See [PR 5707](https://github.com/libp2p/rust-libp2p/pull/5707). + + ## 0.45.0 - Address translation is moved here from `libp2p-core`. diff --git a/protocols/kad/CHANGELOG.md b/protocols/kad/CHANGELOG.md index 0c6e460afcd..57e7d6dabef 100644 --- a/protocols/kad/CHANGELOG.md +++ b/protocols/kad/CHANGELOG.md @@ -15,6 +15,8 @@ - Remove deprecated default constructor for `ProtocolConfig`. See [PR 5774](https://github.com/libp2p/rust-libp2p/pull/5774). + + ## 0.46.2 - Emit `ToSwarm::NewExternalAddrOfPeer`. diff --git a/protocols/mdns/CHANGELOG.md b/protocols/mdns/CHANGELOG.md index 45a479bf4af..32b9359809d 100644 --- a/protocols/mdns/CHANGELOG.md +++ b/protocols/mdns/CHANGELOG.md @@ -1,10 +1,12 @@ -## 0.46.1 +## 0.47.0 - Emit `ToSwarm::NewExternalAddrOfPeer` on discovery. See [PR 5753](https://github.com/libp2p/rust-libp2p/pull/5753) - Upgrade `hickory-proto`. See [PR 5727](https://github.com/libp2p/rust-libp2p/pull/5727) + + ## 0.46.0 diff --git a/protocols/mdns/Cargo.toml b/protocols/mdns/Cargo.toml index 84acc0592d7..e6b3131c412 100644 --- a/protocols/mdns/Cargo.toml +++ b/protocols/mdns/Cargo.toml @@ -2,7 +2,7 @@ name = "libp2p-mdns" edition = "2021" rust-version = { workspace = true } -version = "0.46.1" +version = "0.47.0" description = "Implementation of the libp2p mDNS discovery method" authors = ["Parity Technologies "] license = "MIT" diff --git a/protocols/perf/CHANGELOG.md b/protocols/perf/CHANGELOG.md index c5eda88d97d..52318bbeb28 100644 --- a/protocols/perf/CHANGELOG.md +++ b/protocols/perf/CHANGELOG.md @@ -7,6 +7,8 @@ - Deprecate `void` crate. See [PR 5676](https://github.com/libp2p/rust-libp2p/pull/5676). + + ## 0.3.1 - Use `web-time` instead of `instant`. See [PR 5347](https://github.com/libp2p/rust-libp2p/pull/5347). diff --git a/protocols/ping/CHANGELOG.md b/protocols/ping/CHANGELOG.md index 8c3e38d46a3..eb283fab625 100644 --- a/protocols/ping/CHANGELOG.md +++ b/protocols/ping/CHANGELOG.md @@ -3,6 +3,8 @@ - Deprecate `void` crate. See [PR 5676](https://github.com/libp2p/rust-libp2p/pull/5676). + + ## 0.45.0 diff --git a/protocols/relay/CHANGELOG.md b/protocols/relay/CHANGELOG.md index 8119c24a491..e60dcfb7596 100644 --- a/protocols/relay/CHANGELOG.md +++ b/protocols/relay/CHANGELOG.md @@ -1,8 +1,10 @@ -## 0.18.1 +## 0.19.0 - Deprecate `void` crate. See [PR 5676](https://github.com/libp2p/rust-libp2p/pull/5676). + + ## 0.18.0 diff --git a/protocols/relay/Cargo.toml b/protocols/relay/Cargo.toml index 6c2c7b90304..23715fc86de 100644 --- a/protocols/relay/Cargo.toml +++ b/protocols/relay/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-relay" edition = "2021" rust-version = { workspace = true } description = "Communications relaying for libp2p" -version = "0.18.1" +version = "0.19.0" authors = ["Parity Technologies ", "Max Inden "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/protocols/rendezvous/CHANGELOG.md b/protocols/rendezvous/CHANGELOG.md index ca01538a76d..3bd2e469903 100644 --- a/protocols/rendezvous/CHANGELOG.md +++ b/protocols/rendezvous/CHANGELOG.md @@ -1,7 +1,9 @@ -## 0.15.1 +## 0.16.0 - Update to `libp2p-request-response` `v0.28.0`. + + ## 0.15.0 diff --git a/protocols/rendezvous/Cargo.toml b/protocols/rendezvous/Cargo.toml index 9521913cd30..3864c817b9f 100644 --- a/protocols/rendezvous/Cargo.toml +++ b/protocols/rendezvous/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-rendezvous" edition = "2021" rust-version = { workspace = true } description = "Rendezvous protocol for libp2p" -version = "0.15.1" +version = "0.16.0" authors = ["The COMIT guys "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/protocols/request-response/CHANGELOG.md b/protocols/request-response/CHANGELOG.md index 9d0c942920b..c2ef19dbda2 100644 --- a/protocols/request-response/CHANGELOG.md +++ b/protocols/request-response/CHANGELOG.md @@ -9,6 +9,8 @@ - Allow configurable request and response sizes for `json` and `cbor` codec. See [PR 5792](https://github.com/libp2p/rust-libp2p/pull/5792). + + ## 0.27.0 diff --git a/protocols/stream/CHANGELOG.md b/protocols/stream/CHANGELOG.md index 0659f2d257b..2ad563b76ab 100644 --- a/protocols/stream/CHANGELOG.md +++ b/protocols/stream/CHANGELOG.md @@ -3,6 +3,8 @@ - Deprecate `void` crate. See [PR 5676](https://github.com/libp2p/rust-libp2p/pull/5676). + + ## 0.2.0-alpha diff --git a/protocols/upnp/CHANGELOG.md b/protocols/upnp/CHANGELOG.md index d9c24f8efcc..89a0752d724 100644 --- a/protocols/upnp/CHANGELOG.md +++ b/protocols/upnp/CHANGELOG.md @@ -1,7 +1,10 @@ -## 0.3.1 +## 0.4.0 + - update igd-next to 0.15.1. See [PR XXXX](https://github.com/libp2p/rust-libp2p/pull/XXXX). + + ## 0.3.0 diff --git a/protocols/upnp/Cargo.toml b/protocols/upnp/Cargo.toml index a069331b1ed..4d97bd56bfa 100644 --- a/protocols/upnp/Cargo.toml +++ b/protocols/upnp/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-upnp" edition = "2021" rust-version = "1.60.0" description = "UPnP support for libp2p transports" -version = "0.3.1" +version = "0.4.0" license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" keywords = ["peer-to-peer", "libp2p", "networking"] diff --git a/swarm/CHANGELOG.md b/swarm/CHANGELOG.md index 90ff32c5cbb..624450ab8dd 100644 --- a/swarm/CHANGELOG.md +++ b/swarm/CHANGELOG.md @@ -19,6 +19,8 @@ additional data inside `ConnectionHandler` after negotiation. See [PR 5242](https://github.com/libp2p/rust-libp2p/pull/5242). + + ## 0.45.1 - Update `libp2p-swarm-derive` to version `0.35.0`, see [PR 5545] diff --git a/transports/dns/CHANGELOG.md b/transports/dns/CHANGELOG.md index b46b0413403..6fdaa06be2f 100644 --- a/transports/dns/CHANGELOG.md +++ b/transports/dns/CHANGELOG.md @@ -1,8 +1,10 @@ -## 0.42.1 +## 0.43.0 - Upgrade `async-std-resolver` and `hickory-resolver`. See [PR 5727](https://github.com/libp2p/rust-libp2p/pull/5727) + + ## 0.42.0 - Implement refactored `Transport`. diff --git a/transports/dns/Cargo.toml b/transports/dns/Cargo.toml index 2a12c34a383..ee497d5917f 100644 --- a/transports/dns/Cargo.toml +++ b/transports/dns/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-dns" edition = "2021" rust-version = { workspace = true } description = "DNS transport implementation for libp2p" -version = "0.42.1" +version = "0.43.0" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/transports/noise/CHANGELOG.md b/transports/noise/CHANGELOG.md index cda7132cb28..0ed27e31bee 100644 --- a/transports/noise/CHANGELOG.md +++ b/transports/noise/CHANGELOG.md @@ -1,8 +1,10 @@ -## 0.45.1 +## 0.46.0 - Fix `cargo clippy` warnings in `rustc 1.84.0-beta.1`. See [PR 5700](https://github.com/libp2p/rust-libp2p/pull/5700). + + ## 0.45.0 diff --git a/transports/noise/Cargo.toml b/transports/noise/Cargo.toml index d0e2f9004ce..58fddd0cc7f 100644 --- a/transports/noise/Cargo.toml +++ b/transports/noise/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-noise" edition = "2021" rust-version = { workspace = true } description = "Cryptographic handshake protocol using the noise framework." -version = "0.45.1" +version = "0.46.0" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/transports/plaintext/CHANGELOG.md b/transports/plaintext/CHANGELOG.md index 91860c76590..74b11942afe 100644 --- a/transports/plaintext/CHANGELOG.md +++ b/transports/plaintext/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.43.0 + + + ## 0.42.0 diff --git a/transports/plaintext/Cargo.toml b/transports/plaintext/Cargo.toml index 9e1e5449158..d84b2b6eede 100644 --- a/transports/plaintext/Cargo.toml +++ b/transports/plaintext/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-plaintext" edition = "2021" rust-version = { workspace = true } description = "Plaintext encryption dummy protocol for libp2p" -version = "0.42.0" +version = "0.43.0" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/transports/pnet/CHANGELOG.md b/transports/pnet/CHANGELOG.md index 86d519e8640..901169837e6 100644 --- a/transports/pnet/CHANGELOG.md +++ b/transports/pnet/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.26.0 + + + ## 0.25.0 diff --git a/transports/pnet/Cargo.toml b/transports/pnet/Cargo.toml index db5c72fb7cc..91592f6de74 100644 --- a/transports/pnet/Cargo.toml +++ b/transports/pnet/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-pnet" edition = "2021" rust-version = { workspace = true } description = "Private swarm support for libp2p" -version = "0.25.0" +version = "0.26.0" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/transports/quic/CHANGELOG.md b/transports/quic/CHANGELOG.md index 6fc64c5df36..6e45e002de2 100644 --- a/transports/quic/CHANGELOG.md +++ b/transports/quic/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.12.0 + + + ## 0.11.1 - Update `libp2p-tls` to version `0.5.0`, see [PR 5547] diff --git a/transports/quic/Cargo.toml b/transports/quic/Cargo.toml index 81088fcfd43..8c416858c91 100644 --- a/transports/quic/Cargo.toml +++ b/transports/quic/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "libp2p-quic" -version = "0.11.1" +version = "0.12.0" authors = ["Parity Technologies "] edition = "2021" rust-version = { workspace = true } diff --git a/transports/tcp/CHANGELOG.md b/transports/tcp/CHANGELOG.md index 6d9c51b45be..3c4b0bc946d 100644 --- a/transports/tcp/CHANGELOG.md +++ b/transports/tcp/CHANGELOG.md @@ -1,8 +1,10 @@ -## 0.42.1 +## 0.43.0 - Fix the disabling of Nagle's algorithm, which requires setting `TCP_NODELAY` to _true_. See [PR 5764](https://github.com/libp2p/rust-libp2p/pull/5764) + + ## 0.42.0 - Implement refactored `Transport`. diff --git a/transports/tcp/Cargo.toml b/transports/tcp/Cargo.toml index e74fdda5d63..cc1b0d2fce5 100644 --- a/transports/tcp/Cargo.toml +++ b/transports/tcp/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-tcp" edition = "2021" rust-version = { workspace = true } description = "TCP/IP transport protocol for libp2p" -version = "0.42.1" +version = "0.43.0" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/transports/tls/CHANGELOG.md b/transports/tls/CHANGELOG.md index e27b8b4cf1f..698cd3a770b 100644 --- a/transports/tls/CHANGELOG.md +++ b/transports/tls/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.6.0 + + + ## 0.5.0 diff --git a/transports/tls/Cargo.toml b/transports/tls/Cargo.toml index 7702a4361b1..cdde26ad6a9 100644 --- a/transports/tls/Cargo.toml +++ b/transports/tls/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "libp2p-tls" -version = "0.5.0" +version = "0.6.0" edition = "2021" rust-version = { workspace = true } description = "TLS configuration based on libp2p TLS specs." diff --git a/transports/uds/CHANGELOG.md b/transports/uds/CHANGELOG.md index aa068fe3877..44328e019a6 100644 --- a/transports/uds/CHANGELOG.md +++ b/transports/uds/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.42.0 + + + ## 0.41.0 - Implement refactored `Transport`. diff --git a/transports/uds/Cargo.toml b/transports/uds/Cargo.toml index f70ac388fa8..a3e29f380cd 100644 --- a/transports/uds/Cargo.toml +++ b/transports/uds/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-uds" edition = "2021" rust-version = { workspace = true } description = "Unix domain sockets transport for libp2p" -version = "0.41.0" +version = "0.42.0" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/transports/webrtc-websys/CHANGELOG.md b/transports/webrtc-websys/CHANGELOG.md index 26bd0c85254..5a550a5e8b1 100644 --- a/transports/webrtc-websys/CHANGELOG.md +++ b/transports/webrtc-websys/CHANGELOG.md @@ -5,6 +5,8 @@ - Bump version of web-sys and update `__Nonexhaustive` to `__Invalid`. See [PR 5569](https://github.com/libp2p/rust-libp2p/pull/5569) + + ## 0.4.0-alpha - Implement refactored `Transport`. diff --git a/transports/webrtc/CHANGELOG.md b/transports/webrtc/CHANGELOG.md index 90d4ce83df3..dc8070df70a 100644 --- a/transports/webrtc/CHANGELOG.md +++ b/transports/webrtc/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.9.0-alpha + + + ## 0.8.0-alpha - Implement refactored `Transport`. diff --git a/transports/webrtc/Cargo.toml b/transports/webrtc/Cargo.toml index 44c5fbbe192..7c2ebb8ef62 100644 --- a/transports/webrtc/Cargo.toml +++ b/transports/webrtc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "libp2p-webrtc" -version = "0.8.0-alpha" +version = "0.9.0-alpha" authors = ["Parity Technologies "] description = "WebRTC transport for libp2p" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/transports/websocket-websys/CHANGELOG.md b/transports/websocket-websys/CHANGELOG.md index affe9ff2551..d1144135e64 100644 --- a/transports/websocket-websys/CHANGELOG.md +++ b/transports/websocket-websys/CHANGELOG.md @@ -1,4 +1,4 @@ -## 0.4.1 +## 0.5.0 - fix: Return `None` when extracting a `/dnsaddr` address See [PR 5613](https://github.com/libp2p/rust-libp2p/pull/5613) @@ -6,6 +6,8 @@ - Fix `cargo clippy` warnings in `rustc 1.84.0-beta.1`. See [PR 5700](https://github.com/libp2p/rust-libp2p/pull/5700). + + ## 0.4.0 - Implement refactored `Transport`. diff --git a/transports/websocket-websys/Cargo.toml b/transports/websocket-websys/Cargo.toml index f33703c1884..cbc2330d2b7 100644 --- a/transports/websocket-websys/Cargo.toml +++ b/transports/websocket-websys/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-websocket-websys" edition = "2021" rust-version = "1.60.0" description = "WebSocket for libp2p under WASM environment" -version = "0.4.1" +version = "0.5.0" authors = ["Vince Vasta "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/transports/websocket/CHANGELOG.md b/transports/websocket/CHANGELOG.md index 1a8e9569c06..6b12e3a786a 100644 --- a/transports/websocket/CHANGELOG.md +++ b/transports/websocket/CHANGELOG.md @@ -1,8 +1,10 @@ -## 0.44.1 +## 0.45.0 - fix: Return `Error::InvalidMultiaddr` when dialed to a `/dnsaddr` address See [PR 5613](https://github.com/libp2p/rust-libp2p/pull/5613) + + ## 0.44.0 - Implement refactored `Transport`. diff --git a/transports/websocket/Cargo.toml b/transports/websocket/Cargo.toml index 5c9734e420a..69a4f3bb83a 100644 --- a/transports/websocket/Cargo.toml +++ b/transports/websocket/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-websocket" edition = "2021" rust-version = { workspace = true } description = "WebSocket transport for libp2p" -version = "0.44.1" +version = "0.45.0" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/transports/webtransport-websys/CHANGELOG.md b/transports/webtransport-websys/CHANGELOG.md index 45a94495e4e..a09c10bee6f 100644 --- a/transports/webtransport-websys/CHANGELOG.md +++ b/transports/webtransport-websys/CHANGELOG.md @@ -1,8 +1,10 @@ -## 0.4.1 +## 0.5.0 - Fix `cargo clippy` warnings in `rustc 1.84.0-beta.1`. See [PR 5700](https://github.com/libp2p/rust-libp2p/pull/5700). + + ## 0.4.0 - Implement refactored `Transport`. diff --git a/transports/webtransport-websys/Cargo.toml b/transports/webtransport-websys/Cargo.toml index ef2865535bf..e455cd9b08e 100644 --- a/transports/webtransport-websys/Cargo.toml +++ b/transports/webtransport-websys/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-webtransport-websys" edition = "2021" rust-version = { workspace = true } description = "WebTransport for libp2p under WASM environment" -version = "0.4.1" +version = "0.5.0" authors = [ "Yiannis Marangos ", "oblique ", From 7c36d30d26b34bb03ed50cd2c408f0013cb127e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Thu, 16 Jan 2025 11:21:24 +0000 Subject: [PATCH 37/56] chore(ci): fix workspace version enforcing job Cue due to an [update](https://crates.io/crates/tomlq/0.2.0) to the `tomlq` tool, there's now a mismatch between the `$CRATE_VERSION` and the `$SPECIFIED_VERSION` variables: ```bash Package version: 0.43.0 Specified version: "0.43.0" ``` This PR attempts to fix the "Enforce version in `workspace.dependencies` matches the latest version" job by locking to the previous version until (and if) the situation is solved. Also see https://github.com/cryptaliagy/tomlq/issues/22 Pull-Request: #5817. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2519f7e45f8..4b46a1878fc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,7 +59,7 @@ jobs: - uses: taiki-e/cache-cargo-install-action@v2 with: - tool: tomlq + tool: tomlq@0.1.6 - name: Extract version from manifest run: | From cc8607ce3ec494e86073c4abd6d2491280bb55d0 Mon Sep 17 00:00:00 2001 From: DrHuangMHT Date: Thu, 16 Jan 2025 23:43:11 +0800 Subject: [PATCH 38/56] refactor(gossipsub): remove duplicated call to `inbound_transform` May close #4369. Pull-Request: #5767. --- protocols/gossipsub/src/behaviour.rs | 59 +++++++++++++--------------- 1 file changed, 27 insertions(+), 32 deletions(-) diff --git a/protocols/gossipsub/src/behaviour.rs b/protocols/gossipsub/src/behaviour.rs index 356f1d6cd77..b803337462d 100644 --- a/protocols/gossipsub/src/behaviour.rs +++ b/protocols/gossipsub/src/behaviour.rs @@ -1684,7 +1684,8 @@ where ); self.handle_invalid_message( propagation_source, - raw_message, + &raw_message.topic, + Some(msg_id), RejectReason::BlackListedSource, ); return false; @@ -1713,7 +1714,12 @@ where source=%propagation_source, "Dropping message claiming to be from self but forwarded from source" ); - self.handle_invalid_message(propagation_source, raw_message, RejectReason::SelfOrigin); + self.handle_invalid_message( + propagation_source, + &raw_message.topic, + Some(msg_id), + RejectReason::SelfOrigin, + ); return false; } @@ -1741,7 +1747,8 @@ where // Reject the message and return self.handle_invalid_message( propagation_source, - &raw_message, + &raw_message.topic, + None, RejectReason::ValidationError(ValidationError::TransformFailed), ); return; @@ -1827,42 +1834,29 @@ where fn handle_invalid_message( &mut self, propagation_source: &PeerId, - raw_message: &RawMessage, + topic_hash: &TopicHash, + message_id: Option<&MessageId>, reject_reason: RejectReason, ) { if let Some(metrics) = self.metrics.as_mut() { - metrics.register_invalid_message(&raw_message.topic); + metrics.register_invalid_message(topic_hash); } - - let message = self.data_transform.inbound_transform(raw_message.clone()); - - match (&mut self.peer_score, message) { - (Some((peer_score, ..)), Ok(message)) => { - let message_id = self.config.message_id(&message); - - peer_score.reject_message( - propagation_source, - &message_id, - &message.topic, - reject_reason, - ); - - self.gossip_promises - .reject_message(&message_id, &reject_reason); - } - (Some((peer_score, ..)), Err(_)) => { + if let Some(msg_id) = message_id { + // Valid transformation without peer scoring + self.gossip_promises.reject_message(msg_id, &reject_reason); + } + if let Some((peer_score, ..)) = &mut self.peer_score { + // The compiler will optimize this pattern-matching + if let Some(msg_id) = message_id { + // The message itself is valid, but is from a banned peer or + // claiming to be self-origin but is actually forwarded from other peers. + peer_score.reject_message(propagation_source, msg_id, topic_hash, reject_reason); + } else { // The message is invalid, we reject it ignoring any gossip promises. If a peer is // advertising this message via an IHAVE and it's invalid it will be double // penalized, one for sending us an invalid and again for breaking a promise. - peer_score.reject_invalid_message(propagation_source, &raw_message.topic); - } - (None, Ok(message)) => { - // Valid transformation without peer scoring - let message_id = self.config.message_id(&message); - self.gossip_promises - .reject_message(&message_id, &reject_reason); + peer_score.reject_invalid_message(propagation_source, topic_hash); } - (None, Err(_)) => {} } } @@ -3231,7 +3225,8 @@ where for (raw_message, validation_error) in invalid_messages { self.handle_invalid_message( &propagation_source, - &raw_message, + &raw_message.topic, + None, RejectReason::ValidationError(validation_error), ) } From 0b44564bb031a60a360ccc020676d74c784cca11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Tue, 21 Jan 2025 14:32:31 +0000 Subject: [PATCH 39/56] chore(ci): update tomlq and address the version lock introduced on #5817 Pull-Request: #5821. --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4b46a1878fc..b05a1be0182 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,7 +59,7 @@ jobs: - uses: taiki-e/cache-cargo-install-action@v2 with: - tool: tomlq@0.1.6 + tool: tomlq - name: Extract version from manifest run: | @@ -70,7 +70,7 @@ jobs: - name: Enforce version in `workspace.dependencies` matches the latest version if: env.CRATE != 'libp2p' run: | - SPECIFIED_VERSION=$(tq "workspace.dependencies.$CRATE.version" --file ./Cargo.toml) + SPECIFIED_VERSION=$(tq "workspace.dependencies.$CRATE.version" -r --file ./Cargo.toml) echo "Package version: $CRATE_VERSION"; echo "Specified version: $SPECIFIED_VERSION"; From 68ea5b7a815805fa90b31d17cb0c87ec750345c4 Mon Sep 17 00:00:00 2001 From: Elena Frank Date: Mon, 27 Jan 2025 18:33:53 +0700 Subject: [PATCH 40/56] fix(relay/client): only try to forward handler events once We currently try to forward pending handler events in the relay client behavior twice: in `handle_established_{in, out}bound_connection` and in `on_swarm_event()` (introduced in #3328). This is redundant because by the second time we try to forward it there won't be any pending event anymore. This PR removes the duplicated logic from `on_swarm_event`. Forwarding it in `handle_established_{in, out}bound_connection` is more convenient as we still have direct access to the handler there and don't need to go through the swarm. However, it requires that in `handle_established_{in, out}bound_connection` the event is also removed when the connection is relayed, in which case the event is simply discarded because the commands are only valid on direct connections. Pull-Request: #5765. --- Cargo.lock | 2 +- Cargo.toml | 2 +- protocols/relay/CHANGELOG.md | 4 ++++ protocols/relay/Cargo.toml | 2 +- protocols/relay/src/priv_client.rs | 28 +++++++++++----------------- 5 files changed, 18 insertions(+), 20 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a811dcc6de9..f5ebfaeb1f9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3191,7 +3191,7 @@ dependencies = [ [[package]] name = "libp2p-relay" -version = "0.19.0" +version = "0.19.1" dependencies = [ "asynchronous-codec", "bytes", diff --git a/Cargo.toml b/Cargo.toml index 4b92b086326..72373a564a1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -94,7 +94,7 @@ libp2p-ping = { version = "0.46.0", path = "protocols/ping" } libp2p-plaintext = { version = "0.43.0", path = "transports/plaintext" } libp2p-pnet = { version = "0.26.0", path = "transports/pnet" } libp2p-quic = { version = "0.12.0", path = "transports/quic" } -libp2p-relay = { version = "0.19.0", path = "protocols/relay" } +libp2p-relay = { version = "0.19.1", path = "protocols/relay" } libp2p-rendezvous = { version = "0.16.0", path = "protocols/rendezvous" } libp2p-request-response = { version = "0.28.0", path = "protocols/request-response" } libp2p-server = { version = "0.12.6", path = "misc/server" } diff --git a/protocols/relay/CHANGELOG.md b/protocols/relay/CHANGELOG.md index e60dcfb7596..549c545c036 100644 --- a/protocols/relay/CHANGELOG.md +++ b/protocols/relay/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.19.1 + +- Remove duplicated forwarding of pending events to connection handler. + ## 0.19.0 - Deprecate `void` crate. diff --git a/protocols/relay/Cargo.toml b/protocols/relay/Cargo.toml index 23715fc86de..bd34fa7ee34 100644 --- a/protocols/relay/Cargo.toml +++ b/protocols/relay/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-relay" edition = "2021" rust-version = { workspace = true } description = "Communications relaying for libp2p" -version = "0.19.0" +version = "0.19.1" authors = ["Parity Technologies ", "Max Inden "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/protocols/relay/src/priv_client.rs b/protocols/relay/src/priv_client.rs index 7ac9b716700..b8be01a2ea0 100644 --- a/protocols/relay/src/priv_client.rs +++ b/protocols/relay/src/priv_client.rs @@ -168,12 +168,14 @@ impl NetworkBehaviour for Behaviour { local_addr: &Multiaddr, remote_addr: &Multiaddr, ) -> Result, ConnectionDenied> { + let pending_handler_command = self.pending_handler_commands.remove(&connection_id); + if local_addr.is_relayed() { return Ok(Either::Right(dummy::ConnectionHandler)); } let mut handler = Handler::new(self.local_peer_id, peer, remote_addr.clone()); - if let Some(event) = self.pending_handler_commands.remove(&connection_id) { + if let Some(event) = pending_handler_command { handler.on_behaviour_event(event) } @@ -188,13 +190,15 @@ impl NetworkBehaviour for Behaviour { _: Endpoint, _: PortUse, ) -> Result, ConnectionDenied> { + let pending_handler_command = self.pending_handler_commands.remove(&connection_id); + if addr.is_relayed() { return Ok(Either::Right(dummy::ConnectionHandler)); } let mut handler = Handler::new(self.local_peer_id, peer, addr.clone()); - if let Some(event) = self.pending_handler_commands.remove(&connection_id) { + if let Some(event) = pending_handler_command { handler.on_behaviour_event(event) } @@ -208,21 +212,11 @@ impl NetworkBehaviour for Behaviour { connection_id, endpoint, .. - }) => { - if !endpoint.is_relayed() { - self.directly_connected_peers - .entry(peer_id) - .or_default() - .push(connection_id); - } - - if let Some(event) = self.pending_handler_commands.remove(&connection_id) { - self.queued_actions.push_back(ToSwarm::NotifyHandler { - peer_id, - handler: NotifyHandler::One(connection_id), - event: Either::Left(event), - }) - } + }) if !endpoint.is_relayed() => { + self.directly_connected_peers + .entry(peer_id) + .or_default() + .push(connection_id); } FromSwarm::ConnectionClosed(connection_closed) => { self.on_connection_closed(connection_closed) From bd5a2f5d3276d1ebacf34042dc5ca45e5be248e1 Mon Sep 17 00:00:00 2001 From: Darius Clark Date: Mon, 27 Jan 2025 08:31:36 -0500 Subject: [PATCH 41/56] chore: introduce libp2p-webrtc-websys behind webrtc-websys feature flag. With the promotion of `libp2p-webrtc-websys` to a non-alpha/stable release, we should also re-export it as apart of `libp2p` with it being behind a `webrtc-websys` feature. Pull-Request: #5819. --- Cargo.lock | 3 ++- Cargo.toml | 2 +- libp2p/CHANGELOG.md | 4 ++++ libp2p/Cargo.toml | 5 ++++- libp2p/src/lib.rs | 3 +++ 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f5ebfaeb1f9..4040ef676d7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2654,7 +2654,7 @@ checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" [[package]] name = "libp2p" -version = "0.55.0" +version = "0.55.1" dependencies = [ "async-std", "bytes", @@ -2690,6 +2690,7 @@ dependencies = [ "libp2p-tls", "libp2p-uds", "libp2p-upnp", + "libp2p-webrtc-websys", "libp2p-websocket", "libp2p-websocket-websys", "libp2p-webtransport-websys", diff --git a/Cargo.toml b/Cargo.toml index 72373a564a1..9d4b7d5b014 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -72,7 +72,7 @@ resolver = "2" rust-version = "1.83.0" [workspace.dependencies] -libp2p = { version = "0.55.0", path = "libp2p" } +libp2p = { version = "0.55.1", path = "libp2p" } libp2p-allow-block-list = { version = "0.5.0", path = "misc/allow-block-list" } libp2p-autonat = { version = "0.14.0", path = "protocols/autonat" } libp2p-connection-limits = { version = "0.5.0", path = "misc/connection-limits" } diff --git a/libp2p/CHANGELOG.md b/libp2p/CHANGELOG.md index 91f1b5628f8..dcf1ad7254d 100644 --- a/libp2p/CHANGELOG.md +++ b/libp2p/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.55.1 +- Introduce `libp2p-webrtc-websys` behind `webrtc-websys` feature flag. + See [PR 5819](https://github.com/libp2p/rust-libp2p/pull/5819). + ## 0.55.0 - Raise MSRV to 1.83.0. diff --git a/libp2p/Cargo.toml b/libp2p/Cargo.toml index 39d01a5c5c7..4cfd2957a2a 100644 --- a/libp2p/Cargo.toml +++ b/libp2p/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p" edition = "2021" rust-version = { workspace = true } description = "Peer-to-peer networking library" -version = "0.55.0" +version = "0.55.1" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" @@ -44,6 +44,7 @@ full = [ "tokio", "uds", "wasm-bindgen", + "webrtc-websys", "websocket-websys", "websocket", "webtransport-websys", @@ -83,6 +84,7 @@ tls = ["dep:libp2p-tls"] tokio = [ "libp2p-swarm/tokio", "libp2p-mdns?/tokio", "libp2p-tcp?/tokio", "libp2p-dns?/tokio", "libp2p-quic?/tokio", "libp2p-upnp?/tokio"] uds = ["dep:libp2p-uds"] wasm-bindgen = [ "futures-timer/wasm-bindgen", "getrandom/js", "libp2p-swarm/wasm-bindgen", "libp2p-gossipsub?/wasm-bindgen"] +webrtc-websys = ['dep:libp2p-webrtc-websys'] websocket-websys = ["dep:libp2p-websocket-websys"] websocket = ["dep:libp2p-websocket"] webtransport-websys = ["dep:libp2p-webtransport-websys"] @@ -117,6 +119,7 @@ libp2p-relay = { workspace = true, optional = true } libp2p-rendezvous = { workspace = true, optional = true } libp2p-request-response = { workspace = true, optional = true } libp2p-swarm = { workspace = true } +libp2p-webrtc-websys = { workspace = true, optional = true } libp2p-websocket-websys = { workspace = true, optional = true } libp2p-webtransport-websys = { workspace = true, optional = true } libp2p-yamux = { workspace = true, optional = true } diff --git a/libp2p/src/lib.rs b/libp2p/src/lib.rs index 47e1142d0e9..80b5880f6d5 100644 --- a/libp2p/src/lib.rs +++ b/libp2p/src/lib.rs @@ -123,6 +123,9 @@ pub use libp2p_uds as uds; #[cfg(not(target_arch = "wasm32"))] #[doc(inline)] pub use libp2p_upnp as upnp; +#[cfg(feature = "webrtc-websys")] +#[doc(inline)] +pub use libp2p_webrtc_websys as webrtc_websys; #[cfg(feature = "websocket")] #[cfg(not(target_arch = "wasm32"))] #[doc(inline)] From fee8bf0673cbe7c5076cac7ff91f4c8970ecb289 Mon Sep 17 00:00:00 2001 From: Elena Frank Date: Mon, 27 Jan 2025 20:44:59 +0700 Subject: [PATCH 42/56] feat(ci): ensure exactly one version bump Check in CI that the version of a crate has been bumped exactly once since the last release. Based on discussion in #5781. Pull-Request: #5804. --- scripts/ensure-version-bump-and-changelog.sh | 27 ++++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/scripts/ensure-version-bump-and-changelog.sh b/scripts/ensure-version-bump-and-changelog.sh index a7a0992005a..b4c5a6bf521 100755 --- a/scripts/ensure-version-bump-and-changelog.sh +++ b/scripts/ensure-version-bump-and-changelog.sh @@ -10,6 +10,9 @@ MERGE_BASE=$(git merge-base "$HEAD_SHA" "$PR_BASE") # Find the merge base. This SRC_DIFF_TO_BASE=$(git diff "$HEAD_SHA".."$MERGE_BASE" --name-status -- "$DIR_TO_CRATE/src" "$DIR_TO_CRATE/Cargo.toml") CHANGELOG_DIFF=$(git diff "$HEAD_SHA".."$MERGE_BASE" --name-only -- "$DIR_TO_CRATE/CHANGELOG.md") +RELEASED_VERSION=$(git tag --sort=version:refname | grep "^$CRATE-v" | tail -n1 | grep -Po "\d+\.\d+\.\d+") + + # If the source files of this crate weren't touched in this PR, exit early. if [ -z "$SRC_DIFF_TO_BASE" ]; then exit 0; @@ -21,8 +24,22 @@ if [ -z "$CHANGELOG_DIFF" ]; then exit 1 fi -# Code was touched, ensure the version used in the manifest hasn't been released yet. -if git tag | grep -q "^$CRATE-v${CRATE_VERSION}$"; then - echo "v$CRATE_VERSION of '$CRATE' has already been released, please bump the version." - exit 1 -fi +IFS='.' read -r -a current <<< "$CRATE_VERSION" +IFS='.' read -r -a released <<< "$RELEASED_VERSION" + +for i in $(seq 0 2); +do + case $((current[i]-released[i])) in + 0) continue ;; + 1) if [[ -n $(printf "%s\n" "${current[@]:i+1}" | grep -vFx '0') ]]; then + echo "Patch version has been bumped even though minor isn't released yet". + exit 1 + fi + exit 0 ;; + *) echo "Version of '$CRATE' has been bumped more than once since last release v$RELEASED_VERSION." + exit 1 ;; + esac +done + +echo "v$CRATE_VERSION of '$CRATE' has already been released, please bump the version." +exit 1 From 3ce976d8b7f7e2e636cc09844f81a88ee33d780a Mon Sep 17 00:00:00 2001 From: Mitchell Mosure Date: Mon, 27 Jan 2025 20:13:39 -0600 Subject: [PATCH 43/56] fix: public cbor/json codec module follow-up to #5792 configuring a request_response behavior with generic codec does not allow for setting request/response size limits. e.g. the following fails to compile since `request_response::cbor::codec` is private: ```rust let non_default_codec = request_response::cbor::codec::Codec::::default() .set_response_size_maximum(large_response_size_max); let request_response = request_response::Behaviour::with_codec( non_default_codec, std::iter::once(( StreamProtocol::new("/request-response/1"), request_response::ProtocolSupport::Full, )), request_response::Config::default(), ); ``` Pull-Request: #5830. --- Cargo.lock | 2 +- Cargo.toml | 2 +- protocols/request-response/CHANGELOG.md | 5 +++++ protocols/request-response/Cargo.toml | 2 +- protocols/request-response/src/cbor.rs | 2 +- protocols/request-response/src/json.rs | 2 +- 6 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4040ef676d7..57fe9e7791b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3244,7 +3244,7 @@ dependencies = [ [[package]] name = "libp2p-request-response" -version = "0.28.0" +version = "0.28.1" dependencies = [ "anyhow", "async-std", diff --git a/Cargo.toml b/Cargo.toml index 9d4b7d5b014..b0a98764cf3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -96,7 +96,7 @@ libp2p-pnet = { version = "0.26.0", path = "transports/pnet" } libp2p-quic = { version = "0.12.0", path = "transports/quic" } libp2p-relay = { version = "0.19.1", path = "protocols/relay" } libp2p-rendezvous = { version = "0.16.0", path = "protocols/rendezvous" } -libp2p-request-response = { version = "0.28.0", path = "protocols/request-response" } +libp2p-request-response = { version = "0.28.1", path = "protocols/request-response" } libp2p-server = { version = "0.12.6", path = "misc/server" } libp2p-stream = { version = "0.3.0-alpha", path = "protocols/stream" } libp2p-swarm = { version = "0.46.0", path = "swarm" } diff --git a/protocols/request-response/CHANGELOG.md b/protocols/request-response/CHANGELOG.md index c2ef19dbda2..4a4d83bacde 100644 --- a/protocols/request-response/CHANGELOG.md +++ b/protocols/request-response/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.28.1 + +- fix: public cbor/json codec module + See [PR 5830](https://github.com/libp2p/rust-libp2p/pull/5830). + ## 0.28.0 - Deprecate `void` crate. diff --git a/protocols/request-response/Cargo.toml b/protocols/request-response/Cargo.toml index 5cd711dd051..cf9e6563848 100644 --- a/protocols/request-response/Cargo.toml +++ b/protocols/request-response/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-request-response" edition = "2021" rust-version = { workspace = true } description = "Generic Request/Response Protocols" -version = "0.28.0" +version = "0.28.1" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/protocols/request-response/src/cbor.rs b/protocols/request-response/src/cbor.rs index eac1944bb09..9dea02ef6f1 100644 --- a/protocols/request-response/src/cbor.rs +++ b/protocols/request-response/src/cbor.rs @@ -46,7 +46,7 @@ /// ``` pub type Behaviour = crate::Behaviour>; -mod codec { +pub mod codec { use std::{collections::TryReserveError, convert::Infallible, io, marker::PhantomData}; use async_trait::async_trait; diff --git a/protocols/request-response/src/json.rs b/protocols/request-response/src/json.rs index f151b16bf5f..5832c2b3508 100644 --- a/protocols/request-response/src/json.rs +++ b/protocols/request-response/src/json.rs @@ -46,7 +46,7 @@ /// ``` pub type Behaviour = crate::Behaviour>; -mod codec { +pub mod codec { use std::{io, marker::PhantomData}; use async_trait::async_trait; From 5ac2e20568d1363f1f404f7bd196a07bce9f9744 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Wed, 29 Jan 2025 11:44:03 +0000 Subject: [PATCH 44/56] fix(gossipsub): Improve `max_messages_per_rpc` consistency Currently, when a gossipsub [Rpc](https://github.com/libp2p/specs/blob/master/pubsub/gossipsub/gossipsub-v1.0.md#protobuf) is received, only the publish messages are being checked for `max_messages_per_rpc`. This PR improves the config flag consistency by applying the check to the Control Messages as well. Pull-Request: #5826. --- Cargo.lock | 2 +- Cargo.toml | 2 +- protocols/gossipsub/CHANGELOG.md | 4 ++++ protocols/gossipsub/Cargo.toml | 2 +- protocols/gossipsub/src/behaviour.rs | 18 +++++++++++++++--- 5 files changed, 22 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 57fe9e7791b..6ad3684f1a4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2853,7 +2853,7 @@ dependencies = [ [[package]] name = "libp2p-gossipsub" -version = "0.48.0" +version = "0.48.1" dependencies = [ "async-channel 2.3.1", "asynchronous-codec", diff --git a/Cargo.toml b/Cargo.toml index b0a98764cf3..2a8854cc4bc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -80,7 +80,7 @@ libp2p-core = { version = "0.43.0", path = "core" } libp2p-dcutr = { version = "0.13.0", path = "protocols/dcutr" } libp2p-dns = { version = "0.43.0", path = "transports/dns" } libp2p-floodsub = { version = "0.46.0", path = "protocols/floodsub" } -libp2p-gossipsub = { version = "0.48.0", path = "protocols/gossipsub" } +libp2p-gossipsub = { version = "0.48.1", path = "protocols/gossipsub" } libp2p-identify = { version = "0.46.0", path = "protocols/identify" } libp2p-identity = { version = "0.2.10" } libp2p-kad = { version = "0.47.0", path = "protocols/kad" } diff --git a/protocols/gossipsub/CHANGELOG.md b/protocols/gossipsub/CHANGELOG.md index 10a225a92fd..20be0410036 100644 --- a/protocols/gossipsub/CHANGELOG.md +++ b/protocols/gossipsub/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.48.1 +- Improve `max_messages_per_rpc` consistency by ensuring RPC control messages also adhere to the existing limits. + See [PR 5826](https://github.com/libp2p/rust-libp2p/pull/5826) + ## 0.48.0 - Allow broadcasting `IDONTWANT` messages when publishing to avoid downloading data that is already available. diff --git a/protocols/gossipsub/Cargo.toml b/protocols/gossipsub/Cargo.toml index 0262348429e..a0534a46d33 100644 --- a/protocols/gossipsub/Cargo.toml +++ b/protocols/gossipsub/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-gossipsub" edition = "2021" rust-version = { workspace = true } description = "Gossipsub protocol for libp2p" -version = "0.48.0" +version = "0.48.1" authors = ["Age Manning "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/protocols/gossipsub/src/behaviour.rs b/protocols/gossipsub/src/behaviour.rs index b803337462d..ec2213e3083 100644 --- a/protocols/gossipsub/src/behaviour.rs +++ b/protocols/gossipsub/src/behaviour.rs @@ -3245,8 +3245,10 @@ where // Handle messages for (count, raw_message) in rpc.messages.into_iter().enumerate() { // Only process the amount of messages the configuration allows. - if self.config.max_messages_per_rpc().is_some() - && Some(count) >= self.config.max_messages_per_rpc() + if self + .config + .max_messages_per_rpc() + .is_some_and(|max_msg| count >= max_msg) { tracing::warn!("Received more messages than permitted. Ignoring further messages. Processed: {}", count); break; @@ -3260,7 +3262,17 @@ where let mut ihave_msgs = vec![]; let mut graft_msgs = vec![]; let mut prune_msgs = vec![]; - for control_msg in rpc.control_msgs { + for (count, control_msg) in rpc.control_msgs.into_iter().enumerate() { + // Only process the amount of messages the configuration allows. + if self + .config + .max_messages_per_rpc() + .is_some_and(|max_msg| count >= max_msg) + { + tracing::warn!("Received more control messages than permitted. Ignoring further messages. Processed: {}", count); + break; + } + match control_msg { ControlAction::IHave(IHave { topic_hash, From c625951f2d0ee1932541d2f2c8eef3bde0e34e6e Mon Sep 17 00:00:00 2001 From: Krishang Shah <93703995+kamuik16@users.noreply.github.com> Date: Wed, 29 Jan 2025 17:41:51 +0530 Subject: [PATCH 45/56] chore: use tokio instead of async-std ref #4449 Pull-Request: #5828. --- Cargo.lock | 6 +-- core/Cargo.toml | 2 +- core/tests/transport_upgrade.rs | 9 +++-- misc/allow-block-list/Cargo.toml | 2 +- misc/allow-block-list/src/lib.rs | 18 ++++----- misc/connection-limits/Cargo.toml | 2 +- misc/connection-limits/src/lib.rs | 66 +++++++++++++++---------------- 7 files changed, 53 insertions(+), 52 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6ad3684f1a4..c9903798524 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2707,12 +2707,12 @@ dependencies = [ name = "libp2p-allow-block-list" version = "0.5.0" dependencies = [ - "async-std", "libp2p-core", "libp2p-identity", "libp2p-swarm", "libp2p-swarm-derive", "libp2p-swarm-test", + "tokio", ] [[package]] @@ -2746,7 +2746,6 @@ dependencies = [ name = "libp2p-connection-limits" version = "0.5.0" dependencies = [ - "async-std", "libp2p-core", "libp2p-identify", "libp2p-identity", @@ -2756,13 +2755,13 @@ dependencies = [ "libp2p-swarm-test", "quickcheck-ext", "rand 0.8.5", + "tokio", ] [[package]] name = "libp2p-core" version = "0.43.0" dependencies = [ - "async-std", "either", "fnv", "futures", @@ -2780,6 +2779,7 @@ dependencies = [ "rand 0.8.5", "rw-stream-sink", "thiserror 2.0.9", + "tokio", "tracing", "unsigned-varint", "web-time 1.1.0", diff --git a/core/Cargo.toml b/core/Cargo.toml index df07375ef8b..5e84c6f0435 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -31,7 +31,7 @@ tracing = { workspace = true } unsigned-varint = { workspace = true } [dev-dependencies] -async-std = { version = "1.6.2", features = ["attributes"] } +tokio = { workspace = true, features = ["rt", "macros"] } libp2p-mplex = { path = "../muxers/mplex" } # Using `path` here because this is a cyclic dev-dependency which otherwise breaks releasing. libp2p-noise = { path = "../transports/noise" } # Using `path` here because this is a cyclic dev-dependency which otherwise breaks releasing. multihash = { workspace = true, features = ["arb"] } diff --git a/core/tests/transport_upgrade.rs b/core/tests/transport_upgrade.rs index b9733e38322..968ce79c73d 100644 --- a/core/tests/transport_upgrade.rs +++ b/core/tests/transport_upgrade.rs @@ -79,8 +79,8 @@ where } } -#[test] -fn upgrade_pipeline() { +#[tokio::test] +async fn upgrade_pipeline() { let listener_keys = identity::Keypair::generate_ed25519(); let listener_id = listener_keys.public().to_peer_id(); let mut listener_transport = MemoryTransport::default() @@ -137,6 +137,7 @@ fn upgrade_pipeline() { assert_eq!(peer, listener_id); }; - async_std::task::spawn(server); - async_std::task::block_on(client); + tokio::spawn(server); + + client.await; } diff --git a/misc/allow-block-list/Cargo.toml b/misc/allow-block-list/Cargo.toml index 859380a68a5..e039aa019b5 100644 --- a/misc/allow-block-list/Cargo.toml +++ b/misc/allow-block-list/Cargo.toml @@ -15,7 +15,7 @@ libp2p-swarm = { workspace = true } libp2p-identity = { workspace = true, features = ["peerid"] } [dev-dependencies] -async-std = { version = "1.12.0", features = ["attributes"] } +tokio = { workspace = true, features = ["rt", "macros"] } libp2p-swarm-derive = { path = "../../swarm-derive" } libp2p-swarm-test = { path = "../../swarm-test" } diff --git a/misc/allow-block-list/src/lib.rs b/misc/allow-block-list/src/lib.rs index ea0d56b5a67..0e92addf256 100644 --- a/misc/allow-block-list/src/lib.rs +++ b/misc/allow-block-list/src/lib.rs @@ -305,7 +305,7 @@ mod tests { use super::*; - #[async_std::test] + #[tokio::test] async fn cannot_dial_blocked_peer() { let mut dialer = Swarm::new_ephemeral(|_| Behaviour::::default()); let mut listener = Swarm::new_ephemeral(|_| Behaviour::::default()); @@ -319,7 +319,7 @@ mod tests { assert!(cause.downcast::().is_ok()); } - #[async_std::test] + #[tokio::test] async fn can_dial_unblocked_peer() { let mut dialer = Swarm::new_ephemeral(|_| Behaviour::::default()); let mut listener = Swarm::new_ephemeral(|_| Behaviour::::default()); @@ -333,7 +333,7 @@ mod tests { dial(&mut dialer, &listener).unwrap(); } - #[async_std::test] + #[tokio::test] async fn blocked_peer_cannot_dial_us() { let mut dialer = Swarm::new_ephemeral(|_| Behaviour::::default()); let mut listener = Swarm::new_ephemeral(|_| Behaviour::::default()); @@ -341,7 +341,7 @@ mod tests { listener.behaviour_mut().block_peer(*dialer.local_peer_id()); dial(&mut dialer, &listener).unwrap(); - async_std::task::spawn(dialer.loop_on_next()); + tokio::spawn(dialer.loop_on_next()); let cause = listener .wait(|e| match e { @@ -355,7 +355,7 @@ mod tests { assert!(cause.downcast::().is_ok()); } - #[async_std::test] + #[tokio::test] async fn connections_get_closed_upon_blocked() { let mut dialer = Swarm::new_ephemeral(|_| Behaviour::::default()); let mut listener = Swarm::new_ephemeral(|_| Behaviour::::default()); @@ -381,7 +381,7 @@ mod tests { assert_eq!(closed_listener_peer, *dialer.local_peer_id()); } - #[async_std::test] + #[tokio::test] async fn cannot_dial_peer_unless_allowed() { let mut dialer = Swarm::new_ephemeral(|_| Behaviour::::default()); let mut listener = Swarm::new_ephemeral(|_| Behaviour::::default()); @@ -396,7 +396,7 @@ mod tests { assert!(dial(&mut dialer, &listener).is_ok()); } - #[async_std::test] + #[tokio::test] async fn cannot_dial_disallowed_peer() { let mut dialer = Swarm::new_ephemeral(|_| Behaviour::::default()); let mut listener = Swarm::new_ephemeral(|_| Behaviour::::default()); @@ -413,7 +413,7 @@ mod tests { assert!(cause.downcast::().is_ok()); } - #[async_std::test] + #[tokio::test] async fn not_allowed_peer_cannot_dial_us() { let mut dialer = Swarm::new_ephemeral(|_| Behaviour::::default()); let mut listener = Swarm::new_ephemeral(|_| Behaviour::::default()); @@ -450,7 +450,7 @@ mod tests { assert!(incoming_cause.downcast::().is_ok()); } - #[async_std::test] + #[tokio::test] async fn connections_get_closed_upon_disallow() { let mut dialer = Swarm::new_ephemeral(|_| Behaviour::::default()); let mut listener = Swarm::new_ephemeral(|_| Behaviour::::default()); diff --git a/misc/connection-limits/Cargo.toml b/misc/connection-limits/Cargo.toml index 21e53ff385c..77a9bac46ef 100644 --- a/misc/connection-limits/Cargo.toml +++ b/misc/connection-limits/Cargo.toml @@ -15,7 +15,7 @@ libp2p-swarm = { workspace = true } libp2p-identity = { workspace = true, features = ["peerid"] } [dev-dependencies] -async-std = { version = "1.12.0", features = ["attributes"] } +tokio = { workspace = true, features = ["macros", "rt-multi-thread"] } libp2p-identify = { workspace = true } libp2p-ping = { workspace = true } libp2p-swarm-derive = { path = "../../swarm-derive" } diff --git a/misc/connection-limits/src/lib.rs b/misc/connection-limits/src/lib.rs index c8df5be5653..93e41081a14 100644 --- a/misc/connection-limits/src/lib.rs +++ b/misc/connection-limits/src/lib.rs @@ -381,6 +381,7 @@ mod tests { }; use libp2p_swarm_test::SwarmExt; use quickcheck::*; + use tokio::runtime::Runtime; use super::*; @@ -452,7 +453,8 @@ mod tests { ) }); - async_std::task::block_on(async { + let rt = Runtime::new().unwrap(); + rt.block_on(async { let (listen_addr, _) = swarm1.listen().with_memory_addr_external().await; for _ in 0..limit { @@ -461,7 +463,7 @@ mod tests { swarm2.dial(listen_addr).unwrap(); - async_std::task::spawn(swarm2.loop_on_next()); + tokio::spawn(swarm2.loop_on_next()); let cause = swarm1 .wait(|event| match event { @@ -496,42 +498,40 @@ mod tests { /// in [`SwarmEvent::ConnectionEstablished`] as the connection might still be denied by a /// sibling [`NetworkBehaviour`] in the former case. Only in the latter case /// ([`SwarmEvent::ConnectionEstablished`]) can the connection be seen as established. - #[test] - fn support_other_behaviour_denying_connection() { + #[tokio::test] + async fn support_other_behaviour_denying_connection() { let mut swarm1 = Swarm::new_ephemeral(|_| { Behaviour::new_with_connection_denier(ConnectionLimits::default()) }); let mut swarm2 = Swarm::new_ephemeral(|_| Behaviour::new(ConnectionLimits::default())); - async_std::task::block_on(async { - // Have swarm2 dial swarm1. - let (listen_addr, _) = swarm1.listen().await; - swarm2.dial(listen_addr).unwrap(); - async_std::task::spawn(swarm2.loop_on_next()); - - // Wait for the ConnectionDenier of swarm1 to deny the established connection. - let cause = swarm1 - .wait(|event| match event { - SwarmEvent::IncomingConnectionError { - error: ListenError::Denied { cause }, - .. - } => Some(cause), - _ => None, - }) - .await; - - cause.downcast::().unwrap(); - - assert_eq!( - 0, - swarm1 - .behaviour_mut() - .limits - .established_inbound_connections - .len(), - "swarm1 connection limit behaviour to not count denied established connection as established connection" - ) - }); + // Have swarm2 dial swarm1. + let (listen_addr, _) = swarm1.listen().await; + swarm2.dial(listen_addr).unwrap(); + tokio::spawn(swarm2.loop_on_next()); + + // Wait for the ConnectionDenier of swarm1 to deny the established connection. + let cause = swarm1 + .wait(|event| match event { + SwarmEvent::IncomingConnectionError { + error: ListenError::Denied { cause }, + .. + } => Some(cause), + _ => None, + }) + .await; + + cause.downcast::().unwrap(); + + assert_eq!( + 0, + swarm1 + .behaviour_mut() + .limits + .established_inbound_connections + .len(), + "swarm1 connection limit behaviour to not count denied established connection as established connection" + ) } #[derive(libp2p_swarm_derive::NetworkBehaviour)] From 3cd43bb1d476ed4a8354a1f6bf233d8b70a85332 Mon Sep 17 00:00:00 2001 From: Guillaume Michel Date: Fri, 31 Jan 2025 18:23:57 +0100 Subject: [PATCH 46/56] chore: remove @guillaumemichel from maintainers Removing myself from the maintainers list, since I have less time to invest to the project. I will spend more time working on IPFS in Go, so I won't be far away :) Feel free to continue tagging me for `kad` reviews. Pull-Request: #5834. --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 24e88f62751..be32f63cc10 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,6 @@ Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md). (In alphabetical order.) -- Guillaume Michel ([@guillaumemichel](https://github.com/guillaumemichel)) - João Oliveira ([@jxs](https://github.com/jxs)) ## Notable users From fef298be9222485187ac9b958cffeb0169374daf Mon Sep 17 00:00:00 2001 From: Sacha Lansky <23283108+sacha-l@users.noreply.github.com> Date: Sat, 1 Feb 2025 14:05:38 +0100 Subject: [PATCH 47/56] chore: add Swarm NL to list of notable users Pull-Request: #5840. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index be32f63cc10..5a5ce335e81 100644 --- a/README.md +++ b/README.md @@ -101,5 +101,6 @@ Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md). - [Subspace](https://github.com/subspace/subspace) - Subspace Network reference implementation - [Substrate](https://github.com/paritytech/substrate) - Framework for blockchain innovation, used by [Polkadot](https://www.parity.io/technologies/polkadot/). +- [Swarm NL](https://github.com/algorealmInc/SwarmNL) - A library that makes it easy to configure the networking requirements for any distributed application. - [Taple](https://github.com/opencanarias/taple-core) - Sustainable DLT for asset and process traceability by [OpenCanarias](https://www.opencanarias.com/en/). - [Ceylon](https://github.com/ceylonai/ceylon) - A Multi-Agent System (MAS) Development Framework. From 40b729b4083a91abc4efc55763dfff13e6b0cfb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Mon, 3 Feb 2025 10:58:16 +0000 Subject: [PATCH 48/56] fix: update Cargo.lock to address [RUSTSEC-2025-0004](https://rustsec.org/advisories/RUSTSEC-2025-0004) Pull-Request: #5842. --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c9903798524..186abbe1c30 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4091,9 +4091,9 @@ checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" [[package]] name = "openssl" -version = "0.10.68" +version = "0.10.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6174bc48f102d208783c2c84bf931bb75927a617866870de8a4ea85597f871f5" +checksum = "61cfb4e166a8bb8c9b55c500bc2308550148ece889be90f609377e58140f42c6" dependencies = [ "bitflags 2.6.0", "cfg-if", @@ -4123,9 +4123,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.104" +version = "0.9.105" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741" +checksum = "8b22d5b84be05a8d6947c7cb71f7c849aa0f112acd4bf51c2a7c1c988ac0a9dc" dependencies = [ "cc", "libc", From cfa58f0f971e5c1de729942e4e647c95dfbc149d Mon Sep 17 00:00:00 2001 From: Shiyas Mohammed <83513144+shiyasmohd@users.noreply.github.com> Date: Mon, 3 Feb 2025 17:08:52 +0530 Subject: [PATCH 49/56] chore(quic): migrate tests from async-std to tokio Migrate tests from async-std to tokio in transports/quic as per #4449 Pull-Request: #5841. --- transports/quic/Cargo.toml | 5 +- transports/quic/src/transport.rs | 6 +- transports/quic/tests/smoke.rs | 68 +++++++++++----------- transports/quic/tests/stream_compliance.rs | 16 ++--- 4 files changed, 47 insertions(+), 48 deletions(-) diff --git a/transports/quic/Cargo.toml b/transports/quic/Cargo.toml index 8c416858c91..f6f95800193 100644 --- a/transports/quic/Cargo.toml +++ b/transports/quic/Cargo.toml @@ -35,11 +35,10 @@ async-std = ["dep:async-std", "if-watch/smol", "quinn/runtime-async-std"] all-features = true [dev-dependencies] -async-std = { version = "1.12.0", features = ["attributes"] } libp2p-identity = { workspace = true, features = ["rand"] } libp2p-muxer-test-harness = { path = "../../muxers/test-harness" } libp2p-noise = { workspace = true } -libp2p-tcp = { workspace = true, features = ["async-io"] } +libp2p-tcp = { workspace = true, features = ["tokio"] } libp2p-yamux = { workspace = true } quickcheck = "1" tokio = { workspace = true, features = ["macros", "rt-multi-thread", "time"] } @@ -47,7 +46,7 @@ tracing-subscriber = { workspace = true, features = ["env-filter"] } [[test]] name = "stream_compliance" -required-features = ["async-std"] +required-features = ["tokio"] [lints] workspace = true diff --git a/transports/quic/src/transport.rs b/transports/quic/src/transport.rs index 63a65ce99cc..84aaba8b672 100644 --- a/transports/quic/src/transport.rs +++ b/transports/quic/src/transport.rs @@ -845,12 +845,12 @@ mod tests { ); } - #[cfg(feature = "async-std")] - #[async_std::test] + #[cfg(feature = "tokio")] + #[tokio::test] async fn test_close_listener() { let keypair = libp2p_identity::Keypair::generate_ed25519(); let config = Config::new(&keypair); - let mut transport = crate::async_std::Transport::new(config); + let mut transport = crate::tokio::Transport::new(config); assert!(poll_fn(|cx| Pin::new(&mut transport).as_mut().poll(cx)) .now_or_never() .is_none()); diff --git a/transports/quic/tests/smoke.rs b/transports/quic/tests/smoke.rs index 5fbef84649e..6be4796612a 100644 --- a/transports/quic/tests/smoke.rs +++ b/transports/quic/tests/smoke.rs @@ -41,10 +41,10 @@ async fn tokio_smoke() { smoke::().await } -#[cfg(feature = "async-std")] -#[async_std::test] +#[cfg(feature = "tokio")] +#[tokio::test] async fn async_std_smoke() { - smoke::().await + smoke::().await } #[cfg(feature = "tokio")] @@ -74,14 +74,14 @@ async fn endpoint_reuse() { assert_eq!(a_send_back_addr, a_addr); } -#[cfg(feature = "async-std")] -#[async_std::test] +#[cfg(feature = "tokio")] +#[tokio::test] async fn ipv4_dial_ipv6() { let _ = tracing_subscriber::fmt() .with_env_filter(EnvFilter::from_default_env()) .try_init(); - let (a_peer_id, mut a_transport) = create_default_transport::(); - let (b_peer_id, mut b_transport) = create_default_transport::(); + let (a_peer_id, mut a_transport) = create_default_transport::(); + let (b_peer_id, mut b_transport) = create_default_transport::(); let a_addr = start_listening(&mut a_transport, "/ip6/::1/udp/0/quic-v1").await; let ((a_connected, _, _), (b_connected, _)) = @@ -94,8 +94,8 @@ async fn ipv4_dial_ipv6() { /// Tests that a [`Transport::dial`] wakes up the task previously polling [`Transport::poll`]. /// /// See https://github.com/libp2p/rust-libp2p/pull/3306 for context. -#[cfg(feature = "async-std")] -#[async_std::test] +#[cfg(feature = "tokio")] +#[tokio::test] async fn wrapped_with_delay() { use libp2p_core::transport::DialOpts; @@ -161,15 +161,15 @@ async fn wrapped_with_delay() { } } - let (a_peer_id, mut a_transport) = create_default_transport::(); + let (a_peer_id, mut a_transport) = create_default_transport::(); let (b_peer_id, mut b_transport) = { - let (id, transport) = create_default_transport::(); + let (id, transport) = create_default_transport::(); (id, DialDelay(Arc::new(Mutex::new(transport))).boxed()) }; // Spawn A let a_addr = start_listening(&mut a_transport, "/ip6/::1/udp/0/quic-v1").await; - let listener = async_std::task::spawn(async move { + let listener = tokio::spawn(async move { let (upgrade, _) = a_transport .select_next_some() .await @@ -184,7 +184,7 @@ async fn wrapped_with_delay() { // // Note that the dial is spawned on a different task than the transport allowing the transport // task to poll the transport once and then suspend, waiting for the wakeup from the dial. - let dial = async_std::task::spawn({ + let dial = tokio::spawn({ let dial = b_transport .dial( a_addr, @@ -196,23 +196,23 @@ async fn wrapped_with_delay() { .unwrap(); async { dial.await.unwrap().0 } }); - async_std::task::spawn(async move { b_transport.next().await }); + tokio::spawn(async move { b_transport.next().await }); let (a_connected, b_connected) = future::join(listener, dial).await; - assert_eq!(a_connected, b_peer_id); - assert_eq!(b_connected, a_peer_id); + assert_eq!(a_connected.unwrap(), b_peer_id); + assert_eq!(b_connected.unwrap(), a_peer_id); } -#[cfg(feature = "async-std")] -#[async_std::test] +#[cfg(feature = "tokio")] +#[tokio::test] #[ignore] // Transport currently does not validate PeerId. // Enable once we make use of PeerId validation in rustls. async fn wrong_peerid() { use libp2p_identity::PeerId; - let (a_peer_id, mut a_transport) = create_default_transport::(); - let (b_peer_id, mut b_transport) = create_default_transport::(); + let (a_peer_id, mut a_transport) = create_default_transport::(); + let (b_peer_id, mut b_transport) = create_default_transport::(); let a_addr = start_listening(&mut a_transport, "/ip6/::1/udp/0/quic-v1").await; let a_addr_random_peer = a_addr.with(Protocol::P2p(PeerId::random())); @@ -224,15 +224,15 @@ async fn wrong_peerid() { assert_eq!(b_connected, a_peer_id); } -#[cfg(feature = "async-std")] +#[cfg(feature = "tokio")] fn new_tcp_quic_transport() -> (PeerId, Boxed<(PeerId, StreamMuxerBox)>) { let keypair = generate_tls_keypair(); let peer_id = keypair.public().to_peer_id(); let mut config = quic::Config::new(&keypair); config.handshake_timeout = Duration::from_secs(1); - let quic_transport = quic::async_std::Transport::new(config); - let tcp_transport = tcp::async_io::Transport::new(tcp::Config::default()) + let quic_transport = quic::tokio::Transport::new(config); + let tcp_transport = tcp::tokio::Transport::new(tcp::Config::default()) .upgrade(upgrade::Version::V1) .authenticate(noise::Config::new(&keypair).unwrap()) .multiplex(yamux::Config::default()); @@ -247,8 +247,8 @@ fn new_tcp_quic_transport() -> (PeerId, Boxed<(PeerId, StreamMuxerBox)>) { (peer_id, transport) } -#[cfg(feature = "async-std")] -#[async_std::test] +#[cfg(feature = "tokio")] +#[tokio::test] async fn tcp_and_quic() { let (a_peer_id, mut a_transport) = new_tcp_quic_transport(); let (b_peer_id, mut b_transport) = new_tcp_quic_transport(); @@ -377,15 +377,15 @@ async fn draft_29_support() { } } -#[cfg(feature = "async-std")] -#[async_std::test] +#[cfg(feature = "tokio")] +#[tokio::test] async fn backpressure() { let _ = tracing_subscriber::fmt() .with_env_filter(EnvFilter::from_default_env()) .try_init(); let max_stream_data = quic::Config::new(&generate_tls_keypair()).max_stream_data; - let (mut stream_a, mut stream_b) = build_streams::().await; + let (mut stream_a, mut stream_b) = build_streams::().await; let data = vec![0; max_stream_data as usize - 1]; @@ -403,13 +403,13 @@ async fn backpressure() { assert!(stream_a.write(&more_data).now_or_never().is_some()); } -#[cfg(feature = "async-std")] -#[async_std::test] +#[cfg(feature = "tokio")] +#[tokio::test] async fn read_after_peer_dropped_stream() { let _ = tracing_subscriber::fmt() .with_env_filter(EnvFilter::from_default_env()) .try_init(); - let (mut stream_a, mut stream_b) = build_streams::().await; + let (mut stream_a, mut stream_b) = build_streams::().await; let data = vec![0; 10]; @@ -424,14 +424,14 @@ async fn read_after_peer_dropped_stream() { assert_eq!(data, buf) } -#[cfg(feature = "async-std")] -#[async_std::test] +#[cfg(feature = "tokio")] +#[tokio::test] #[should_panic] async fn write_after_peer_dropped_stream() { let _ = tracing_subscriber::fmt() .with_env_filter(EnvFilter::from_default_env()) .try_init(); - let (stream_a, mut stream_b) = build_streams::().await; + let (stream_a, mut stream_b) = build_streams::().await; drop(stream_a); futures_timer::Delay::new(Duration::from_millis(100)).await; diff --git a/transports/quic/tests/stream_compliance.rs b/transports/quic/tests/stream_compliance.rs index 13c29f2caa0..225ea1e4936 100644 --- a/transports/quic/tests/stream_compliance.rs +++ b/transports/quic/tests/stream_compliance.rs @@ -7,14 +7,14 @@ use libp2p_core::{ }; use libp2p_quic as quic; -#[async_std::test] +#[tokio::test] async fn close_implies_flush() { let (alice, bob) = connected_peers().await; libp2p_muxer_test_harness::close_implies_flush(alice, bob).await; } -#[async_std::test] +#[tokio::test] async fn read_after_close() { let (alice, bob) = connected_peers().await; @@ -36,10 +36,10 @@ async fn connected_peers() -> (quic::Connection, quic::Connection) { let (dialer_conn_sender, dialer_conn_receiver) = oneshot::channel(); let (listener_conn_sender, listener_conn_receiver) = oneshot::channel(); - async_std::task::spawn(async move { + tokio::spawn(async move { let (upgrade, _) = listener.next().await.unwrap().into_incoming().unwrap(); - async_std::task::spawn(async move { + tokio::spawn(async move { let (_, connection) = upgrade.await.unwrap(); let _ = listener_conn_sender.send(connection); @@ -58,13 +58,13 @@ async fn connected_peers() -> (quic::Connection, quic::Connection) { }, ) .unwrap(); - async_std::task::spawn(async move { + tokio::spawn(async move { let connection = dial_fut.await.unwrap().1; let _ = dialer_conn_sender.send(connection); }); - async_std::task::spawn(async move { + tokio::spawn(async move { loop { dialer.next().await; } @@ -75,10 +75,10 @@ async fn connected_peers() -> (quic::Connection, quic::Connection) { .unwrap() } -fn new_transport() -> quic::async_std::Transport { +fn new_transport() -> quic::tokio::Transport { let keypair = libp2p_identity::Keypair::generate_ed25519(); let mut config = quic::Config::new(&keypair); config.handshake_timeout = Duration::from_secs(1); - quic::async_std::Transport::new(config) + quic::tokio::Transport::new(config) } From 70479f7070b1332dfb8c3de9d2b4199db00d1e80 Mon Sep 17 00:00:00 2001 From: Slava2001 <45189467+Slava2001@users.noreply.github.com> Date: Mon, 3 Feb 2025 19:41:28 +0300 Subject: [PATCH 50/56] fix(swarm-derive): use full path for std result in derive macros Pull-Request: #5839. --- Cargo.lock | 2 +- Cargo.toml | 2 +- swarm-derive/CHANGELOG.md | 5 +++++ swarm-derive/Cargo.toml | 2 +- swarm-derive/src/lib.rs | 10 +++++----- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 186abbe1c30..e8affaa2628 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3334,7 +3334,7 @@ dependencies = [ [[package]] name = "libp2p-swarm-derive" -version = "0.35.0" +version = "0.35.1" dependencies = [ "heck", "quote", diff --git a/Cargo.toml b/Cargo.toml index 2a8854cc4bc..33cce85e21b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -100,7 +100,7 @@ libp2p-request-response = { version = "0.28.1", path = "protocols/request-respon libp2p-server = { version = "0.12.6", path = "misc/server" } libp2p-stream = { version = "0.3.0-alpha", path = "protocols/stream" } libp2p-swarm = { version = "0.46.0", path = "swarm" } -libp2p-swarm-derive = { version = "=0.35.0", path = "swarm-derive" } # `libp2p-swarm-derive` may not be compatible with different `libp2p-swarm` non-breaking releases. E.g. `libp2p-swarm` might introduce a new enum variant `FromSwarm` (which is `#[non-exhaustive]`) in a non-breaking release. Older versions of `libp2p-swarm-derive` would not forward this enum variant within the `NetworkBehaviour` hierarchy. Thus the version pinning is required. +libp2p-swarm-derive = { version = "=0.35.1", path = "swarm-derive" } # `libp2p-swarm-derive` may not be compatible with different `libp2p-swarm` non-breaking releases. E.g. `libp2p-swarm` might introduce a new enum variant `FromSwarm` (which is `#[non-exhaustive]`) in a non-breaking release. Older versions of `libp2p-swarm-derive` would not forward this enum variant within the `NetworkBehaviour` hierarchy. Thus the version pinning is required. libp2p-swarm-test = { version = "0.5.0", path = "swarm-test" } libp2p-tcp = { version = "0.43.0", path = "transports/tcp" } libp2p-tls = { version = "0.6.0", path = "transports/tls" } diff --git a/swarm-derive/CHANGELOG.md b/swarm-derive/CHANGELOG.md index 25932459ba8..7f66609cbd4 100644 --- a/swarm-derive/CHANGELOG.md +++ b/swarm-derive/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.35.1 + +- Fix `NetworkBehaviour` derive macro: replace the `Result` with `std::result::Result`. + See [PR 4568](https://github.com/libp2p/rust-libp2p/pull/5839) + ## 0.35.0 - Implement refactored `Transport`. diff --git a/swarm-derive/Cargo.toml b/swarm-derive/Cargo.toml index febd2a6455a..5d3ed741dbe 100644 --- a/swarm-derive/Cargo.toml +++ b/swarm-derive/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-swarm-derive" edition = "2021" rust-version = { workspace = true } description = "Procedural macros of libp2p-swarm" -version = "0.35.0" +version = "0.35.1" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/swarm-derive/src/lib.rs b/swarm-derive/src/lib.rs index 41b909f329f..871f0b5815e 100644 --- a/swarm-derive/src/lib.rs +++ b/swarm-derive/src/lib.rs @@ -170,7 +170,7 @@ fn build_struct(ast: &DeriveInput, data_struct: &DataStruct) -> syn::Result) -> Result<(), std::fmt::Error> { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> { match &self { #(#enum_name::#match_variants(event) => { write!(f, "{}: {:?}", #enum_name_str, event) @@ -426,7 +426,7 @@ fn build_struct(ast: &DeriveInput, data_struct: &DataStruct) -> syn::Result Result<(), #connection_denied> { + ) -> std::result::Result<(), #connection_denied> { #(#handle_pending_inbound_connection_stmts)* Ok(()) @@ -439,7 +439,7 @@ fn build_struct(ast: &DeriveInput, data_struct: &DataStruct) -> syn::Result Result<#t_handler, #connection_denied> { + ) -> std::result::Result<#t_handler, #connection_denied> { Ok(#handle_established_inbound_connection) } @@ -450,7 +450,7 @@ fn build_struct(ast: &DeriveInput, data_struct: &DataStruct) -> syn::Result, addresses: &[#multiaddr], effective_role: #endpoint, - ) -> Result<::std::vec::Vec<#multiaddr>, #connection_denied> { + ) -> std::result::Result<::std::vec::Vec<#multiaddr>, #connection_denied> { #handle_pending_outbound_connection } @@ -462,7 +462,7 @@ fn build_struct(ast: &DeriveInput, data_struct: &DataStruct) -> syn::Result Result<#t_handler, #connection_denied> { + ) -> std::result::Result<#t_handler, #connection_denied> { Ok(#handle_established_outbound_connection) } From da8763c3aea765d02929a7496119354f00938631 Mon Sep 17 00:00:00 2001 From: stormshield-frb <144998884+stormshield-frb@users.noreply.github.com> Date: Wed, 5 Feb 2025 11:03:44 +0100 Subject: [PATCH 51/56] fix(autonat): prevent infinity loop on wrong nonce Fix #5816. Pull-Request: #5848. --- Cargo.lock | 2 +- Cargo.toml | 2 +- protocols/autonat/CHANGELOG.md | 5 +++++ protocols/autonat/Cargo.toml | 2 +- protocols/autonat/src/v2/client/handler/dial_back.rs | 7 +------ 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e8affaa2628..7043353dc01 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2717,7 +2717,7 @@ dependencies = [ [[package]] name = "libp2p-autonat" -version = "0.14.0" +version = "0.14.1" dependencies = [ "async-trait", "asynchronous-codec", diff --git a/Cargo.toml b/Cargo.toml index 33cce85e21b..1cb4fbff95e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -74,7 +74,7 @@ rust-version = "1.83.0" [workspace.dependencies] libp2p = { version = "0.55.1", path = "libp2p" } libp2p-allow-block-list = { version = "0.5.0", path = "misc/allow-block-list" } -libp2p-autonat = { version = "0.14.0", path = "protocols/autonat" } +libp2p-autonat = { version = "0.14.1", path = "protocols/autonat" } libp2p-connection-limits = { version = "0.5.0", path = "misc/connection-limits" } libp2p-core = { version = "0.43.0", path = "core" } libp2p-dcutr = { version = "0.13.0", path = "protocols/dcutr" } diff --git a/protocols/autonat/CHANGELOG.md b/protocols/autonat/CHANGELOG.md index e80dc4df437..36c8752deed 100644 --- a/protocols/autonat/CHANGELOG.md +++ b/protocols/autonat/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.14.1 + +- Fix infinity loop on wrong `nonce` when performing `dial_back`. + See [PR 5848](https://github.com/libp2p/rust-libp2p/pull/5848). + ## 0.14.0 - Verify that an incoming AutoNAT dial comes from a connected peer. See [PR 5597](https://github.com/libp2p/rust-libp2p/pull/5597). diff --git a/protocols/autonat/Cargo.toml b/protocols/autonat/Cargo.toml index f614db56eb1..04a43515fdd 100644 --- a/protocols/autonat/Cargo.toml +++ b/protocols/autonat/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-autonat" edition = "2021" rust-version = { workspace = true } description = "NAT and firewall detection for libp2p" -version = "0.14.0" +version = "0.14.1" authors = [ "David Craven ", "Elena Frank ", diff --git a/protocols/autonat/src/v2/client/handler/dial_back.rs b/protocols/autonat/src/v2/client/handler/dial_back.rs index 7cdf194343a..1e86b46152b 100644 --- a/protocols/autonat/src/v2/client/handler/dial_back.rs +++ b/protocols/autonat/src/v2/client/handler/dial_back.rs @@ -109,12 +109,7 @@ fn perform_dial_back( match receiver.await { Ok(Ok(())) => {} Ok(Err(e)) => return Some((Err(e), state)), - Err(_) => { - return Some(( - Err(io::Error::new(io::ErrorKind::Other, "Sender got cancelled")), - state, - )); - } + Err(_) => return None, } if let Err(e) = protocol::dial_back_response(&mut state.stream).await { return Some((Err(e), state)); From c78de35596a4d254e886ddf27cfc27abfe8354ef Mon Sep 17 00:00:00 2001 From: Shiyas Mohammed <83513144+shiyasmohd@users.noreply.github.com> Date: Wed, 5 Feb 2025 16:10:42 +0530 Subject: [PATCH 52/56] chore(identify): migrate tests from async-std to tokio Migrating tests in `protocols/identify` from `async_std` to `tokio` as per #4449 Pull-Request: #5849. --- Cargo.lock | 2 +- protocols/identify/Cargo.toml | 2 +- protocols/identify/tests/smoke.rs | 26 +++++++++++++------------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7043353dc01..7f8ea0b339d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2889,7 +2889,6 @@ dependencies = [ name = "libp2p-identify" version = "0.46.0" dependencies = [ - "async-std", "asynchronous-codec", "either", "futures", @@ -2903,6 +2902,7 @@ dependencies = [ "quick-protobuf-codec", "smallvec", "thiserror 2.0.9", + "tokio", "tracing", "tracing-subscriber", ] diff --git a/protocols/identify/Cargo.toml b/protocols/identify/Cargo.toml index 2fb2eaed1ba..07730626f42 100644 --- a/protocols/identify/Cargo.toml +++ b/protocols/identify/Cargo.toml @@ -26,7 +26,7 @@ tracing = { workspace = true } either = "1.12.0" [dev-dependencies] -async-std = { version = "1.6.2", features = ["attributes"] } +tokio = { workspace = true, features = ["macros", "rt-multi-thread"] } libp2p-swarm-test = { path = "../../swarm-test" } libp2p-swarm = { workspace = true, features = ["macros"] } tracing-subscriber = { workspace = true, features = ["env-filter"] } diff --git a/protocols/identify/tests/smoke.rs b/protocols/identify/tests/smoke.rs index 0d2818df0a4..c19dc997f0d 100644 --- a/protocols/identify/tests/smoke.rs +++ b/protocols/identify/tests/smoke.rs @@ -11,7 +11,7 @@ use libp2p_swarm::{Swarm, SwarmEvent}; use libp2p_swarm_test::SwarmExt; use tracing_subscriber::EnvFilter; -#[async_std::test] +#[tokio::test] async fn periodic_identify() { let _ = tracing_subscriber::fmt() .with_env_filter(EnvFilter::from_default_env()) @@ -82,7 +82,7 @@ async fn periodic_identify() { other => panic!("Unexpected events: {other:?}"), } } -#[async_std::test] +#[tokio::test] async fn only_emits_address_candidate_once_per_connection() { let _ = tracing_subscriber::fmt() .with_env_filter(EnvFilter::from_default_env()) @@ -105,7 +105,7 @@ async fn only_emits_address_candidate_once_per_connection() { swarm2.listen().with_memory_addr_external().await; swarm1.connect(&mut swarm2).await; - async_std::task::spawn(swarm2.loop_on_next()); + tokio::spawn(swarm2.loop_on_next()); let swarm_events = futures::stream::poll_fn(|cx| swarm1.poll_next_unpin(cx)) .take(8) @@ -154,7 +154,7 @@ async fn only_emits_address_candidate_once_per_connection() { ); } -#[async_std::test] +#[tokio::test] async fn emits_unique_listen_addresses() { let _ = tracing_subscriber::fmt() .with_env_filter(EnvFilter::from_default_env()) @@ -180,7 +180,7 @@ async fn emits_unique_listen_addresses() { let swarm2_peer_id = *swarm2.local_peer_id(); swarm1.connect(&mut swarm2).await; - async_std::task::spawn(swarm2.loop_on_next()); + tokio::spawn(swarm2.loop_on_next()); let swarm_events = futures::stream::poll_fn(|cx| swarm1.poll_next_unpin(cx)) .take(8) @@ -226,7 +226,7 @@ async fn emits_unique_listen_addresses() { assert!(reported_addrs.contains(&(swarm2_peer_id, swarm2_tcp_listen_addr))); } -#[async_std::test] +#[tokio::test] async fn hides_listen_addresses() { let _ = tracing_subscriber::fmt() .with_env_filter(EnvFilter::from_default_env()) @@ -253,7 +253,7 @@ async fn hides_listen_addresses() { let swarm2_peer_id = *swarm2.local_peer_id(); swarm1.connect(&mut swarm2).await; - async_std::task::spawn(swarm2.loop_on_next()); + tokio::spawn(swarm2.loop_on_next()); let swarm_events = futures::stream::poll_fn(|cx| swarm1.poll_next_unpin(cx)) .take(8) @@ -297,7 +297,7 @@ async fn hides_listen_addresses() { assert!(reported_addrs.contains(&(swarm2_peer_id, swarm2_tcp_listen_addr))); } -#[async_std::test] +#[tokio::test] async fn identify_push() { let _ = tracing_subscriber::fmt() .with_env_filter(EnvFilter::from_default_env()) @@ -349,7 +349,7 @@ async fn identify_push() { assert!(swarm1_received_info.listen_addrs.is_empty()); } -#[async_std::test] +#[tokio::test] async fn discover_peer_after_disconnect() { let _ = tracing_subscriber::fmt() .with_env_filter(EnvFilter::from_default_env()) @@ -369,7 +369,7 @@ async fn discover_peer_after_disconnect() { swarm2.connect(&mut swarm1).await; let swarm1_peer_id = *swarm1.local_peer_id(); - async_std::task::spawn(swarm1.loop_on_next()); + tokio::spawn(swarm1.loop_on_next()); // Wait until we identified. swarm2 @@ -402,7 +402,7 @@ async fn discover_peer_after_disconnect() { assert_eq!(connected_peer, swarm1_peer_id); } -#[async_std::test] +#[tokio::test] async fn configured_interval_starts_after_first_identify() { let _ = tracing_subscriber::fmt() .with_env_filter(EnvFilter::from_default_env()) @@ -426,7 +426,7 @@ async fn configured_interval_starts_after_first_identify() { swarm1.listen().with_memory_addr_external().await; swarm2.connect(&mut swarm1).await; - async_std::task::spawn(swarm2.loop_on_next()); + tokio::spawn(swarm2.loop_on_next()); let start = Instant::now(); @@ -442,7 +442,7 @@ async fn configured_interval_starts_after_first_identify() { assert!(time_to_first_identify < identify_interval) } -#[async_std::test] +#[tokio::test] async fn reject_mismatched_public_key() { let _ = tracing_subscriber::fmt() .with_env_filter(EnvFilter::from_default_env()) From 9db2ea0a0b4c78057afc66dc29a29ab0158a8078 Mon Sep 17 00:00:00 2001 From: DrHuangMHT Date: Wed, 5 Feb 2025 20:13:03 +0800 Subject: [PATCH 53/56] feat(connection-limit): allow specific peers to bypass limit Add `bypass_peer_id` on `connection_limit::Behaviour` to allow peers to bypass limit. May close #5605 Pull-Request: #5720. --- Cargo.lock | 2 +- Cargo.toml | 2 +- misc/connection-limits/CHANGELOG.md | 6 ++ misc/connection-limits/Cargo.toml | 2 +- misc/connection-limits/src/lib.rs | 154 ++++++++++++++++++++++++++-- 5 files changed, 153 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7f8ea0b339d..4ef99e33372 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2744,7 +2744,7 @@ dependencies = [ [[package]] name = "libp2p-connection-limits" -version = "0.5.0" +version = "0.5.1" dependencies = [ "libp2p-core", "libp2p-identify", diff --git a/Cargo.toml b/Cargo.toml index 1cb4fbff95e..c97b610d80f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -75,7 +75,7 @@ rust-version = "1.83.0" libp2p = { version = "0.55.1", path = "libp2p" } libp2p-allow-block-list = { version = "0.5.0", path = "misc/allow-block-list" } libp2p-autonat = { version = "0.14.1", path = "protocols/autonat" } -libp2p-connection-limits = { version = "0.5.0", path = "misc/connection-limits" } +libp2p-connection-limits = { version = "0.5.1", path = "misc/connection-limits" } libp2p-core = { version = "0.43.0", path = "core" } libp2p-dcutr = { version = "0.13.0", path = "protocols/dcutr" } libp2p-dns = { version = "0.43.0", path = "transports/dns" } diff --git a/misc/connection-limits/CHANGELOG.md b/misc/connection-limits/CHANGELOG.md index a84ff4deb32..f6ffd00741e 100644 --- a/misc/connection-limits/CHANGELOG.md +++ b/misc/connection-limits/CHANGELOG.md @@ -1,3 +1,9 @@ +## 0.5.1 + +- Allow setting Peer IDs for bypassing limit check. + Connections to the specified peers won't be counted toward limits. + See [PR 5720](https://github.com/libp2p/rust-libp2p/pull/5720). + ## 0.5.0 - Deprecate `void` crate. diff --git a/misc/connection-limits/Cargo.toml b/misc/connection-limits/Cargo.toml index 77a9bac46ef..8b1534ce352 100644 --- a/misc/connection-limits/Cargo.toml +++ b/misc/connection-limits/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-connection-limits" edition = "2021" rust-version = { workspace = true } description = "Connection limits for libp2p." -version = "0.5.0" +version = "0.5.1" license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" keywords = ["peer-to-peer", "libp2p", "networking"] diff --git a/misc/connection-limits/src/lib.rs b/misc/connection-limits/src/lib.rs index 93e41081a14..bd95dd6760c 100644 --- a/misc/connection-limits/src/lib.rs +++ b/misc/connection-limits/src/lib.rs @@ -46,6 +46,9 @@ use libp2p_swarm::{ /// contain a [`ConnectionDenied`] type that can be downcast to [`Exceeded`] error if (and only if) /// **this** behaviour denied the connection. /// +/// You can also set Peer IDs that bypass the said limit. Connections that +/// match the bypass rules will not be checked against or counted for limits. +/// /// If you employ multiple [`NetworkBehaviour`]s that manage connections, /// it may also be a different error. /// @@ -67,6 +70,8 @@ use libp2p_swarm::{ /// ``` pub struct Behaviour { limits: ConnectionLimits, + /// Peer IDs that bypass limit check, regardless of inbound or outbound. + bypass_peer_id: HashSet, pending_inbound_connections: HashSet, pending_outbound_connections: HashSet, @@ -79,6 +84,7 @@ impl Behaviour { pub fn new(limits: ConnectionLimits) -> Self { Self { limits, + bypass_peer_id: Default::default(), pending_inbound_connections: Default::default(), pending_outbound_connections: Default::default(), established_inbound_connections: Default::default(), @@ -92,6 +98,19 @@ impl Behaviour { pub fn limits_mut(&mut self) -> &mut ConnectionLimits { &mut self.limits } + + /// Add the peer to bypass list. + pub fn bypass_peer_id(&mut self, peer_id: &PeerId) { + self.bypass_peer_id.insert(*peer_id); + } + /// Remove the peer from bypass list. + pub fn remove_peer_id(&mut self, peer_id: &PeerId) { + self.bypass_peer_id.remove(peer_id); + } + /// Whether the connection is bypassed. + pub fn is_bypassed(&self, remote_peer: &PeerId) -> bool { + self.bypass_peer_id.contains(remote_peer) + } } fn check_limit(limit: Option, current: usize, kind: Kind) -> Result<(), ConnectionDenied> { @@ -238,6 +257,9 @@ impl NetworkBehaviour for Behaviour { ) -> Result, ConnectionDenied> { self.pending_inbound_connections.remove(&connection_id); + if self.is_bypassed(&peer) { + return Ok(dummy::ConnectionHandler); + } check_limit( self.limits.max_established_incoming, self.established_inbound_connections.len(), @@ -264,10 +286,13 @@ impl NetworkBehaviour for Behaviour { fn handle_pending_outbound_connection( &mut self, connection_id: ConnectionId, - _: Option, + maybe_peer: Option, _: &[Multiaddr], _: Endpoint, ) -> Result, ConnectionDenied> { + if maybe_peer.is_some_and(|peer| self.is_bypassed(&peer)) { + return Ok(vec![]); + } check_limit( self.limits.max_pending_outgoing, self.pending_outbound_connections.len(), @@ -288,6 +313,9 @@ impl NetworkBehaviour for Behaviour { _: PortUse, ) -> Result, ConnectionDenied> { self.pending_outbound_connections.remove(&connection_id); + if self.is_bypassed(&peer) { + return Ok(dummy::ConnectionHandler); + } check_limit( self.limits.max_established_outgoing, @@ -385,8 +413,7 @@ mod tests { use super::*; - #[test] - fn max_outgoing() { + fn fill_outgoing() -> (Swarm, Multiaddr, u32) { use rand::Rng; let outgoing_limit = rand::thread_rng().gen_range(1..10); @@ -411,10 +438,15 @@ mod tests { ) .expect("Unexpected connection limit."); } + (network, addr, outgoing_limit) + } + #[test] + fn max_outgoing() { + let (mut network, addr, outgoing_limit) = fill_outgoing(); match network .dial( - DialOpts::peer_id(target) + DialOpts::peer_id(PeerId::random()) .condition(PeerCondition::Always) .addresses(vec![addr]) .build(), @@ -439,6 +471,47 @@ mod tests { ); } + #[test] + fn outgoing_limit_bypass() { + let (mut network, addr, _) = fill_outgoing(); + let bypassed_peer = PeerId::random(); + network + .behaviour_mut() + .limits + .bypass_peer_id(&bypassed_peer); + assert!(network.behaviour().limits.is_bypassed(&bypassed_peer)); + if let Err(DialError::Denied { cause }) = network.dial( + DialOpts::peer_id(bypassed_peer) + .addresses(vec![addr.clone()]) + .build(), + ) { + cause + .downcast::() + .expect_err("Unexpected connection denied because of limit"); + } + let not_bypassed_peer = loop { + let new_peer = PeerId::random(); + if new_peer != bypassed_peer { + break new_peer; + } + }; + match network + .dial( + DialOpts::peer_id(not_bypassed_peer) + .addresses(vec![addr]) + .build(), + ) + .expect_err("Unexpected dialing success.") + { + DialError::Denied { cause } => { + cause + .downcast::() + .expect("connection denied because of limit"); + } + e => panic!("Unexpected error: {e:?}"), + } + } + #[test] fn max_established_incoming() { fn prop(Limit(limit): Limit) { @@ -479,13 +552,65 @@ mod tests { }); } - #[derive(Debug, Clone)] - struct Limit(u32); + quickcheck(prop as fn(_)); + } - impl Arbitrary for Limit { - fn arbitrary(g: &mut Gen) -> Self { - Self(g.gen_range(1..10)) - } + #[test] + fn bypass_established_incoming() { + fn prop(Limit(limit): Limit) { + let mut swarm1 = Swarm::new_ephemeral(|_| { + Behaviour::new( + ConnectionLimits::default().with_max_established_incoming(Some(limit)), + ) + }); + let mut swarm2 = Swarm::new_ephemeral(|_| { + Behaviour::new( + ConnectionLimits::default().with_max_established_incoming(Some(limit)), + ) + }); + let mut swarm3 = Swarm::new_ephemeral(|_| { + Behaviour::new( + ConnectionLimits::default().with_max_established_incoming(Some(limit)), + ) + }); + + let rt = Runtime::new().unwrap(); + let bypassed_peer_id = *swarm3.local_peer_id(); + swarm1 + .behaviour_mut() + .limits + .bypass_peer_id(&bypassed_peer_id); + + rt.block_on(async { + let (listen_addr, _) = swarm1.listen().with_memory_addr_external().await; + + for _ in 0..limit { + swarm2.connect(&mut swarm1).await; + } + + swarm3.dial(listen_addr.clone()).unwrap(); + + tokio::spawn(swarm2.loop_on_next()); + tokio::spawn(swarm3.loop_on_next()); + + swarm1 + .wait(|event| match event { + SwarmEvent::ConnectionEstablished { peer_id, .. } => { + (peer_id == bypassed_peer_id).then_some(()) + } + SwarmEvent::IncomingConnectionError { + error: ListenError::Denied { cause }, + .. + } => { + cause + .downcast::() + .expect_err("Unexpected connection denied because of limit"); + None + } + _ => None, + }) + .await; + }); } quickcheck(prop as fn(_)); @@ -609,4 +734,13 @@ mod tests { Poll::Pending } } + + #[derive(Debug, Clone)] + struct Limit(u32); + + impl Arbitrary for Limit { + fn arbitrary(g: &mut Gen) -> Self { + Self(g.gen_range(1..10)) + } + } } From 79a1001aa903126c945c8aa468620936a8494783 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Wed, 5 Feb 2025 13:48:32 +0000 Subject: [PATCH 54/56] chore(ci): fix interop tests See https://github.com/libp2p/test-plans/issues/604 for more info Pull-Request: #5850. --- .github/workflows/interop-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/interop-test.yml b/.github/workflows/interop-test.yml index c88579be68a..406bea27205 100644 --- a/.github/workflows/interop-test.yml +++ b/.github/workflows/interop-test.yml @@ -35,6 +35,7 @@ jobs: uses: libp2p/test-plans/.github/actions/run-transport-interop-test@master with: test-filter: ${{ matrix.flavour }}-rust-libp2p-head + test-results-suffix: ${{matrix.flavour}} extra-versions: ${{ github.workspace }}/interop-tests/${{ matrix.flavour }}-ping-version.json s3-cache-bucket: ${{ vars.S3_LIBP2P_BUILD_CACHE_BUCKET_NAME }} s3-access-key-id: ${{ vars.S3_LIBP2P_BUILD_CACHE_AWS_ACCESS_KEY_ID }} From 56691dbc33de82e221da14ccea5edc04074e94c4 Mon Sep 17 00:00:00 2001 From: Shiyas Mohammed <83513144+shiyasmohd@users.noreply.github.com> Date: Wed, 5 Feb 2025 21:04:15 +0530 Subject: [PATCH 55/56] chore(kad): migrate tests from async-std to tokio Migrating tests in `protocols/kad` from `async_std` to `tokio` as per https://github.com/libp2p/rust-libp2p/issues/4449 Pull-Request: #5851. --- Cargo.lock | 2 +- protocols/kad/Cargo.toml | 2 +- protocols/kad/src/bootstrap.rs | 22 +++++++++++----------- protocols/kad/tests/client_mode.rs | 14 +++++++------- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4ef99e33372..e1fedcba41b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2938,7 +2938,6 @@ dependencies = [ name = "libp2p-kad" version = "0.47.0" dependencies = [ - "async-std", "asynchronous-codec", "bytes", "either", @@ -2961,6 +2960,7 @@ dependencies = [ "sha2 0.10.8", "smallvec", "thiserror 2.0.9", + "tokio", "tracing", "tracing-subscriber", "uint", diff --git a/protocols/kad/Cargo.toml b/protocols/kad/Cargo.toml index 0e4fb608d15..fcaa0088dc0 100644 --- a/protocols/kad/Cargo.toml +++ b/protocols/kad/Cargo.toml @@ -33,7 +33,7 @@ thiserror = { workspace = true } tracing = { workspace = true } [dev-dependencies] -async-std = { version = "1.12.0", features = ["attributes"] } +tokio = { workspace = true, features = ["macros", "rt-multi-thread", "time"] } futures-timer = "3.0" libp2p-identify = { path = "../identify" } libp2p-noise = { workspace = true } diff --git a/protocols/kad/src/bootstrap.rs b/protocols/kad/src/bootstrap.rs index d6576a3ef54..9fa5d17ab5d 100644 --- a/protocols/kad/src/bootstrap.rs +++ b/protocols/kad/src/bootstrap.rs @@ -198,7 +198,7 @@ mod tests { do_bootstrap(status); } - #[async_std::test] + #[tokio::test] async fn immediate_automatic_bootstrap_is_triggered_immediately() { let mut status = Status::new(Some(Duration::from_secs(1)), Some(Duration::ZERO)); @@ -216,14 +216,14 @@ mod tests { ); assert!( - async_std::future::timeout(Duration::from_millis(500), status.next()) + tokio::time::timeout(Duration::from_millis(500), status.next()) .await .is_ok(), "bootstrap to be triggered in less then the configured delay because we connected to a new peer" ); } - #[async_std::test] + #[tokio::test] async fn delayed_automatic_bootstrap_is_triggered_before_periodic_bootstrap() { let mut status = Status::new(Some(Duration::from_secs(1)), Some(MS_5)); @@ -241,7 +241,7 @@ mod tests { ); assert!( - async_std::future::timeout(MS_5 * 2, status.next()) + tokio::time::timeout(MS_5 * 2, status.next()) .await .is_ok(), "bootstrap to be triggered in less then the configured periodic delay because we connected to a new peer" @@ -263,7 +263,7 @@ mod tests { ) } - #[async_std::test] + #[tokio::test] async fn given_periodic_bootstrap_when_routing_table_updated_then_wont_bootstrap_until_next_interval( ) { let mut status = Status::new(Some(MS_100), Some(MS_5)); @@ -283,7 +283,7 @@ mod tests { assert!(elapsed > MS_100); } - #[async_std::test] + #[tokio::test] async fn given_no_periodic_bootstrap_and_automatic_bootstrap_when_new_entry_then_will_bootstrap( ) { let mut status = Status::new(None, Some(Duration::ZERO)); @@ -293,7 +293,7 @@ mod tests { status.next().await; } - #[async_std::test] + #[tokio::test] async fn given_periodic_bootstrap_and_no_automatic_bootstrap_triggers_periodically() { let mut status = Status::new(Some(MS_100), None); @@ -308,7 +308,7 @@ mod tests { } } - #[async_std::test] + #[tokio::test] async fn given_no_periodic_bootstrap_and_automatic_bootstrap_reset_throttle_when_multiple_peers( ) { let mut status = Status::new(None, Some(MS_100)); @@ -327,14 +327,14 @@ mod tests { Delay::new(MS_100 - MS_5).await; assert!( - async_std::future::timeout(MS_5*2, status.next()) + tokio::time::timeout(MS_5*2, status.next()) .await .is_ok(), "bootstrap to be triggered in the configured throttle delay because we connected to a new peer" ); } - #[async_std::test] + #[tokio::test] async fn given_periodic_bootstrap_and_no_automatic_bootstrap_manually_triggering_prevent_periodic( ) { let mut status = Status::new(Some(MS_100), None); @@ -347,7 +347,7 @@ mod tests { status.on_finish(); assert!( - async_std::future::timeout(10 * MS_100, status.next()) + tokio::time::timeout(10 * MS_100, status.next()) .await .is_err(), "periodic bootstrap to never be triggered because one is still being run" diff --git a/protocols/kad/tests/client_mode.rs b/protocols/kad/tests/client_mode.rs index 3275c525890..d741299eb2c 100644 --- a/protocols/kad/tests/client_mode.rs +++ b/protocols/kad/tests/client_mode.rs @@ -7,7 +7,7 @@ use tracing_subscriber::EnvFilter; use Event::*; use MyBehaviourEvent::*; -#[async_std::test] +#[tokio::test] async fn server_gets_added_to_routing_table_by_client() { let _ = tracing_subscriber::fmt() .with_env_filter(EnvFilter::from_default_env()) @@ -20,7 +20,7 @@ async fn server_gets_added_to_routing_table_by_client() { client.connect(&mut server).await; let server_peer_id = *server.local_peer_id(); - async_std::task::spawn(server.loop_on_next()); + tokio::spawn(server.loop_on_next()); let external_event_peer = client .wait(|e| match e { @@ -39,7 +39,7 @@ async fn server_gets_added_to_routing_table_by_client() { assert_eq!(routing_updated_peer, server_peer_id); } -#[async_std::test] +#[tokio::test] async fn two_servers_add_each_other_to_routing_table() { let _ = tracing_subscriber::fmt() .with_env_filter(EnvFilter::from_default_env()) @@ -68,7 +68,7 @@ async fn two_servers_add_each_other_to_routing_table() { server1.listen().with_memory_addr_external().await; server2.connect(&mut server1).await; - async_std::task::spawn(server1.loop_on_next()); + tokio::spawn(server1.loop_on_next()); let peer = server2 .wait(|e| match e { @@ -80,7 +80,7 @@ async fn two_servers_add_each_other_to_routing_table() { assert_eq!(peer, server1_peer_id); } -#[async_std::test] +#[tokio::test] async fn adding_an_external_addresses_activates_server_mode_on_existing_connections() { let _ = tracing_subscriber::fmt() .with_env_filter(EnvFilter::from_default_env()) @@ -118,7 +118,7 @@ async fn adding_an_external_addresses_activates_server_mode_on_existing_connecti } } -#[async_std::test] +#[tokio::test] async fn set_client_to_server_mode() { let _ = tracing_subscriber::fmt() .with_env_filter(EnvFilter::from_default_env()) @@ -160,7 +160,7 @@ async fn set_client_to_server_mode() { client.behaviour_mut().kad.set_mode(Some(Mode::Server)); - async_std::task::spawn(client.loop_on_next()); + tokio::spawn(client.loop_on_next()); let info = server .wait(|e| match e { From 5f0d3f2edfafac052068170ebf9e7f1e28db9600 Mon Sep 17 00:00:00 2001 From: Elena Frank Date: Sat, 8 Feb 2025 20:25:01 +0700 Subject: [PATCH 56/56] chore: fix spelling mistakes using crate-ci/typos Fix spelling mistakes and typos in all source files using the [crate-ci/typos](https://github.com/crate-ci/typos) CLI tool. Pull-Request: #5853. --- core/CHANGELOG.md | 4 ++-- core/src/signed_envelope.rs | 2 +- core/src/transport.rs | 2 +- core/src/transport/upgrade.rs | 2 +- docs/maintainer-handbook.md | 2 +- examples/file-sharing/README.md | 2 +- identity/src/rsa.rs | 2 +- interop-tests/README.md | 2 +- misc/multistream-select/src/protocol.rs | 2 +- protocols/autonat/CHANGELOG.md | 6 +++--- protocols/autonat/src/v2.rs | 2 +- protocols/dcutr/CHANGELOG.md | 4 ++-- protocols/floodsub/CHANGELOG.md | 2 +- protocols/floodsub/src/generated/rpc.proto | 2 +- protocols/gossipsub/CHANGELOG.md | 6 +++--- protocols/gossipsub/src/behaviour/tests.rs | 2 +- protocols/gossipsub/src/config.rs | 2 +- protocols/gossipsub/src/peer_score/tests.rs | 2 +- protocols/gossipsub/src/topic.rs | 6 +++--- protocols/identify/CHANGELOG.md | 6 +++--- protocols/kad/CHANGELOG.md | 2 +- protocols/mdns/CHANGELOG.md | 4 ++-- protocols/perf/src/protocol.rs | 14 +++++++------- protocols/ping/CHANGELOG.md | 6 +++--- protocols/relay/CHANGELOG.md | 6 +++--- protocols/request-response/CHANGELOG.md | 4 ++-- protocols/request-response/src/lib.rs | 2 +- swarm/CHANGELOG.md | 6 +++--- swarm/src/handler.rs | 2 +- swarm/src/test.rs | 4 ++-- transports/webtransport-websys/CHANGELOG.md | 2 +- 31 files changed, 56 insertions(+), 56 deletions(-) diff --git a/core/CHANGELOG.md b/core/CHANGELOG.md index 003120954e7..898031c006e 100644 --- a/core/CHANGELOG.md +++ b/core/CHANGELOG.md @@ -326,7 +326,7 @@ See [PR 4568]. - Remove `TInEvent` and `TOutEvent` trait parameters on most public types. `TInEvent` and `TOutEvent` are implied through `THandler` and thus - superflucious. Both are removed in favor of a derivation through `THandler` + superfluous. Both are removed in favor of a derivation through `THandler` (see [PR 2183]). - Require `ConnectionHandler::{InEvent,OutEvent,Error}` to implement `Debug` @@ -445,7 +445,7 @@ See [PR 4568]. - New configurable connection limits for established connections and dedicated connection counters. Removed the connection limit dedicated to outgoing pending connection _per peer_. Connection limits are now - represented by `u32` intead of `usize` types. + represented by `u32` instead of `usize` types. [PR 1848](https://github.com/libp2p/rust-libp2p/pull/1848/). - Update `multihash`. diff --git a/core/src/signed_envelope.rs b/core/src/signed_envelope.rs index 754d6ec204d..9a08c6d3d34 100644 --- a/core/src/signed_envelope.rs +++ b/core/src/signed_envelope.rs @@ -49,7 +49,7 @@ impl SignedEnvelope { /// Extract the payload and signing key of this [`SignedEnvelope`]. /// /// You must provide the correct domain-separation string and expected payload type in order to - /// get the payload. This guards against accidental mis-use of the payload where the + /// get the payload. This guards against accidental misuse of the payload where the /// signature was created for a different purpose or payload type. /// /// It is the caller's responsibility to check that the signing key is what diff --git a/core/src/transport.rs b/core/src/transport.rs index ecd332f28cc..58a9c2a9557 100644 --- a/core/src/transport.rs +++ b/core/src/transport.rs @@ -104,7 +104,7 @@ pub struct DialOpts { /// by a [`Transport`] through an upgrade mechanism that is initiated via /// [`upgrade`](Transport::upgrade). /// -/// Note for implementors: Futures returned by [`Transport::dial`] should only +/// Note for implementers: Futures returned by [`Transport::dial`] should only /// do work once polled for the first time. E.g. in the case of TCP, connecting /// to the remote should not happen immediately on [`Transport::dial`] but only /// once the returned [`Future`] is polled. The caller of [`Transport::dial`] diff --git a/core/src/transport/upgrade.rs b/core/src/transport/upgrade.rs index 480c2710020..df0038c3cf5 100644 --- a/core/src/transport/upgrade.rs +++ b/core/src/transport/upgrade.rs @@ -185,7 +185,7 @@ where } } -/// An transport with peer authentication, obtained from [`Builder::authenticate`]. +/// A transport with peer authentication, obtained from [`Builder::authenticate`]. #[derive(Clone)] pub struct Authenticated(Builder); diff --git a/docs/maintainer-handbook.md b/docs/maintainer-handbook.md index 0b090901216..32dd3d62a8b 100644 --- a/docs/maintainer-handbook.md +++ b/docs/maintainer-handbook.md @@ -1,6 +1,6 @@ # Maintainer handbook -This document describes what ever maintainer of the repository should know. +This document describes whatever maintainer of the repository should know. ## GitHub settings diff --git a/examples/file-sharing/README.md b/examples/file-sharing/README.md index 5424026bb12..7a10be8172a 100644 --- a/examples/file-sharing/README.md +++ b/examples/file-sharing/README.md @@ -29,7 +29,7 @@ Let's understand the flow of the file sharing process: The File Sharing application has the following architectural properties: -- **Clean and Clonable Interface**: The application provides a clean and clonable async/await interface, allowing users to interact with the network layer seamlessly. +- **Clean and Cloneable Interface**: The application provides a clean and cloneable async/await interface, allowing users to interact with the network layer seamlessly. The `Client` module encapsulates the necessary functionality for network communication. - **Efficient Network Handling**: The application operates with a single task that drives the network layer. diff --git a/identity/src/rsa.rs b/identity/src/rsa.rs index b14d8c66d86..00c4b65a3bc 100644 --- a/identity/src/rsa.rs +++ b/identity/src/rsa.rs @@ -105,7 +105,7 @@ impl PublicKey { self.0.clone() } - /// Encode the RSA public key in DER as a X.509 SubjectPublicKeyInfo structure, + /// Encode the RSA public key in DER as an X.509 SubjectPublicKeyInfo structure, /// as defined in [RFC5280]. /// /// [RFC5280]: https://tools.ietf.org/html/rfc5280#section-4.1 diff --git a/interop-tests/README.md b/interop-tests/README.md index c2805ddf707..04ef96286c3 100644 --- a/interop-tests/README.md +++ b/interop-tests/README.md @@ -39,7 +39,7 @@ To run the webrtc-direct test, you'll need the `chromedriver` in your `$PATH`, c # Running all interop tests locally with Compose To run this test against all released libp2p versions you'll need to have the -(libp2p/test-plans)[https://github.com/libp2p/test-plans] checked out. Then do +[libp2p/test-plans](https://github.com/libp2p/test-plans) checked out. Then do the following (from the root directory of this repository): 1. Build the image: `docker build -t rust-libp2p-head . -f interop-tests/Dockerfile`. diff --git a/misc/multistream-select/src/protocol.rs b/misc/multistream-select/src/protocol.rs index 93cd4ac02b5..9b015c3c502 100644 --- a/misc/multistream-select/src/protocol.rs +++ b/misc/multistream-select/src/protocol.rs @@ -120,7 +120,7 @@ impl fmt::Display for Protocol { /// A multistream-select protocol message. /// /// Multistream-select protocol messages are exchanged with the goal -/// of agreeing on a application-layer protocol to use on an I/O stream. +/// of agreeing on an application-layer protocol to use on an I/O stream. #[derive(Debug, Clone, PartialEq, Eq)] pub(crate) enum Message { /// A header message identifies the multistream-select protocol diff --git a/protocols/autonat/CHANGELOG.md b/protocols/autonat/CHANGELOG.md index 36c8752deed..16319724432 100644 --- a/protocols/autonat/CHANGELOG.md +++ b/protocols/autonat/CHANGELOG.md @@ -14,7 +14,7 @@ ## 0.13.0 -- Due to the refactor of `Transport` it's no longer required to create a seperate transport for +- Due to the refactor of `Transport` it's no longer required to create a separate transport for AutoNAT where port reuse is disabled. This information is now passed by the behaviour. See [PR 4568](https://github.com/libp2p/rust-libp2p/pull/4568). - Introduce the new AutoNATv2 protocol. @@ -34,7 +34,7 @@ AutoNAT where port reuse is disabled. This information is now passed by the beha ## 0.12.0 - Remove `Clone`, `PartialEq` and `Eq` implementations on `Event` and its sub-structs. - The `Event` also contains errors which are not clonable or comparable. + The `Event` also contains errors which are not cloneable or comparable. See [PR 3914](https://github.com/libp2p/rust-libp2p/pull/3914). ## 0.11.0 @@ -84,7 +84,7 @@ AutoNAT where port reuse is disabled. This information is now passed by the beha - Update to `libp2p-request-response` `v0.23.0`. -- Replace `Behaviour`'s `NetworkBehaviour` implemention `inject_*` methods with the new `on_*` methods. +- Replace `Behaviour`'s `NetworkBehaviour` implementation `inject_*` methods with the new `on_*` methods. See [PR 3011]. - Update `rust-version` to reflect the actual MSRV: 1.62.0. See [PR 3090]. diff --git a/protocols/autonat/src/v2.rs b/protocols/autonat/src/v2.rs index 94decf50a55..045c0c52546 100644 --- a/protocols/autonat/src/v2.rs +++ b/protocols/autonat/src/v2.rs @@ -4,7 +4,7 @@ //! //! The new version fixes the issues of the first version: //! - The server now always dials back over a newly allocated port. This greatly reduces the risk of -//! false positives that often occurred in the first version, when the clinet-server connection +//! false positives that often occurred in the first version, when the client-server connection //! occurred over a hole-punched port. //! - The server protects against DoS attacks by requiring the client to send more data to the //! server then the dial back puts on the client, thus making the protocol unatractive for an diff --git a/protocols/dcutr/CHANGELOG.md b/protocols/dcutr/CHANGELOG.md index 7fb02fabcbd..61d6d0fff3a 100644 --- a/protocols/dcutr/CHANGELOG.md +++ b/protocols/dcutr/CHANGELOG.md @@ -75,10 +75,10 @@ - Update to `libp2p-swarm` `v0.41.0`. -- Replace `Behaviour`'s `NetworkBehaviour` implemention `inject_*` methods with the new `on_*` methods. +- Replace `Behaviour`'s `NetworkBehaviour` implementation `inject_*` methods with the new `on_*` methods. See [PR 3011]. -- Replace `direct::Handler` and `relayed::Handler`'s `ConnectionHandler` implemention `inject_*` +- Replace `direct::Handler` and `relayed::Handler`'s `ConnectionHandler` implementation `inject_*` methods with the new `on_*` methods. See [PR 3085]. - Update `rust-version` to reflect the actual MSRV: 1.62.0. See [PR 3090]. diff --git a/protocols/floodsub/CHANGELOG.md b/protocols/floodsub/CHANGELOG.md index 65e1ee8251a..959bf539108 100644 --- a/protocols/floodsub/CHANGELOG.md +++ b/protocols/floodsub/CHANGELOG.md @@ -36,7 +36,7 @@ - Update to `libp2p-swarm` `v0.41.0`. -- Replace `Floodsub`'s `NetworkBehaviour` implemention `inject_*` methods with the new `on_*` methods. +- Replace `Floodsub`'s `NetworkBehaviour` implementation `inject_*` methods with the new `on_*` methods. See [PR 3011]. - Update `rust-version` to reflect the actual MSRV: 1.62.0. See [PR 3090]. diff --git a/protocols/floodsub/src/generated/rpc.proto b/protocols/floodsub/src/generated/rpc.proto index 84f0ea51795..5a711bdd5dd 100644 --- a/protocols/floodsub/src/generated/rpc.proto +++ b/protocols/floodsub/src/generated/rpc.proto @@ -7,7 +7,7 @@ message RPC { repeated Message publish = 2; message SubOpts { - optional bool subscribe = 1; // subscribe or unsubcribe + optional bool subscribe = 1; // subscribe or unsubscribe optional string topic_id = 2; } } diff --git a/protocols/gossipsub/CHANGELOG.md b/protocols/gossipsub/CHANGELOG.md index 20be0410036..6cb7bd62031 100644 --- a/protocols/gossipsub/CHANGELOG.md +++ b/protocols/gossipsub/CHANGELOG.md @@ -39,7 +39,7 @@ - Fix `cargo clippy` warnings in `rustc 1.84.0-beta.1`. See [PR 5700](https://github.com/libp2p/rust-libp2p/pull/5700). -- Fixe an issue where an `InsufficientPeers` error could occur under certain conditions, despite having peers subscribed to a topic. +- Fix an issue where an `InsufficientPeers` error could occur under certain conditions, despite having peers subscribed to a topic. See [PR 5793](https://github.com/libp2p/rust-libp2p/pull/5793). @@ -75,7 +75,7 @@ - Deprecate `gossipsub::Config::idle_timeout` in favor of `SwarmBuilder::idle_connection_timeout`. See [PR 4648]. -