From fe5ee71bf803c6da100f16475bac10faa5ae9fd0 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Mon, 7 Nov 2022 17:16:17 +1100 Subject: [PATCH 01/23] Set MSRV correctly for all crates --- .github/workflows/ci.yml | 4 ++-- Cargo.toml | 2 +- core/Cargo.toml | 2 +- misc/metrics/Cargo.toml | 2 +- misc/multistream-select/Cargo.toml | 2 +- misc/prost-codec/Cargo.toml | 2 +- misc/rw-stream-sink/Cargo.toml | 1 + muxers/mplex/Cargo.toml | 2 +- muxers/yamux/Cargo.toml | 2 +- protocols/autonat/Cargo.toml | 2 +- protocols/dcutr/Cargo.toml | 2 +- protocols/floodsub/Cargo.toml | 2 +- protocols/gossipsub/Cargo.toml | 2 +- protocols/identify/Cargo.toml | 2 +- protocols/kad/Cargo.toml | 2 +- protocols/mdns/Cargo.toml | 2 +- protocols/ping/Cargo.toml | 2 +- protocols/relay/Cargo.toml | 2 +- protocols/rendezvous/Cargo.toml | 2 +- protocols/request-response/Cargo.toml | 2 +- swarm-derive/Cargo.toml | 2 +- swarm/Cargo.toml | 2 +- transports/deflate/Cargo.toml | 2 +- transports/dns/Cargo.toml | 2 +- transports/noise/Cargo.toml | 2 +- transports/plaintext/Cargo.toml | 2 +- transports/pnet/Cargo.toml | 2 +- transports/tcp/Cargo.toml | 2 +- transports/tls/Cargo.toml | 1 + transports/uds/Cargo.toml | 2 +- transports/wasm-ext/Cargo.toml | 2 +- transports/websocket/Cargo.toml | 2 +- 32 files changed, 33 insertions(+), 31 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3132710f408..aef67c3d31f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ concurrency: cancel-in-progress: true jobs: - test-desktop: + test-desktop: # Run tests, MSRV and semver checks for each crate. name: Build and test runs-on: ubuntu-latest strategy: @@ -218,6 +218,6 @@ jobs: - uses: Swatinem/rust-cache@22c9328bcba27aa81a32b1bef27c7e3c78052531 # v2.0.1 - run: cargo install cargo-semver-checks - + - name: Semver Check run: cargo semver-checks check-release -p ${{ matrix.crate }} diff --git a/Cargo.toml b/Cargo.toml index e0086fe5e01..6c95a058036 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "libp2p" edition = "2021" -rust-version = "1.60.0" +rust-version = "1.62.0" description = "Peer-to-peer networking library" version = "0.50.0" authors = ["Parity Technologies "] diff --git a/core/Cargo.toml b/core/Cargo.toml index 07cec58c002..6b36c6c0b0a 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "libp2p-core" edition = "2021" -rust-version = "1.56.1" +rust-version = "1.60.0" description = "Core traits and structs of libp2p" version = "0.38.0" authors = ["Parity Technologies "] diff --git a/misc/metrics/Cargo.toml b/misc/metrics/Cargo.toml index 54f3271fbd0..c2821752ffc 100644 --- a/misc/metrics/Cargo.toml +++ b/misc/metrics/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "libp2p-metrics" edition = "2021" -rust-version = "1.56.1" +rust-version = "1.62.0" description = "Metrics for libp2p" version = "0.11.0" authors = ["Max Inden "] diff --git a/misc/multistream-select/Cargo.toml b/misc/multistream-select/Cargo.toml index 8dced22ffcd..a5fdfe686e9 100644 --- a/misc/multistream-select/Cargo.toml +++ b/misc/multistream-select/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "multistream-select" edition = "2021" -rust-version = "1.56.1" +rust-version = "1.60.0" description = "Multistream-select negotiation protocol for libp2p" version = "0.12.0" authors = ["Parity Technologies "] diff --git a/misc/prost-codec/Cargo.toml b/misc/prost-codec/Cargo.toml index 09c725c1c90..f86bf7ba470 100644 --- a/misc/prost-codec/Cargo.toml +++ b/misc/prost-codec/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "prost-codec" edition = "2021" -rust-version = "1.56.1" +rust-version = "1.60.0" description = "Asynchronous de-/encoding of Protobuf structs using asynchronous-codec, unsigned-varint and prost." version = "0.3.0" authors = ["Max Inden "] diff --git a/misc/rw-stream-sink/Cargo.toml b/misc/rw-stream-sink/Cargo.toml index dba6ff992f1..df6b39cbfc2 100644 --- a/misc/rw-stream-sink/Cargo.toml +++ b/misc/rw-stream-sink/Cargo.toml @@ -2,6 +2,7 @@ name = "rw-stream-sink" edition = "2021" description = "Adaptator between Stream/Sink and AsyncRead/AsyncWrite" +rust-version = "1.60.0" version = "0.3.0" authors = ["Parity Technologies "] license = "MIT" diff --git a/muxers/mplex/Cargo.toml b/muxers/mplex/Cargo.toml index 94bd697cef0..ed145426f85 100644 --- a/muxers/mplex/Cargo.toml +++ b/muxers/mplex/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "libp2p-mplex" edition = "2021" -rust-version = "1.56.1" +rust-version = "1.60.0" description = "Mplex multiplexing protocol for libp2p" version = "0.38.0" authors = ["Parity Technologies "] diff --git a/muxers/yamux/Cargo.toml b/muxers/yamux/Cargo.toml index cb8a1e4e5ef..8bb90a86362 100644 --- a/muxers/yamux/Cargo.toml +++ b/muxers/yamux/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "libp2p-yamux" edition = "2021" -rust-version = "1.56.1" +rust-version = "1.60.0" description = "Yamux multiplexing protocol for libp2p" version = "0.42.0" authors = ["Parity Technologies "] diff --git a/protocols/autonat/Cargo.toml b/protocols/autonat/Cargo.toml index 10fd0e71ff5..80bbb54fcbb 100644 --- a/protocols/autonat/Cargo.toml +++ b/protocols/autonat/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "libp2p-autonat" edition = "2021" -rust-version = "1.56.1" +rust-version = "1.62.0" description = "NAT and firewall detection for libp2p" version = "0.9.0" authors = ["David Craven ", "Elena Frank "] diff --git a/protocols/dcutr/Cargo.toml b/protocols/dcutr/Cargo.toml index 33486f494a2..fa161f479fd 100644 --- a/protocols/dcutr/Cargo.toml +++ b/protocols/dcutr/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "libp2p-dcutr" edition = "2021" -rust-version = "1.56.1" +rust-version = "1.62.0" description = "Direct connection upgrade through relay" version = "0.8.0" authors = ["Max Inden "] diff --git a/protocols/floodsub/Cargo.toml b/protocols/floodsub/Cargo.toml index 1225d1cd99d..70731cd3eea 100644 --- a/protocols/floodsub/Cargo.toml +++ b/protocols/floodsub/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "libp2p-floodsub" edition = "2021" -rust-version = "1.56.1" +rust-version = "1.62.0" description = "Floodsub protocol for libp2p" version = "0.41.0" authors = ["Parity Technologies "] diff --git a/protocols/gossipsub/Cargo.toml b/protocols/gossipsub/Cargo.toml index 819805fd43f..6ab3a8c1df3 100644 --- a/protocols/gossipsub/Cargo.toml +++ b/protocols/gossipsub/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "libp2p-gossipsub" edition = "2021" -rust-version = "1.56.1" +rust-version = "1.62.0" description = "Gossipsub protocol for libp2p" version = "0.43.0" authors = ["Age Manning "] diff --git a/protocols/identify/Cargo.toml b/protocols/identify/Cargo.toml index c0d05b7039d..69dc2d97985 100644 --- a/protocols/identify/Cargo.toml +++ b/protocols/identify/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "libp2p-identify" edition = "2021" -rust-version = "1.56.1" +rust-version = "1.62.0" description = "Nodes identifcation protocol for libp2p" version = "0.41.0" authors = ["Parity Technologies "] diff --git a/protocols/kad/Cargo.toml b/protocols/kad/Cargo.toml index 8f91f34180c..195cd763190 100644 --- a/protocols/kad/Cargo.toml +++ b/protocols/kad/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "libp2p-kad" edition = "2021" -rust-version = "1.56.1" +rust-version = "1.62.0" description = "Kademlia protocol for libp2p" version = "0.42.0" authors = ["Parity Technologies "] diff --git a/protocols/mdns/Cargo.toml b/protocols/mdns/Cargo.toml index 5729043514e..9f6616e0373 100644 --- a/protocols/mdns/Cargo.toml +++ b/protocols/mdns/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "libp2p-mdns" edition = "2021" -rust-version = "1.56.1" +rust-version = "1.62.0" version = "0.42.0" description = "Implementation of the libp2p mDNS discovery method" authors = ["Parity Technologies "] diff --git a/protocols/ping/Cargo.toml b/protocols/ping/Cargo.toml index c26dbb225b9..b03cc6e765f 100644 --- a/protocols/ping/Cargo.toml +++ b/protocols/ping/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "libp2p-ping" edition = "2021" -rust-version = "1.56.1" +rust-version = "1.62.0" description = "Ping protocol for libp2p" version = "0.41.0" authors = ["Parity Technologies "] diff --git a/protocols/relay/Cargo.toml b/protocols/relay/Cargo.toml index 9c6e3528096..70bfea53e69 100644 --- a/protocols/relay/Cargo.toml +++ b/protocols/relay/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "libp2p-relay" edition = "2021" -rust-version = "1.56.1" +rust-version = "1.62.0" description = "Communications relaying for libp2p" version = "0.14.0" authors = ["Parity Technologies ", "Max Inden "] diff --git a/protocols/rendezvous/Cargo.toml b/protocols/rendezvous/Cargo.toml index 4f53d3cf23b..b4f5d127e69 100644 --- a/protocols/rendezvous/Cargo.toml +++ b/protocols/rendezvous/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "libp2p-rendezvous" edition = "2021" -rust-version = "1.56.1" +rust-version = "1.62.0" description = "Rendezvous protocol for libp2p" version = "0.11.0" authors = ["The COMIT guys "] diff --git a/protocols/request-response/Cargo.toml b/protocols/request-response/Cargo.toml index 63df7cd502a..4069873d280 100644 --- a/protocols/request-response/Cargo.toml +++ b/protocols/request-response/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "libp2p-request-response" edition = "2021" -rust-version = "1.56.1" +rust-version = "1.62.0" description = "Generic Request/Response Protocols" version = "0.23.0" authors = ["Parity Technologies "] diff --git a/swarm-derive/Cargo.toml b/swarm-derive/Cargo.toml index 622e23f5c09..3a1dea4f610 100644 --- a/swarm-derive/Cargo.toml +++ b/swarm-derive/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "libp2p-swarm-derive" edition = "2021" -rust-version = "1.56.1" +rust-version = "1.60.0" description = "Procedural macros of libp2p-core" version = "0.30.1" authors = ["Parity Technologies "] diff --git a/swarm/Cargo.toml b/swarm/Cargo.toml index 75dd0968b16..0db8b84672d 100644 --- a/swarm/Cargo.toml +++ b/swarm/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "libp2p-swarm" edition = "2021" -rust-version = "1.56.1" +rust-version = "1.62.0" description = "The libp2p swarm" version = "0.41.0" authors = ["Parity Technologies "] diff --git a/transports/deflate/Cargo.toml b/transports/deflate/Cargo.toml index 144a9af7688..83729d8e6cf 100644 --- a/transports/deflate/Cargo.toml +++ b/transports/deflate/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "libp2p-deflate" edition = "2021" -rust-version = "1.56.1" +rust-version = "1.60.0" description = "Deflate encryption protocol for libp2p" version = "0.38.0" authors = ["Parity Technologies "] diff --git a/transports/dns/Cargo.toml b/transports/dns/Cargo.toml index e0d27ba6dae..ec476685956 100644 --- a/transports/dns/Cargo.toml +++ b/transports/dns/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "libp2p-dns" edition = "2021" -rust-version = "1.56.1" +rust-version = "1.60.0" description = "DNS transport implementation for libp2p" version = "0.38.0" authors = ["Parity Technologies "] diff --git a/transports/noise/Cargo.toml b/transports/noise/Cargo.toml index 33800c1eed5..cf989e37154 100644 --- a/transports/noise/Cargo.toml +++ b/transports/noise/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "libp2p-noise" edition = "2021" -rust-version = "1.56.1" +rust-version = "1.60.0" description = "Cryptographic handshake protocol using the noise framework." version = "0.41.0" authors = ["Parity Technologies "] diff --git a/transports/plaintext/Cargo.toml b/transports/plaintext/Cargo.toml index 023172339d9..fcedb5ceb32 100644 --- a/transports/plaintext/Cargo.toml +++ b/transports/plaintext/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "libp2p-plaintext" edition = "2021" -rust-version = "1.56.1" +rust-version = "1.60.0" description = "Plaintext encryption dummy protocol for libp2p" version = "0.38.0" authors = ["Parity Technologies "] diff --git a/transports/pnet/Cargo.toml b/transports/pnet/Cargo.toml index edeb4ee8508..c2f7cc48dd4 100644 --- a/transports/pnet/Cargo.toml +++ b/transports/pnet/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "libp2p-pnet" edition = "2021" -rust-version = "1.56.1" +rust-version = "1.60.0" description = "Private swarm support for libp2p" version = "0.22.1" authors = ["Parity Technologies "] diff --git a/transports/tcp/Cargo.toml b/transports/tcp/Cargo.toml index 502e05cdf3a..cce0353910d 100644 --- a/transports/tcp/Cargo.toml +++ b/transports/tcp/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "libp2p-tcp" edition = "2021" -rust-version = "1.56.1" +rust-version = "1.60.0" description = "TCP/IP transport protocol for libp2p" version = "0.38.0" authors = ["Parity Technologies "] diff --git a/transports/tls/Cargo.toml b/transports/tls/Cargo.toml index d627cae566f..eef2b7226b7 100644 --- a/transports/tls/Cargo.toml +++ b/transports/tls/Cargo.toml @@ -2,6 +2,7 @@ name = "libp2p-tls" version = "0.1.0-alpha" edition = "2021" +rust-version = "1.60.0" license = "MIT" exclude = ["src/test_assets"] diff --git a/transports/uds/Cargo.toml b/transports/uds/Cargo.toml index 8bad4c54ebe..9dd1321a8b1 100644 --- a/transports/uds/Cargo.toml +++ b/transports/uds/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "libp2p-uds" edition = "2021" -rust-version = "1.56.1" +rust-version = "1.60.0" description = "Unix domain sockets transport for libp2p" version = "0.37.0" authors = ["Parity Technologies "] diff --git a/transports/wasm-ext/Cargo.toml b/transports/wasm-ext/Cargo.toml index e6317240b48..6c004aab039 100644 --- a/transports/wasm-ext/Cargo.toml +++ b/transports/wasm-ext/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "libp2p-wasm-ext" edition = "2021" -rust-version = "1.56.1" +rust-version = "1.60.0" description = "Allows passing in an external transport in a WASM environment" version = "0.38.0" authors = ["Pierre Krieger "] diff --git a/transports/websocket/Cargo.toml b/transports/websocket/Cargo.toml index 4b5e1da6e4f..cc848e58ca8 100644 --- a/transports/websocket/Cargo.toml +++ b/transports/websocket/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "libp2p-websocket" edition = "2021" -rust-version = "1.56.1" +rust-version = "1.60.0" description = "WebSocket transport for libp2p" version = "0.40.0" authors = ["Parity Technologies "] From a696fb52e092eb7effee9af53ca6baa0a1b0685b Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Tue, 8 Nov 2022 14:26:53 +1100 Subject: [PATCH 02/23] Don't include TLS on wasm platforms --- src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib.rs b/src/lib.rs index 2f8ac1abb02..19a655f2f2d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -111,6 +111,7 @@ pub use libp2p_swarm as swarm; pub use libp2p_tcp as tcp; #[cfg(feature = "tls")] #[cfg_attr(docsrs, doc(cfg(feature = "tls")))] +#[cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")))] #[doc(inline)] pub use libp2p_tls as tls; #[cfg(feature = "uds")] From e3c62ab6b525f15d9958a07c02af94153b3dd7eb Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Tue, 8 Nov 2022 14:28:11 +1100 Subject: [PATCH 03/23] Fix clippy warnings This includes warnings from the latest stable clippy but also for the next beta. --- core/src/identity/ecdsa.rs | 2 +- muxers/mplex/src/codec.rs | 2 +- protocols/autonat/src/behaviour/as_client.rs | 4 ++-- protocols/autonat/src/behaviour/as_server.rs | 2 +- protocols/dcutr/src/behaviour.rs | 2 +- protocols/gossipsub/src/behaviour.rs | 4 ++-- protocols/gossipsub/src/peer_score.rs | 2 +- protocols/gossipsub/src/peer_score/tests.rs | 2 +- protocols/gossipsub/src/subscription_filter.rs | 2 +- protocols/kad/src/kbucket/key.rs | 4 ++-- protocols/kad/src/query/peers/closest/disjoint.rs | 8 +++----- protocols/relay/src/v2/relay.rs | 4 ++-- protocols/rendezvous/src/client.rs | 4 ++-- protocols/rendezvous/src/server.rs | 2 +- 14 files changed, 21 insertions(+), 23 deletions(-) diff --git a/core/src/identity/ecdsa.rs b/core/src/identity/ecdsa.rs index 88411b23655..4accdde23a2 100644 --- a/core/src/identity/ecdsa.rs +++ b/core/src/identity/ecdsa.rs @@ -209,7 +209,7 @@ impl PublicKey { } let key_len = bitstr_head[1].checked_sub(1)? as usize; - let key_buf = asn1_buf.get(4 + oids_len + 3..4 + oids_len + 3 + key_len as usize)?; + let key_buf = asn1_buf.get(4 + oids_len + 3..4 + oids_len + 3 + key_len)?; Some(key_buf) } } diff --git a/muxers/mplex/src/codec.rs b/muxers/mplex/src/codec.rs index 3867cd27d8d..f7d986a87a3 100644 --- a/muxers/mplex/src/codec.rs +++ b/muxers/mplex/src/codec.rs @@ -226,7 +226,7 @@ impl Decoder for Codec { } let buf = src.split_to(len); - let num = (header >> 3) as u64; + let num = header >> 3; let out = match header & 7 { 0 => Frame::Open { stream_id: RemoteStreamId::dialer(num), diff --git a/protocols/autonat/src/behaviour/as_client.rs b/protocols/autonat/src/behaviour/as_client.rs index 5a5e18b6531..cbb63f6aa95 100644 --- a/protocols/autonat/src/behaviour/as_client.rs +++ b/protocols/autonat/src/behaviour/as_client.rs @@ -150,7 +150,7 @@ impl<'a> HandleInnerEvent for AsClient<'a> { // Update observed address score if it is finite. let score = params .external_addresses() - .find_map(|r| (r.addr == address).then(|| r.score)) + .find_map(|r| (r.addr == address).then_some(r.score)) .unwrap_or(AddressScore::Finite(0)); if let AddressScore::Finite(finite_score) = score { action = Some(NetworkBehaviourAction::ReportObservedAddr { @@ -266,7 +266,7 @@ impl<'a> AsClient<'a> { // Filter servers for which no qualified address is known. // This is the case if the connection is relayed or the address is // not global (in case of Config::only_global_ips). - addrs.values().any(|a| a.is_some()).then(|| id) + addrs.values().any(|a| a.is_some()).then_some(id) })); } diff --git a/protocols/autonat/src/behaviour/as_server.rs b/protocols/autonat/src/behaviour/as_server.rs index 681076b92cb..f858c48ceb7 100644 --- a/protocols/autonat/src/behaviour/as_server.rs +++ b/protocols/autonat/src/behaviour/as_server.rs @@ -346,7 +346,7 @@ impl<'a> AsServer<'a> { addr.push(Protocol::P2p(peer.into())) } // Only collect distinct addresses. - distinct.insert(addr.clone()).then(|| addr) + distinct.insert(addr.clone()).then_some(addr) }) .collect() } diff --git a/protocols/dcutr/src/behaviour.rs b/protocols/dcutr/src/behaviour.rs index 5d93d90b339..02ebaca4e35 100644 --- a/protocols/dcutr/src/behaviour.rs +++ b/protocols/dcutr/src/behaviour.rs @@ -193,7 +193,7 @@ impl NetworkBehaviour for Behaviour { .expect("Peer of direct connection to be tracked."); connections .remove(connection_id) - .then(|| ()) + .then_some(()) .expect("Direct connection to be tracked."); if connections.is_empty() { self.direct_connections.remove(peer_id); diff --git a/protocols/gossipsub/src/behaviour.rs b/protocols/gossipsub/src/behaviour.rs index 43f2f79466d..8fe6fc94b4a 100644 --- a/protocols/gossipsub/src/behaviour.rs +++ b/protocols/gossipsub/src/behaviour.rs @@ -1265,9 +1265,9 @@ where // Ask in random order let mut iwant_ids_vec: Vec<_> = iwant_ids.into_iter().collect(); let mut rng = thread_rng(); - iwant_ids_vec.partial_shuffle(&mut rng, iask as usize); + iwant_ids_vec.partial_shuffle(&mut rng, iask); - iwant_ids_vec.truncate(iask as usize); + iwant_ids_vec.truncate(iask); *iasked += iask; for message_id in &iwant_ids_vec { diff --git a/protocols/gossipsub/src/peer_score.rs b/protocols/gossipsub/src/peer_score.rs index 4c7a09bbcb2..fc87253dc58 100644 --- a/protocols/gossipsub/src/peer_score.rs +++ b/protocols/gossipsub/src/peer_score.rs @@ -253,7 +253,7 @@ impl PeerScore { // P2: first message deliveries let p2 = { - let v = topic_stats.first_message_deliveries as f64; + let v = topic_stats.first_message_deliveries; if v < topic_params.first_message_deliveries_cap { v } else { diff --git a/protocols/gossipsub/src/peer_score/tests.rs b/protocols/gossipsub/src/peer_score/tests.rs index c457ffe0f70..3616452a620 100644 --- a/protocols/gossipsub/src/peer_score/tests.rs +++ b/protocols/gossipsub/src/peer_score/tests.rs @@ -890,7 +890,7 @@ fn test_score_ip_colocation() { let n_shared = 3.0; let ip_surplus = n_shared - ip_colocation_factor_threshold; let penalty = ip_surplus * ip_surplus; - let expected = ip_colocation_factor_weight * penalty as f64; + let expected = ip_colocation_factor_weight * penalty; assert_eq!(score_b, expected, "Peer B should have expected score"); assert_eq!(score_c, expected, "Peer C should have expected score"); diff --git a/protocols/gossipsub/src/subscription_filter.rs b/protocols/gossipsub/src/subscription_filter.rs index 600a02c7a64..b5bd47f6ed6 100644 --- a/protocols/gossipsub/src/subscription_filter.rs +++ b/protocols/gossipsub/src/subscription_filter.rs @@ -50,7 +50,7 @@ pub trait TopicSubscriptionFilter { } } self.filter_incoming_subscription_set( - filtered_subscriptions.into_iter().map(|(_, v)| v).collect(), + filtered_subscriptions.values().copied().collect(), currently_subscribed_topics, ) } diff --git a/protocols/kad/src/kbucket/key.rs b/protocols/kad/src/kbucket/key.rs index 00a15765de4..62401c46095 100644 --- a/protocols/kad/src/kbucket/key.rs +++ b/protocols/kad/src/kbucket/key.rs @@ -94,14 +94,14 @@ impl From> for KeyBytes { impl From for Key { fn from(m: Multihash) -> Self { - let bytes = KeyBytes(Sha256::digest(&m.to_bytes())); + let bytes = KeyBytes(Sha256::digest(m.to_bytes())); Key { preimage: m, bytes } } } impl From for Key { fn from(p: PeerId) -> Self { - let bytes = KeyBytes(Sha256::digest(&p.to_bytes())); + let bytes = KeyBytes(Sha256::digest(p.to_bytes())); Key { preimage: p, bytes } } } diff --git a/protocols/kad/src/query/peers/closest/disjoint.rs b/protocols/kad/src/query/peers/closest/disjoint.rs index 2272b8e46fc..6a81871399e 100644 --- a/protocols/kad/src/query/peers/closest/disjoint.rs +++ b/protocols/kad/src/query/peers/closest/disjoint.rs @@ -732,9 +732,7 @@ mod tests { impl std::fmt::Debug for Graph { fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - fmt.debug_list() - .entries(self.0.iter().map(|(id, _)| id)) - .finish() + fmt.debug_list().entries(self.0.keys()).finish() } } @@ -796,8 +794,8 @@ mod tests { fn get_closest_peer(&self, target: &KeyBytes) -> PeerId { *self .0 - .iter() - .map(|(peer_id, _)| (target.distance(&Key::from(*peer_id)), peer_id)) + .keys() + .map(|peer_id| (target.distance(&Key::from(*peer_id)), peer_id)) .fold(None, |acc, (distance_b, peer_id_b)| match acc { None => Some((distance_b, peer_id_b)), Some((distance_a, peer_id_a)) => { diff --git a/protocols/relay/src/v2/relay.rs b/protocols/relay/src/v2/relay.rs index 5b1eb810f60..a53024b3e94 100644 --- a/protocols/relay/src/v2/relay.rs +++ b/protocols/relay/src/v2/relay.rs @@ -298,8 +298,8 @@ impl NetworkBehaviour for Relay { // Deny if it exceeds `max_reservations`. || self .reservations - .iter() - .map(|(_, cs)| cs.len()) + .values() + .map(|cs| cs.len()) .sum::() >= self.config.max_reservations // Deny if it exceeds the allowed rate of reservations. diff --git a/protocols/rendezvous/src/client.rs b/protocols/rendezvous/src/client.rs index 5ceb945a4f1..f96a947bd63 100644 --- a/protocols/rendezvous/src/client.rs +++ b/protocols/rendezvous/src/client.rs @@ -177,7 +177,7 @@ impl NetworkBehaviour for Behaviour { fn addresses_of_peer(&mut self, peer: &PeerId) -> Vec { self.discovered_peers .iter() - .filter_map(|((candidate, _), addresses)| (candidate == peer).then(|| addresses)) + .filter_map(|((candidate, _), addresses)| (candidate == peer).then_some(addresses)) .flatten() .cloned() .collect() @@ -310,7 +310,7 @@ fn handle_outbound_event( expiring_registrations.extend(registrations.iter().cloned().map(|registration| { async move { // if the timer errors we consider it expired - futures_timer::Delay::new(Duration::from_secs(registration.ttl as u64)).await; + futures_timer::Delay::new(Duration::from_secs(registration.ttl)).await; (registration.record.peer_id(), registration.namespace) } diff --git a/protocols/rendezvous/src/server.rs b/protocols/rendezvous/src/server.rs index dd4731d8a8d..4dfad583565 100644 --- a/protocols/rendezvous/src/server.rs +++ b/protocols/rendezvous/src/server.rs @@ -381,7 +381,7 @@ impl Registrations { self.registrations .insert(registration_id, registration.clone()); - let next_expiry = futures_timer::Delay::new(Duration::from_secs(ttl as u64)) + let next_expiry = futures_timer::Delay::new(Duration::from_secs(ttl)) .map(move |_| registration_id) .boxed(); From 071e7db2f1d7a92fb4be3c00e711389f4a2c92c0 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Mon, 7 Nov 2022 17:59:37 +1100 Subject: [PATCH 04/23] Activate necessary features for test --- transports/tls/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transports/tls/Cargo.toml b/transports/tls/Cargo.toml index eef2b7226b7..17d2d6c8adc 100644 --- a/transports/tls/Cargo.toml +++ b/transports/tls/Cargo.toml @@ -26,7 +26,7 @@ features = ["dangerous_configuration"] # Must enable this to allow for custom ve [dev-dependencies] hex = "0.4.3" hex-literal = "0.3.4" -libp2p = { path = "../..", features = ["yamux"], default-features = false } +libp2p = { path = "../..", features = ["yamux", "rsa", "ecdsa", "secp256k1"], default-features = false } tokio = { version = "1.21.1", features = ["full"] } # Passing arguments to the docsrs builder in order to properly document cfg's. From 3a2b0edbcd49ad07dc3b25eb0a0c72eae68fa216 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Mon, 7 Nov 2022 16:23:43 +1100 Subject: [PATCH 05/23] Run yaml formatter --- .github/workflows/ci.yml | 216 +++++++++++++++++++-------------------- 1 file changed, 108 insertions(+), 108 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aef67c3d31f..2d6cc434023 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,16 +22,16 @@ jobs: "--benches --all-features", ] steps: - - name: Install Protoc - uses: arduino/setup-protoc@v1 + - name: Install Protoc + uses: arduino/setup-protoc@v1 - - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - - uses: Swatinem/rust-cache@22c9328bcba27aa81a32b1bef27c7e3c78052531 # v2.0.1 - with: - key: ${{ matrix.args }} + - uses: Swatinem/rust-cache@22c9328bcba27aa81a32b1bef27c7e3c78052531 # v2.0.1 + with: + key: ${{ matrix.args }} - - run: cargo test --workspace ${{ matrix.args }} + - run: cargo test --workspace ${{ matrix.args }} test-wasm: name: Build on WASM @@ -51,133 +51,133 @@ jobs: run: shell: bash steps: - - name: Install Protoc - uses: arduino/setup-protoc@v1 + - name: Install Protoc + uses: arduino/setup-protoc@v1 - - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - - name: Install Rust ${{ matrix.toolchain }} - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 - with: - toolchain: stable - target: ${{ matrix.toolchain }} - override: true + - name: Install Rust ${{ matrix.toolchain }} + uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 + with: + toolchain: stable + target: ${{ matrix.toolchain }} + override: true - - name: Install a recent version of clang - run: | - sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" + - name: Install a recent version of clang + run: | + sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" - - name: Install CMake - run: sudo apt-get install -y cmake + - name: Install CMake + run: sudo apt-get install -y cmake - - uses: Swatinem/rust-cache@22c9328bcba27aa81a32b1bef27c7e3c78052531 # v2.0.1 - with: - key: ${{ matrix.toolchain }} + - uses: Swatinem/rust-cache@22c9328bcba27aa81a32b1bef27c7e3c78052531 # v2.0.1 + with: + key: ${{ matrix.toolchain }} - - name: Build on ${{ matrix.toolchain }} - # TODO: also run `cargo test` - # TODO: ideally we would build `--workspace`, but not all crates compile for WASM - run: cargo build --target=${{ matrix.toolchain }} ${{ matrix.args }} + - name: Build on ${{ matrix.toolchain }} + # TODO: also run `cargo test` + # TODO: ideally we would build `--workspace`, but not all crates compile for WASM + run: cargo build --target=${{ matrix.toolchain }} ${{ matrix.args }} check-rustdoc-links: name: Check rustdoc intra-doc links runs-on: ubuntu-latest steps: - - name: Install Protoc - uses: arduino/setup-protoc@v1 + - name: Install Protoc + uses: arduino/setup-protoc@v1 - - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 - with: - profile: minimal - toolchain: stable - override: true + - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 + with: + profile: minimal + toolchain: stable + override: true - - uses: Swatinem/rust-cache@22c9328bcba27aa81a32b1bef27c7e3c78052531 # v2.0.1 + - uses: Swatinem/rust-cache@22c9328bcba27aa81a32b1bef27c7e3c78052531 # v2.0.1 - - name: Check rustdoc links - run: RUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links --deny warnings" cargo doc --verbose --workspace --no-deps --all-features --document-private-items + - name: Check rustdoc links + run: RUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links --deny warnings" cargo doc --verbose --workspace --no-deps --all-features --document-private-items check-clippy: runs-on: ubuntu-latest steps: - - name: Install Protoc - uses: arduino/setup-protoc@v1 + - name: Install Protoc + uses: arduino/setup-protoc@v1 - - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 - with: - profile: minimal - toolchain: stable - override: true - components: clippy + - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 + with: + profile: minimal + toolchain: stable + override: true + components: clippy - - uses: Swatinem/rust-cache@22c9328bcba27aa81a32b1bef27c7e3c78052531 # v2.0.1 + - uses: Swatinem/rust-cache@22c9328bcba27aa81a32b1bef27c7e3c78052531 # v2.0.1 - - name: Run cargo clippy - uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3 - with: - command: custom-clippy # cargo alias to allow reuse of config locally + - name: Run cargo clippy + uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3 + with: + command: custom-clippy # cargo alias to allow reuse of config locally integration-test: name: Integration tests runs-on: ubuntu-latest steps: - - name: Install Protoc - uses: arduino/setup-protoc@v1 + - name: Install Protoc + uses: arduino/setup-protoc@v1 - - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 - with: - profile: minimal - toolchain: stable - override: true + - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 + with: + profile: minimal + toolchain: stable + override: true - - uses: Swatinem/rust-cache@22c9328bcba27aa81a32b1bef27c7e3c78052531 # v2.0.1 + - uses: Swatinem/rust-cache@22c9328bcba27aa81a32b1bef27c7e3c78052531 # v2.0.1 - - name: Run ipfs-kad example - run: RUST_LOG=libp2p_swarm=debug,libp2p_kad=trace,libp2p_tcp=debug cargo run --example ipfs-kad --features full + - name: Run ipfs-kad example + run: RUST_LOG=libp2p_swarm=debug,libp2p_kad=trace,libp2p_tcp=debug cargo run --example ipfs-kad --features full rustfmt: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 - with: - profile: minimal - toolchain: stable - override: true - components: rustfmt + - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 + with: + profile: minimal + toolchain: stable + override: true + components: rustfmt - - name: Check formatting - run: cargo fmt -- --check + - name: Check formatting + run: cargo fmt -- --check manifest_lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 - with: - profile: minimal - toolchain: stable - override: true - - - name: Ensure `full` feature contains all features - run: | - ALL_FEATURES=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "libp2p") | .features | keys | map(select(. != "full")) | sort | join(" ")') - FULL_FEATURE=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "libp2p") | .features["full"] | sort | join(" ")') - - test "$ALL_FEATURES = $FULL_FEATURE" - - echo "$ALL_FEATURES"; - echo "$FULL_FEATURE"; - - test "$ALL_FEATURES" = "$FULL_FEATURE" + - uses: actions/checkout@v3 + + - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 + with: + profile: minimal + toolchain: stable + override: true + + - name: Ensure `full` feature contains all features + run: | + ALL_FEATURES=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "libp2p") | .features | keys | map(select(. != "full")) | sort | join(" ")') + FULL_FEATURE=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "libp2p") | .features["full"] | sort | join(" ")') + + test "$ALL_FEATURES = $FULL_FEATURE" + + echo "$ALL_FEATURES"; + echo "$FULL_FEATURE"; + + test "$ALL_FEATURES" = "$FULL_FEATURE" gather_crates_for_semver_checks: runs-on: ubuntu-latest @@ -199,25 +199,25 @@ jobs: matrix: crate: ${{ fromJSON(needs.gather_crates_for_semver_checks.outputs.members) }} steps: - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@bb6001c4ea612bf59c3abfc4756fbceee4f870c7 # 0.10.0 - with: - access_token: ${{ github.token }} + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@bb6001c4ea612bf59c3abfc4756fbceee4f870c7 # 0.10.0 + with: + access_token: ${{ github.token }} - - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 - with: - profile: minimal - toolchain: stable - override: true + - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 + with: + profile: minimal + toolchain: stable + override: true - - name: Install Protoc - uses: arduino/setup-protoc@v1 + - name: Install Protoc + uses: arduino/setup-protoc@v1 - - uses: Swatinem/rust-cache@22c9328bcba27aa81a32b1bef27c7e3c78052531 # v2.0.1 + - uses: Swatinem/rust-cache@22c9328bcba27aa81a32b1bef27c7e3c78052531 # v2.0.1 - - run: cargo install cargo-semver-checks + - run: cargo install cargo-semver-checks - - name: Semver Check - run: cargo semver-checks check-release -p ${{ matrix.crate }} + - name: Semver Check + run: cargo semver-checks check-release -p ${{ matrix.crate }} From 8c36289c489d447a5d0bc26aef621fdc8df9e288 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Mon, 7 Nov 2022 15:23:08 +1100 Subject: [PATCH 06/23] Run clippy on stable and beta --- .github/workflows/ci.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2d6cc434023..1b76292703b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -101,6 +101,13 @@ jobs: check-clippy: runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + rust-version: [ + stable, + beta + ] steps: - name: Install Protoc uses: arduino/setup-protoc@v1 @@ -110,7 +117,7 @@ jobs: - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 with: profile: minimal - toolchain: stable + toolchain: ${{ matrix.rust-version }} override: true components: clippy From 46a1bf53c292cce0fad6a1247200303cee63c156 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Mon, 7 Nov 2022 15:45:35 +1100 Subject: [PATCH 07/23] Don't install things that are already present --- .github/workflows/ci.yml | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1b76292703b..68f8e9c2441 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,11 +45,6 @@ jobs: include: - toolchain: wasm32-unknown-unknown args: "--features wasm-bindgen" - env: - CC: clang-11 - defaults: - run: - shell: bash steps: - name: Install Protoc uses: arduino/setup-protoc@v1 @@ -63,16 +58,9 @@ jobs: target: ${{ matrix.toolchain }} override: true - - name: Install a recent version of clang - run: | - sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" - - - name: Install CMake - run: sudo apt-get install -y cmake - - uses: Swatinem/rust-cache@22c9328bcba27aa81a32b1bef27c7e3c78052531 # v2.0.1 - with: - key: ${{ matrix.toolchain }} + with: + key: ${{ matrix.toolchain }} - name: Build on ${{ matrix.toolchain }} # TODO: also run `cargo test` From 342b1759f0516e93af66db4821d172b80737e9b5 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Mon, 7 Nov 2022 15:06:52 +1100 Subject: [PATCH 08/23] Rename CI job To reuse this, we rename it to what it actually does: Gathering all crates that are published to crates.io. --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 68f8e9c2441..0eba8107302 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -174,7 +174,7 @@ jobs: test "$ALL_FEATURES" = "$FULL_FEATURE" - gather_crates_for_semver_checks: + gather_published_crates: runs-on: ubuntu-latest outputs: members: ${{ steps.cargo-metadata.outputs.members }} @@ -188,11 +188,11 @@ jobs: semver-check: runs-on: ubuntu-latest - needs: gather_crates_for_semver_checks + needs: gather_published_crates strategy: fail-fast: false matrix: - crate: ${{ fromJSON(needs.gather_crates_for_semver_checks.outputs.members) }} + crate: ${{ fromJSON(needs.gather_published_crates.outputs.members) }} steps: - name: Cancel Previous Runs uses: styfle/cancel-workflow-action@bb6001c4ea612bf59c3abfc4756fbceee4f870c7 # 0.10.0 From 569cbf6577179a89cb53bc627e24329f56449e7e Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Mon, 7 Nov 2022 15:22:49 +1100 Subject: [PATCH 09/23] Refactor test and build jobs Overall, we want to: - Run as few jobs as possible - Have the jobs finish as fast as possible - Have the jobs redo as little work as possible There are only so many jobs that GitHub Actions will run in parallel. Thus, it makes sense to not create massive matrices but instead group things together meaningfully. The new `test` job will: - Run once for each crate - Ensure that the crate compiles on its specified MSRV - Ensure that the tests pass - Ensure that there are no semver violations This is an improvement to before because we are running all of these in parallel which speeds up execution and highlights more errors at once. Previously, tests run later in the pipeline would not get run at all until you make sure the "first" one passes. The new `cross` job supersedes the existing `wasm` job. This is an improvement because we now also compile the crate for windows and MacOS. Something that wasn't checked before. `libp2p` exposes a fair few feature-flags. Some of the combinations are worth checking independently. For the moment, this concerns only the executor related transports together with the executor flags but this list can easily be extended. --- .github/workflows/ci.yml | 148 +++++++++++++++++++++++---------------- 1 file changed, 88 insertions(+), 60 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0eba8107302..3f463bb3ebf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,61 +11,120 @@ concurrency: cancel-in-progress: true jobs: - test-desktop: # Run tests, MSRV and semver checks for each crate. - name: Build and test + test: + name: Test ${{ matrix.crate }} runs-on: ubuntu-latest + needs: gather_published_crates strategy: + fail-fast: false matrix: - args: [ - "--no-default-features", - "--all-features", - "--benches --all-features", - ] + crate: ${{ fromJSON(needs.gather_published_crates.outputs.members) }} steps: - name: Install Protoc uses: arduino/setup-protoc@v1 - uses: actions/checkout@v3 + - name: Get MSRV for ${{ matrix.crate }} + id: parse-msrv + run: | + RUST_VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "${{ matrix.crate }}") | .rust_version') + echo "version=${RUST_VERSION}" >> $GITHUB_OUTPUT + + - name: Switch to Rust ${{ steps.parse-msrv.outputs.version }} for MSRV check + uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 + with: + profile: minimal + toolchain: ${{ steps.parse-msrv.outputs.version }} + override: true + + - name: Check if ${{ matrix.crate }} compiles on MSRV (Rust ${{ steps.parse-msrv.outputs.version }}) + run: cargo check --package ${{ matrix.crate }} --all-features + + - name: Switch to latest Rust stable for tests + uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 + with: + profile: minimal + toolchain: stable + override: true + - uses: Swatinem/rust-cache@22c9328bcba27aa81a32b1bef27c7e3c78052531 # v2.0.1 with: - key: ${{ matrix.args }} + key: ${{ matrix.crate }} - - run: cargo test --workspace ${{ matrix.args }} + - run: cargo test --package ${{ matrix.crate }} --all-features - test-wasm: - name: Build on WASM + - name: Check if crate has been released + id: check-released + run: | + RESPONSE_CODE=$(curl https://crates.io/api/v1/crates/${{ matrix.crate }} --silent --write-out "%{http_code}" --output /dev/null) + echo "code=${RESPONSE_CODE}" + echo "code=${RESPONSE_CODE}" >> $GITHUB_OUTPUT + + - name: Check public API for semver violations + if: steps.check-released.outputs.code == 200 # Workaround until https://github.com/obi1kenobi/cargo-semver-check/issues/146 is shipped. + run: | + cargo install cargo-semver-checks + cargo semver-checks check-release -p ${{ matrix.crate }} + + cross: + name: Compile on ${{ matrix.target }} + strategy: + matrix: + include: + - target: "wasm32-unknown-unknown" + os: ubuntu-latest + - target: "wasm32-unknown-emscripten" + os: ubuntu-latest + - target: "wasm32-wasi" + os: ubuntu-latest + - target: "x86_64-apple-darwin" + os: macos-latest + - target: "x86_64-pc-windows-msvc" + os: windows-latest + runs-on: ${{ matrix.os }} + steps: + - name: Install Protoc + uses: arduino/setup-protoc@v1 + + - uses: actions/checkout@v3 + + - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 + with: + profile: minimal + toolchain: stable + override: true + target: ${{ matrix.target }} + + - uses: Swatinem/rust-cache@22c9328bcba27aa81a32b1bef27c7e3c78052531 # v2.0.1 + + - run: cargo check --package libp2p --all-features --target=${{ matrix.target }} + + feature_matrix: # Test various feature combinations work correctly + name: Compile with select features (${{ matrix.features }}) runs-on: ubuntu-latest strategy: matrix: - toolchain: [ - wasm32-unknown-emscripten, - wasm32-wasi - ] include: - - toolchain: wasm32-unknown-unknown - args: "--features wasm-bindgen" + - features: "mdns tcp dns tokio" + - features: "mdns tcp dns async-std" steps: - name: Install Protoc uses: arduino/setup-protoc@v1 - uses: actions/checkout@v3 - - name: Install Rust ${{ matrix.toolchain }} - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 + - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 with: + profile: minimal toolchain: stable - target: ${{ matrix.toolchain }} override: true - uses: Swatinem/rust-cache@22c9328bcba27aa81a32b1bef27c7e3c78052531 # v2.0.1 - with: - key: ${{ matrix.toolchain }} + with: + key: ${{ matrix.runtime }} - - name: Build on ${{ matrix.toolchain }} - # TODO: also run `cargo test` - # TODO: ideally we would build `--workspace`, but not all crates compile for WASM - run: cargo build --target=${{ matrix.toolchain }} ${{ matrix.args }} + - run: cargo check --package libp2p --features="${{ matrix.features }}" check-rustdoc-links: name: Check rustdoc intra-doc links @@ -87,7 +146,7 @@ jobs: - name: Check rustdoc links run: RUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links --deny warnings" cargo doc --verbose --workspace --no-deps --all-features --document-private-items - check-clippy: + clippy: runs-on: ubuntu-latest strategy: fail-fast: false @@ -116,7 +175,7 @@ jobs: with: command: custom-clippy # cargo alias to allow reuse of config locally - integration-test: + ipfs-integration-test: name: Integration tests runs-on: ubuntu-latest steps: @@ -184,35 +243,4 @@ jobs: - id: cargo-metadata run: | WORKSPACE_MEMBERS=$(cargo metadata --format-version=1 --no-deps | jq -c '.packages | .[] | select(.publish == null) | .name' | jq -s '.' | jq -c '.') - echo "::set-output name=members::${WORKSPACE_MEMBERS}" - - semver-check: - runs-on: ubuntu-latest - needs: gather_published_crates - strategy: - fail-fast: false - matrix: - crate: ${{ fromJSON(needs.gather_published_crates.outputs.members) }} - steps: - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@bb6001c4ea612bf59c3abfc4756fbceee4f870c7 # 0.10.0 - with: - access_token: ${{ github.token }} - - - uses: actions/checkout@v3 - - - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 - with: - profile: minimal - toolchain: stable - override: true - - - name: Install Protoc - uses: arduino/setup-protoc@v1 - - - uses: Swatinem/rust-cache@22c9328bcba27aa81a32b1bef27c7e3c78052531 # v2.0.1 - - - run: cargo install cargo-semver-checks - - - name: Semver Check - run: cargo semver-checks check-release -p ${{ matrix.crate }} + echo "members=${WORKSPACE_MEMBERS}" >> $GITHUB_OUTPUT From 636c8739e4d3e6dc6704dc19f6a5ffdff9203ac2 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Wed, 9 Nov 2022 13:47:07 +1100 Subject: [PATCH 10/23] Pin protoc action --- .github/workflows/ci.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bd080327967..fdee8a436f9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: crate: ${{ fromJSON(needs.gather_published_crates.outputs.members) }} steps: - name: Install Protoc - uses: arduino/setup-protoc@v1 + uses: arduino/setup-protoc@64c0c85d18e984422218383b81c52f8b077404d3 # v1.1.2 - uses: actions/checkout@v3 @@ -85,7 +85,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Install Protoc - uses: arduino/setup-protoc@v1 + uses: arduino/setup-protoc@64c0c85d18e984422218383b81c52f8b077404d3 # v1.1.2 - uses: actions/checkout@v3 @@ -110,7 +110,7 @@ jobs: - features: "mdns tcp dns async-std" steps: - name: Install Protoc - uses: arduino/setup-protoc@v1 + uses: arduino/setup-protoc@64c0c85d18e984422218383b81c52f8b077404d3 # v1.1.2 - uses: actions/checkout@v3 @@ -131,7 +131,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Install Protoc - uses: arduino/setup-protoc@v1 + uses: arduino/setup-protoc@64c0c85d18e984422218383b81c52f8b077404d3 # v1.1.2 - uses: actions/checkout@v3 @@ -157,7 +157,7 @@ jobs: ] steps: - name: Install Protoc - uses: arduino/setup-protoc@v1 + uses: arduino/setup-protoc@64c0c85d18e984422218383b81c52f8b077404d3 # v1.1.2 - uses: actions/checkout@v3 @@ -180,7 +180,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Install Protoc - uses: arduino/setup-protoc@v1 + uses: arduino/setup-protoc@64c0c85d18e984422218383b81c52f8b077404d3 # v1.1.2 - uses: actions/checkout@v3 From 24a42df10f5a459d08a2867df80506a5eded914f Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Wed, 9 Nov 2022 13:56:02 +1100 Subject: [PATCH 11/23] Actually adjust name --- .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 fdee8a436f9..0208cddad52 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -176,7 +176,7 @@ jobs: command: custom-clippy # cargo alias to allow reuse of config locally ipfs-integration-test: - name: Integration tests + name: IPFS Integration tests runs-on: ubuntu-latest steps: - name: Install Protoc From e51e883c59f06bd2cd5a6a231c33bfedcc8a70fd Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Tue, 15 Nov 2022 14:58:57 +1100 Subject: [PATCH 12/23] Ensure we can compile without any features --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4c636f32e56..fdd44bac930 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,6 +52,8 @@ jobs: with: key: ${{ matrix.crate }} + - run: cargo check --package ${{ matrix.crate }} --no-default-features + - run: cargo test --package ${{ matrix.crate }} --all-features - name: Check if crate has been released From be659b110cf75117642fcfee24d91d2edd5fe677 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Tue, 15 Nov 2022 15:18:13 +1100 Subject: [PATCH 13/23] Cache build artefacts for MSRV check --- .github/workflows/ci.yml | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fdd44bac930..fbc593c9797 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,30 +31,33 @@ jobs: RUST_VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "${{ matrix.crate }}") | .rust_version') echo "version=${RUST_VERSION}" >> $GITHUB_OUTPUT - - name: Switch to Rust ${{ steps.parse-msrv.outputs.version }} for MSRV check + - name: Install Rust ${{ steps.parse-msrv.outputs.version }} for MSRV check uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 with: profile: minimal toolchain: ${{ steps.parse-msrv.outputs.version }} - override: true - - - name: Check if ${{ matrix.crate }} compiles on MSRV (Rust ${{ steps.parse-msrv.outputs.version }}) - run: cargo check --package ${{ matrix.crate }} --all-features - - name: Switch to latest Rust stable for tests + - name: Update to latest stable Rust uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 with: profile: minimal toolchain: stable override: true + # By default, this action already includes the active Rust toolchain in the cache key. + # We also install a separate toolchain for the MSRV check so all we need to do is add that to the key to make sure it invalidates when we update the MSRV. - uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # v2.2.0 with: - key: ${{ matrix.crate }} + key: msrv-${{ steps.parse-msrv.outputs.version }} + + - name: Check if ${{ matrix.crate }} compiles on MSRV (Rust ${{ steps.parse-msrv.outputs.version }}) + run: cargo +${{ steps.parse-msrv.outputs.version }} check --package ${{ matrix.crate }} --all-features - - run: cargo check --package ${{ matrix.crate }} --no-default-features + - name: Check if we compile without any features activated + run: cargo check --package ${{ matrix.crate }} --no-default-features - - run: cargo test --package ${{ matrix.crate }} --all-features + - name: Run all tests + run: cargo test --package ${{ matrix.crate }} --all-features - name: Check if crate has been released id: check-released From 3060f0bb72acd60f4588c697b40dbcb9f5a11297 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Tue, 15 Nov 2022 15:24:12 +1100 Subject: [PATCH 14/23] Add comment explaining why this caching works --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fbc593c9797..d5820d03653 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,6 +46,7 @@ jobs: # By default, this action already includes the active Rust toolchain in the cache key. # We also install a separate toolchain for the MSRV check so all we need to do is add that to the key to make sure it invalidates when we update the MSRV. + # cargo separates build artifacts by Rust compiler version, meaning we can compile with different versions but cache all artifacts. - uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # v2.2.0 with: key: msrv-${{ steps.parse-msrv.outputs.version }} From f753b16c1d0009f2459fd8950a7ca813d196d2a7 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Tue, 15 Nov 2022 15:25:16 +1100 Subject: [PATCH 15/23] Remove unnecessary cast (clippy beta lint) --- transports/quic/tests/smoke.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transports/quic/tests/smoke.rs b/transports/quic/tests/smoke.rs index 6eedcdfb0c2..8bd8033cf83 100644 --- a/transports/quic/tests/smoke.rs +++ b/transports/quic/tests/smoke.rs @@ -288,7 +288,7 @@ fn prop( // Wait for all streams to complete. P::block_on( completed_streams_rx - .take(completed_streams as usize) + .take(completed_streams) .collect::>(), Duration::from_secs(30), ); From 05d6690fe7c3f2a847d97bbbef2eb32a509ec9e8 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Tue, 15 Nov 2022 15:32:04 +1100 Subject: [PATCH 16/23] Activate default features to make it compile --- transports/quic/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transports/quic/Cargo.toml b/transports/quic/Cargo.toml index 0a1235cd731..f007e011d0b 100644 --- a/transports/quic/Cargo.toml +++ b/transports/quic/Cargo.toml @@ -8,7 +8,7 @@ repository = "https://github.com/libp2p/rust-libp2p" license = "MIT" [dependencies] -async-std = { version = "1.12.0", default-features = false, optional = true } +async-std = { version = "1.12.0", optional = true } bytes = "1.2.1" futures = "0.3.15" futures-timer = "3.0.2" From e0ab8cd3d577fdfcda7947d27b1df43b0a41d3bd Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Tue, 15 Nov 2022 15:33:29 +1100 Subject: [PATCH 17/23] Add crate name to cache key --- .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 d5820d03653..f74e05585e2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,7 +49,7 @@ jobs: # cargo separates build artifacts by Rust compiler version, meaning we can compile with different versions but cache all artifacts. - uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # v2.2.0 with: - key: msrv-${{ steps.parse-msrv.outputs.version }} + key: ${{ matrix.crate }}-msrv-${{ steps.parse-msrv.outputs.version }} - name: Check if ${{ matrix.crate }} compiles on MSRV (Rust ${{ steps.parse-msrv.outputs.version }}) run: cargo +${{ steps.parse-msrv.outputs.version }} check --package ${{ matrix.crate }} --all-features From 0f3a561958ac620e7e01fd33f5789a78623b6f01 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Tue, 15 Nov 2022 15:35:12 +1100 Subject: [PATCH 18/23] Set missing MSRV for libp2p-quic --- transports/quic/Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/transports/quic/Cargo.toml b/transports/quic/Cargo.toml index f007e011d0b..4d5b24206cd 100644 --- a/transports/quic/Cargo.toml +++ b/transports/quic/Cargo.toml @@ -3,6 +3,7 @@ name = "libp2p-quic" version = "0.7.0-alpha" authors = ["Parity Technologies "] edition = "2021" +rust-version = "1.62.0" description = "TLS based QUIC transport implementation for libp2p" repository = "https://github.com/libp2p/rust-libp2p" license = "MIT" From 990c321e48680e17ba15cdb2999c4387de19cafb Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Wed, 16 Nov 2022 09:42:05 +1100 Subject: [PATCH 19/23] Add changelog entries --- CHANGELOG.md | 1 + Cargo.toml | 2 +- core/CHANGELOG.md | 5 +++++ core/Cargo.toml | 2 +- misc/metrics/CHANGELOG.md | 4 ++++ misc/multistream-select/CHANGELOG.md | 6 ++++++ misc/multistream-select/Cargo.toml | 2 +- misc/prost-codec/CHANGELOG.md | 3 +++ muxers/mplex/CHANGELOG.md | 4 ++++ muxers/yamux/CHANGELOG.md | 4 ++++ protocols/autonat/CHANGELOG.md | 4 ++++ protocols/dcutr/CHANGELOG.md | 4 ++++ protocols/floodsub/CHANGELOG.md | 5 +++++ protocols/gossipsub/CHANGELOG.md | 3 +++ protocols/identify/CHANGELOG.md | 3 +++ protocols/kad/CHANGELOG.md | 4 ++++ protocols/mdns/CHANGELOG.md | 3 +++ protocols/ping/CHANGELOG.md | 4 ++++ protocols/relay/CHANGELOG.md | 4 ++++ protocols/rendezvous/CHANGELOG.md | 3 +++ protocols/request-response/CHANGELOG.md | 4 ++++ swarm-derive/CHANGELOG.md | 3 +++ swarm/CHANGELOG.md | 3 +++ transports/deflate/CHANGELOG.md | 4 ++++ transports/dns/CHANGELOG.md | 4 ++++ transports/noise/CHANGELOG.md | 3 +++ transports/plaintext/CHANGELOG.md | 3 +++ transports/pnet/CHANGELOG.md | 6 ++++++ transports/pnet/Cargo.toml | 2 +- transports/tcp/CHANGELOG.md | 3 +++ transports/uds/CHANGELOG.md | 4 ++++ transports/wasm-ext/CHANGELOG.md | 4 ++++ transports/websocket/CHANGELOG.md | 4 ++++ 33 files changed, 113 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a6d4512c23..165517b0e14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -71,6 +71,7 @@ - Update to [`libp2p-noise` `v0.41.0`](transports/noise/CHANGELOG.md#0410). - Update to [`libp2p-ping` `v0.41.0`](protocols/ping/CHANGELOG.md#0410). - Update to [`libp2p-plaintext` `v0.38.0`](transports/plaintext/CHANGELOG.md#0380). + - Update to [`libp2p-pnet` `v0.22.2`](transports/pnet/CHANGELOG.md#0222). - Update to [`libp2p-relay` `v0.14.0`](protocols/relay/CHANGELOG.md#0140). - Update to [`libp2p-rendezvous` `v0.11.0`](protocols/rendezovus/CHANGELOG.md#0110). - Update to [`libp2p-request-response` `v0.23.0`](protocols/request-response/CHANGELOG.md#0230). diff --git a/Cargo.toml b/Cargo.toml index ffe8dbfae55..880705c8b64 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -100,7 +100,7 @@ libp2p-mplex = { version = "0.38.0", path = "muxers/mplex", optional = true } libp2p-noise = { version = "0.41.0", path = "transports/noise", optional = true } libp2p-ping = { version = "0.41.0", path = "protocols/ping", optional = true } libp2p-plaintext = { version = "0.38.0", path = "transports/plaintext", optional = true } -libp2p-pnet = { version = "0.22.1", path = "transports/pnet", optional = true } +libp2p-pnet = { version = "0.22.2", path = "transports/pnet", optional = true } libp2p-relay = { version = "0.14.0", path = "protocols/relay", optional = true } libp2p-rendezvous = { version = "0.11.0", path = "protocols/rendezvous", optional = true } libp2p-request-response = { version = "0.23.0", path = "protocols/request-response", optional = true } diff --git a/core/CHANGELOG.md b/core/CHANGELOG.md index d7059cab98f..c35ae24601e 100644 --- a/core/CHANGELOG.md +++ b/core/CHANGELOG.md @@ -4,8 +4,13 @@ - Hide `prost::Error` from public API in `FromEnvelopeError::InvalidPeerRecord` and `signed_envelope::DecodingError`. See [PR 3058]. +- Update `rust-version` to reflect the actual MSRV: 1.60.0. See [PR 3090]. + +- Update `multistream-select` to `v0.12.1`. See [PR 3090]. + [PR 3031]: https://github.com/libp2p/rust-libp2p/pull/3031 [PR 3058]: https://github.com/libp2p/rust-libp2p/pull/3058 +[PR 3090]: https://github.com/libp2p/rust-libp2p/pull/3090 # 0.37.0 diff --git a/core/Cargo.toml b/core/Cargo.toml index 046f1ea349c..cdc50ee1b49 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -23,7 +23,7 @@ libsecp256k1 = { version = "0.7.0", optional = true } log = "0.4" multiaddr = { version = "0.16.0" } multihash = { version = "0.16", default-features = false, features = ["std", "multihash-impl", "identity", "sha2"] } -multistream-select = { version = "0.12", path = "../misc/multistream-select" } +multistream-select = { version = "0.12.1", path = "../misc/multistream-select" } p256 = { version = "0.11.1", default-features = false, features = ["ecdsa"], optional = true } parking_lot = "0.12.0" pin-project = "1.0.0" diff --git a/misc/metrics/CHANGELOG.md b/misc/metrics/CHANGELOG.md index c8eecc36e6f..7bdeac0d1bd 100644 --- a/misc/metrics/CHANGELOG.md +++ b/misc/metrics/CHANGELOG.md @@ -16,6 +16,10 @@ - Update to `libp2p-gossipsub` `v0.43.0`. +- Update `rust-version` to reflect the actual MSRV: 1.62.0. See [PR 3090]. + +[PR 3090]: https://github.com/libp2p/rust-libp2p/pull/3090 + # 0.10.0 - Update to `libp2p-swarm` `v0.40.0`. diff --git a/misc/multistream-select/CHANGELOG.md b/misc/multistream-select/CHANGELOG.md index 820d18449e5..e7ea086a3e2 100644 --- a/misc/multistream-select/CHANGELOG.md +++ b/misc/multistream-select/CHANGELOG.md @@ -1,3 +1,9 @@ +# 0.12.1 [Unreleased] + +- Update `rust-version` to reflect the actual MSRV: 1.60.0. See [PR 3090]. + +[PR 3090]: https://github.com/libp2p/rust-libp2p/pull/3090 + # 0.12.0 - Remove parallel dialing optimization, to avoid requiring the use of the `ls` command. See [PR 2934]. diff --git a/misc/multistream-select/Cargo.toml b/misc/multistream-select/Cargo.toml index a5fdfe686e9..eefe7bf8d02 100644 --- a/misc/multistream-select/Cargo.toml +++ b/misc/multistream-select/Cargo.toml @@ -3,7 +3,7 @@ name = "multistream-select" edition = "2021" rust-version = "1.60.0" description = "Multistream-select negotiation protocol for libp2p" -version = "0.12.0" +version = "0.12.1" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/misc/prost-codec/CHANGELOG.md b/misc/prost-codec/CHANGELOG.md index 382d68ac625..354788486fd 100644 --- a/misc/prost-codec/CHANGELOG.md +++ b/misc/prost-codec/CHANGELOG.md @@ -2,7 +2,10 @@ - Don't leak `prost` dependency in `Error` type. See [PR 3058]. +- Update `rust-version` to reflect the actual MSRV: 1.60.0. See [PR 3090]. + [PR 3058]: https://github.com/libp2p/rust-libp2p/pull/3058/ +[PR 3090]: https://github.com/libp2p/rust-libp2p/pull/3090 # 0.2.0 diff --git a/muxers/mplex/CHANGELOG.md b/muxers/mplex/CHANGELOG.md index 061d65ff058..c575b0ca8db 100644 --- a/muxers/mplex/CHANGELOG.md +++ b/muxers/mplex/CHANGELOG.md @@ -2,6 +2,10 @@ - Update to `libp2p-core` `v0.38.0`. +- Update `rust-version` to reflect the actual MSRV: 1.60.0. See [PR 3090]. + +[PR 3090]: https://github.com/libp2p/rust-libp2p/pull/3090 + # 0.37.0 - Bump rand to 0.8 and quickcheck to 1. See [PR 2857]. diff --git a/muxers/yamux/CHANGELOG.md b/muxers/yamux/CHANGELOG.md index 3e6ac4e4127..74dcf762306 100644 --- a/muxers/yamux/CHANGELOG.md +++ b/muxers/yamux/CHANGELOG.md @@ -2,6 +2,10 @@ - Update to `libp2p-core` `v0.38.0`. +- Update `rust-version` to reflect the actual MSRV: 1.60.0. See [PR 3090]. + +[PR 3090]: https://github.com/libp2p/rust-libp2p/pull/3090 + # 0.41.0 - Update to `libp2p-core` `v0.37.0`. diff --git a/protocols/autonat/CHANGELOG.md b/protocols/autonat/CHANGELOG.md index 7cbcc4d87c6..750987b3a12 100644 --- a/protocols/autonat/CHANGELOG.md +++ b/protocols/autonat/CHANGELOG.md @@ -6,6 +6,10 @@ - Update to `libp2p-request-response` `v0.23.0`. +- Update `rust-version` to reflect the actual MSRV: 1.62.0. See [PR 3090]. + +[PR 3090]: https://github.com/libp2p/rust-libp2p/pull/3090 + # 0.8.0 - Update to `libp2p-core` `v0.37.0`. diff --git a/protocols/dcutr/CHANGELOG.md b/protocols/dcutr/CHANGELOG.md index b7890a8d6fb..4e55e9c8a7e 100644 --- a/protocols/dcutr/CHANGELOG.md +++ b/protocols/dcutr/CHANGELOG.md @@ -6,6 +6,10 @@ - Update to `libp2p-swarm` `v0.41.0`. +- Update `rust-version` to reflect the actual MSRV: 1.62.0. See [PR 3090]. + +[PR 3090]: https://github.com/libp2p/rust-libp2p/pull/3090 + # 0.7.0 - Update to `libp2p-core` `v0.37.0`. diff --git a/protocols/floodsub/CHANGELOG.md b/protocols/floodsub/CHANGELOG.md index 7ecf156034b..1667ae66bc3 100644 --- a/protocols/floodsub/CHANGELOG.md +++ b/protocols/floodsub/CHANGELOG.md @@ -4,6 +4,11 @@ - Update to `libp2p-swarm` `v0.41.0`. +- Update `rust-version` to reflect the actual MSRV: 1.62.0. See [PR 3090]. + +[PR 3090]: https://github.com/libp2p/rust-libp2p/pull/3090 + + # 0.40.0 - Bump rand to 0.8 and quickcheck to 1. See [PR 2857]. diff --git a/protocols/gossipsub/CHANGELOG.md b/protocols/gossipsub/CHANGELOG.md index 4ddb017b7a8..b94c55d9ebd 100644 --- a/protocols/gossipsub/CHANGELOG.md +++ b/protocols/gossipsub/CHANGELOG.md @@ -8,7 +8,10 @@ - Refactoring GossipsubCodec to use common protobuf Codec. See [PR 3070]. +- Update `rust-version` to reflect the actual MSRV: 1.62.0. See [PR 3090]. + [PR 3070]: https://github.com/libp2p/rust-libp2p/pull/3070 +[PR 3090]: https://github.com/libp2p/rust-libp2p/pull/3090 # 0.42.0 diff --git a/protocols/identify/CHANGELOG.md b/protocols/identify/CHANGELOG.md index 40f20b96ce6..f97a71ccfcc 100644 --- a/protocols/identify/CHANGELOG.md +++ b/protocols/identify/CHANGELOG.md @@ -8,7 +8,10 @@ - Update to `libp2p-swarm` `v0.41.0`. +- Update `rust-version` to reflect the actual MSRV: 1.62.0. See [PR 3090]. + [PR 2995]: https://github.com/libp2p/rust-libp2p/pull/2995 +[PR 3090]: https://github.com/libp2p/rust-libp2p/pull/3090 # 0.40.0 diff --git a/protocols/kad/CHANGELOG.md b/protocols/kad/CHANGELOG.md index 3d996c677a3..13957a590bb 100644 --- a/protocols/kad/CHANGELOG.md +++ b/protocols/kad/CHANGELOG.md @@ -4,6 +4,10 @@ - Update to `libp2p-swarm` `v0.41.0`. +- Update `rust-version` to reflect the actual MSRV: 1.62.0. See [PR 3090]. + +[PR 3090]: https://github.com/libp2p/rust-libp2p/pull/3090 + # 0.41.0 - Remove deprecated `set_protocol_name()` from `KademliaConfig` & `KademliaProtocolConfig`. diff --git a/protocols/mdns/CHANGELOG.md b/protocols/mdns/CHANGELOG.md index b75746c62b9..6c26b181ef7 100644 --- a/protocols/mdns/CHANGELOG.md +++ b/protocols/mdns/CHANGELOG.md @@ -6,7 +6,10 @@ - Use `trust-dns-proto` to parse DNS messages. See [PR 3102]. +- Update `rust-version` to reflect the actual MSRV: 1.62.0. See [PR 3090]. + [PR 3102]: https://github.com/libp2p/rust-libp2p/pull/3102 +[PR 3090]: https://github.com/libp2p/rust-libp2p/pull/3090 # 0.41.0 diff --git a/protocols/ping/CHANGELOG.md b/protocols/ping/CHANGELOG.md index d9011e22444..cbd3e3851f9 100644 --- a/protocols/ping/CHANGELOG.md +++ b/protocols/ping/CHANGELOG.md @@ -4,6 +4,10 @@ - Update to `libp2p-swarm` `v0.41.0`. +- Update `rust-version` to reflect the actual MSRV: 1.62.0. See [PR 3090]. + +[PR 3090]: https://github.com/libp2p/rust-libp2p/pull/3090 + # 0.40.0 - Bump rand to 0.8 and quickcheck to 1. See [PR 2857]. diff --git a/protocols/relay/CHANGELOG.md b/protocols/relay/CHANGELOG.md index 088dd802d4b..8a991a50890 100644 --- a/protocols/relay/CHANGELOG.md +++ b/protocols/relay/CHANGELOG.md @@ -6,6 +6,10 @@ - Update to `libp2p-swarm` `v0.41.0`. +- Update `rust-version` to reflect the actual MSRV: 1.62.0. See [PR 3090]. + +[PR 3090]: https://github.com/libp2p/rust-libp2p/pull/3090 + # 0.13.0 - Update to `libp2p-core` `v0.37.0`. diff --git a/protocols/rendezvous/CHANGELOG.md b/protocols/rendezvous/CHANGELOG.md index 8f25041503d..7b8e44d0235 100644 --- a/protocols/rendezvous/CHANGELOG.md +++ b/protocols/rendezvous/CHANGELOG.md @@ -6,7 +6,10 @@ - Update to `libp2p-swarm` `v0.41.0`. +- Update `rust-version` to reflect the actual MSRV: 1.62.0. See [PR 3090]. + [PR 3058]: https://github.com/libp2p/rust-libp2p/pull/3058 +[PR 3090]: https://github.com/libp2p/rust-libp2p/pull/3090 # 0.10.0 diff --git a/protocols/request-response/CHANGELOG.md b/protocols/request-response/CHANGELOG.md index f70e2f99a62..6e4b9b9dcf4 100644 --- a/protocols/request-response/CHANGELOG.md +++ b/protocols/request-response/CHANGELOG.md @@ -4,6 +4,10 @@ - Update to `libp2p-swarm` `v0.41.0`. +- Update `rust-version` to reflect the actual MSRV: 1.62.0. See [PR 3090]. + +[PR 3090]: https://github.com/libp2p/rust-libp2p/pull/3090 + # 0.22.0 - Bump rand to 0.8 and quickcheck to 1. See [PR 2857]. diff --git a/swarm-derive/CHANGELOG.md b/swarm-derive/CHANGELOG.md index fc5fb868a7e..5c594ba5659 100644 --- a/swarm-derive/CHANGELOG.md +++ b/swarm-derive/CHANGELOG.md @@ -3,7 +3,10 @@ - Add `prelude` configuration option. The derive-macro generates code that needs to refer to various symbols. See [PR 3055]. +- Update `rust-version` to reflect the actual MSRV: 1.60.0. See [PR 3090]. + [PR 3055]: https://github.com/libp2p/rust-libp2p/pull/3055 +[PR 3090]: https://github.com/libp2p/rust-libp2p/pull/3090 # 0.30.1 diff --git a/swarm/CHANGELOG.md b/swarm/CHANGELOG.md index f66828db64a..5062448b31b 100644 --- a/swarm/CHANGELOG.md +++ b/swarm/CHANGELOG.md @@ -7,7 +7,10 @@ `serde::Serialize`. See [PR 3055]. - Feature-gate `NetworkBehaviour` macro behind `macros` feature flag. See [PR 3055]. +- Update `rust-version` to reflect the actual MSRV: 1.62.0. See [PR 3090]. + [PR 3055]: https://github.com/libp2p/rust-libp2p/pull/3055 +[PR 3090]: https://github.com/libp2p/rust-libp2p/pull/3090 # 0.40.1 diff --git a/transports/deflate/CHANGELOG.md b/transports/deflate/CHANGELOG.md index 542184b2f09..a08fd655130 100644 --- a/transports/deflate/CHANGELOG.md +++ b/transports/deflate/CHANGELOG.md @@ -2,6 +2,10 @@ - Update to `libp2p-core` `v0.38.0`. +- Update `rust-version` to reflect the actual MSRV: 1.60.0. See [PR 3090]. + +[PR 3090]: https://github.com/libp2p/rust-libp2p/pull/3090 + # 0.37.0 - Update to `libp2p-core` `v0.37.0`. diff --git a/transports/dns/CHANGELOG.md b/transports/dns/CHANGELOG.md index c0a79751c19..d64e2cbff5d 100644 --- a/transports/dns/CHANGELOG.md +++ b/transports/dns/CHANGELOG.md @@ -2,6 +2,10 @@ - Update to `libp2p-core` `v0.38.0`. +- Update `rust-version` to reflect the actual MSRV: 1.60.0. See [PR 3090]. + +[PR 3090]: https://github.com/libp2p/rust-libp2p/pull/3090 + # 0.37.0 - Remove default features. If you previously depended on `async-std` you need to enable this explicitly now. See [PR 2918]. diff --git a/transports/noise/CHANGELOG.md b/transports/noise/CHANGELOG.md index 0c1987bfb13..24bd7d11109 100644 --- a/transports/noise/CHANGELOG.md +++ b/transports/noise/CHANGELOG.md @@ -4,7 +4,10 @@ - Update to `libp2p-core` `v0.38.0`. +- Update `rust-version` to reflect the actual MSRV: 1.60.0. See [PR 3090]. + [PR 3058]: https://github.com/libp2p/rust-libp2p/pull/3058 +[PR 3090]: https://github.com/libp2p/rust-libp2p/pull/3090 # 0.40.0 diff --git a/transports/plaintext/CHANGELOG.md b/transports/plaintext/CHANGELOG.md index 6af953ee3e0..41be38378ec 100644 --- a/transports/plaintext/CHANGELOG.md +++ b/transports/plaintext/CHANGELOG.md @@ -4,7 +4,10 @@ - Update to `libp2p-core` `v0.38.0`. +- Update `rust-version` to reflect the actual MSRV: 1.60.0. See [PR 3090]. + [PR 3058]: https://github.com/libp2p/rust-libp2p/pull/3058 +[PR 3090]: https://github.com/libp2p/rust-libp2p/pull/3090 # 0.37.0 diff --git a/transports/pnet/CHANGELOG.md b/transports/pnet/CHANGELOG.md index e63f196c869..da9130a42ce 100644 --- a/transports/pnet/CHANGELOG.md +++ b/transports/pnet/CHANGELOG.md @@ -1,3 +1,9 @@ +# 0.22.2 [unreleased] + +- Update `rust-version` to reflect the actual MSRV: 1.60.0. See [PR 3090]. + +[PR 3090]: https://github.com/libp2p/rust-libp2p/pull/3090 + # 0.22.1 - Bump rand to 0.8 and quickcheck to 1. See [PR 2857]. diff --git a/transports/pnet/Cargo.toml b/transports/pnet/Cargo.toml index c2f7cc48dd4..1e74be39f22 100644 --- a/transports/pnet/Cargo.toml +++ b/transports/pnet/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-pnet" edition = "2021" rust-version = "1.60.0" description = "Private swarm support for libp2p" -version = "0.22.1" +version = "0.22.2" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/transports/tcp/CHANGELOG.md b/transports/tcp/CHANGELOG.md index 4a9ed144bda..1410cdac4e4 100644 --- a/transports/tcp/CHANGELOG.md +++ b/transports/tcp/CHANGELOG.md @@ -6,7 +6,10 @@ - Update to `libp2p-core` `v0.38.0`. +- Update `rust-version` to reflect the actual MSRV: 1.60.0. See [PR 3090]. + [PR 2961]: https://github.com/libp2p/rust-libp2p/pull/2961 +[PR 3090]: https://github.com/libp2p/rust-libp2p/pull/3090 # 0.37.0 diff --git a/transports/uds/CHANGELOG.md b/transports/uds/CHANGELOG.md index 2f1426af12f..b19c220a1a5 100644 --- a/transports/uds/CHANGELOG.md +++ b/transports/uds/CHANGELOG.md @@ -1,5 +1,9 @@ # 0.37.0 [unreleased] +- Update `rust-version` to reflect the actual MSRV: 1.60.0. See [PR 3090]. + +[PR 3090]: https://github.com/libp2p/rust-libp2p/pull/3090 + # 0.36.0 - Remove default features. If you previously depended on `async-std` you need to enable this explicitly now. See [PR 2918]. diff --git a/transports/wasm-ext/CHANGELOG.md b/transports/wasm-ext/CHANGELOG.md index 8cb87863dfc..828705141c9 100644 --- a/transports/wasm-ext/CHANGELOG.md +++ b/transports/wasm-ext/CHANGELOG.md @@ -2,6 +2,10 @@ - Update to `libp2p-core` `v0.38.0`. +- Update `rust-version` to reflect the actual MSRV: 1.60.0. See [PR 3090]. + +[PR 3090]: https://github.com/libp2p/rust-libp2p/pull/3090 + # 0.37.0 - Update to `libp2p-core` `v0.37.0`. diff --git a/transports/websocket/CHANGELOG.md b/transports/websocket/CHANGELOG.md index 382b0951cb2..3b8f024af78 100644 --- a/transports/websocket/CHANGELOG.md +++ b/transports/websocket/CHANGELOG.md @@ -2,6 +2,10 @@ - Update to `libp2p-core` `v0.38.0`. +- Update `rust-version` to reflect the actual MSRV: 1.60.0. See [PR 3090]. + +[PR 3090]: https://github.com/libp2p/rust-libp2p/pull/3090 + # 0.39.0 - Update to `libp2p-core` `v0.37.0`. From 6d61142007165132e74ee437f3c9c9c41598b125 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Thu, 17 Nov 2022 12:34:09 +1100 Subject: [PATCH 20/23] Make `libp2p-swarm` wasm compatible again --- swarm/Cargo.toml | 4 +++- swarm/src/executor.rs | 20 ++++++++++++++++---- swarm/src/lib.rs | 10 ++++++++-- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/swarm/Cargo.toml b/swarm/Cargo.toml index b34a64db046..223a8f5651b 100644 --- a/swarm/Cargo.toml +++ b/swarm/Cargo.toml @@ -24,8 +24,10 @@ rand = "0.8" smallvec = "1.6.1" thiserror = "1.0" void = "1" -tokio = { version = "1.15", features = ["rt"], optional = true } + +[target.'cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")))'.dependencies] async-std = { version = "1.6.2", optional = true } +tokio = { version = "1.15", features = ["rt"], optional = true } [features] macros = ["dep:libp2p-swarm-derive"] diff --git a/swarm/src/executor.rs b/swarm/src/executor.rs index 7799d141d49..0d815cc2129 100644 --- a/swarm/src/executor.rs +++ b/swarm/src/executor.rs @@ -25,22 +25,34 @@ impl Executor for ThreadPool { } } -#[cfg(feature = "tokio")] +#[cfg(all( + feature = "tokio", + not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")) +))] #[derive(Default, Debug, Clone, Copy)] pub(crate) struct TokioExecutor; -#[cfg(feature = "tokio")] +#[cfg(all( + feature = "tokio", + not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")) +))] impl Executor for TokioExecutor { fn exec(&self, future: Pin + Send>>) { let _ = tokio::spawn(future); } } -#[cfg(feature = "async-std")] +#[cfg(all( + feature = "async-std", + not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")) +))] #[derive(Default, Debug, Clone, Copy)] pub(crate) struct AsyncStdExecutor; -#[cfg(feature = "async-std")] +#[cfg(all( + feature = "async-std", + not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")) +))] impl Executor for AsyncStdExecutor { fn exec(&self, future: Pin + Send>>) { let _ = async_std::task::spawn(future); diff --git a/swarm/src/lib.rs b/swarm/src/lib.rs index 6fc1b8707c3..2f80d0e88e2 100644 --- a/swarm/src/lib.rs +++ b/swarm/src/lib.rs @@ -353,7 +353,10 @@ where } /// Builds a new `Swarm` with a tokio executor. - #[cfg(feature = "tokio")] + #[cfg(all( + feature = "tokio", + not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")) + ))] pub fn with_tokio_executor( transport: transport::Boxed<(PeerId, StreamMuxerBox)>, behaviour: TBehaviour, @@ -368,7 +371,10 @@ where } /// Builds a new `Swarm` with an async-std executor. - #[cfg(feature = "async-std")] + #[cfg(all( + feature = "async-std", + not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")) + ))] pub fn with_async_std_executor( transport: transport::Boxed<(PeerId, StreamMuxerBox)>, behaviour: TBehaviour, From 5e8164db1269b019e758b184aa65918dfb7b19fb Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Fri, 18 Nov 2022 15:20:41 +1100 Subject: [PATCH 21/23] Set MSRV for webrtc --- transports/webrtc/Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/transports/webrtc/Cargo.toml b/transports/webrtc/Cargo.toml index bb4ae80d0ad..57b5dce1d0c 100644 --- a/transports/webrtc/Cargo.toml +++ b/transports/webrtc/Cargo.toml @@ -6,6 +6,7 @@ description = "WebRTC transport for libp2p" repository = "https://github.com/libp2p/rust-libp2p" license = "MIT" edition = "2021" +rust-version = "1.60.0" keywords = ["peer-to-peer", "libp2p", "networking"] categories = ["network-programming", "asynchronous"] From ca8dbeed336342b5e716da91764d991ee4f98613 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Fri, 18 Nov 2022 15:21:28 +1100 Subject: [PATCH 22/23] Fix clippy beta lints --- transports/webrtc/src/tokio/upgrade/noise.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/transports/webrtc/src/tokio/upgrade/noise.rs b/transports/webrtc/src/tokio/upgrade/noise.rs index 94566d008f0..37c999389a1 100644 --- a/transports/webrtc/src/tokio/upgrade/noise.rs +++ b/transports/webrtc/src/tokio/upgrade/noise.rs @@ -107,7 +107,7 @@ mod tests { let prologue1 = noise_prologue(a, b); let prologue2 = noise_prologue(b, a); - assert_eq!(hex::encode(&prologue1), "6c69627032702d7765627274632d6e6f6973653a12203e79af40d6059617a0d83b83a52ce73b0c1f37a72c6043ad2969e2351bdca870122030fc9f469c207419dfdd0aab5f27a86c973c94e40548db9375cca2e915973b99"); - assert_eq!(hex::encode(&prologue2), "6c69627032702d7765627274632d6e6f6973653a122030fc9f469c207419dfdd0aab5f27a86c973c94e40548db9375cca2e915973b9912203e79af40d6059617a0d83b83a52ce73b0c1f37a72c6043ad2969e2351bdca870"); + assert_eq!(hex::encode(prologue1), "6c69627032702d7765627274632d6e6f6973653a12203e79af40d6059617a0d83b83a52ce73b0c1f37a72c6043ad2969e2351bdca870122030fc9f469c207419dfdd0aab5f27a86c973c94e40548db9375cca2e915973b99"); + assert_eq!(hex::encode(prologue2), "6c69627032702d7765627274632d6e6f6973653a122030fc9f469c207419dfdd0aab5f27a86c973c94e40548db9375cca2e915973b9912203e79af40d6059617a0d83b83a52ce73b0c1f37a72c6043ad2969e2351bdca870"); } } From 489e16faee85e329a28c4db60c46903a99b5f0e0 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Fri, 18 Nov 2022 16:19:10 +1100 Subject: [PATCH 23/23] Don't compile libp2p-webrtc for wasm --- Cargo.toml | 4 ++-- src/lib.rs | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 863d41eca6e..7ba80244ab6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -110,7 +110,6 @@ libp2p-request-response = { version = "0.23.0", path = "protocols/request-respon libp2p-swarm = { version = "0.41.0", path = "swarm" } libp2p-uds = { version = "0.37.0", path = "transports/uds", optional = true } libp2p-wasm-ext = { version = "0.38.0", path = "transports/wasm-ext", optional = true } -libp2p-webrtc = { version = "0.1.0-alpha", path = "transports/webrtc", optional = true } libp2p-yamux = { version = "0.42.0", path = "muxers/yamux", optional = true } multiaddr = { version = "0.16.0" } parking_lot = "0.12.0" @@ -123,8 +122,9 @@ libp2p-dns = { version = "0.38.0", path = "transports/dns", optional = true } libp2p-mdns = { version = "0.42.0", path = "protocols/mdns", optional = true } libp2p-quic = { version = "0.7.0-alpha", path = "transports/quic", optional = true } libp2p-tcp = { version = "0.38.0", path = "transports/tcp", optional = true } -libp2p-websocket = { version = "0.40.0", path = "transports/websocket", optional = true } libp2p-tls = { version = "0.1.0-alpha", path = "transports/tls", optional = true } +libp2p-webrtc = { version = "0.1.0-alpha", path = "transports/webrtc", optional = true } +libp2p-websocket = { version = "0.40.0", path = "transports/websocket", optional = true } [target.'cfg(not(target_os = "unknown"))'.dependencies] libp2p-gossipsub = { version = "0.43.0", path = "protocols/gossipsub", optional = true } diff --git a/src/lib.rs b/src/lib.rs index 6749845bd9c..d4d72eeaf7d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -128,6 +128,7 @@ pub use libp2p_uds as uds; pub use libp2p_wasm_ext as wasm_ext; #[cfg(feature = "webrtc")] #[cfg_attr(docsrs, doc(cfg(feature = "webrtc")))] +#[cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")))] #[doc(inline)] pub use libp2p_webrtc as webrtc; #[cfg(feature = "websocket")]