diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 00000000000..3f2c1e603f3 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,3 @@ +[alias] +# Temporary solution to have clippy config in a single place until https://github.com/rust-lang/rust-clippy/blob/master/doc/roadmap-2021.md#lintstoml-configuration is shipped. +custom-clippy = "clippy -- -A clippy::type_complexity -A clippy::pedantic -A clippy::style -D warnings" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 46d7bab7638..1f625bc1dc0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -152,8 +152,7 @@ jobs: - name: Run cargo clippy uses: actions-rs/cargo@v1.0.3 with: - command: clippy - args: -- -A clippy::type_complexity -A clippy::pedantic -A clippy::style + command: custom-clippy # cargo alias to allow reuse of config locally integration-test: name: Integration tests diff --git a/CHANGELOG.md b/CHANGELOG.md index 485df8e2a18..f06ba8fcefb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,30 @@ # `libp2p` facade crate +## Version 0.40.0 [unreleased] + +- Update individual crates. + - `libp2p-core` + - `libp2p-deflate` + - `libp2p-dns` + - `libp2p-floodsub` + - `libp2p-gossipsub` + - `libp2p-identify` + - `libp2p-kad` + - `libp2p-mdns` + - `libp2p-mplex` + - `libp2p-noise` + - `libp2p-ping` + - `libp2p-plaintext` + - `libp2p-relay` + - `libp2p-request-response` + - `libp2p-swarm` + - `libp2p-tcp` + - `libp2p-uds` + - `libp2p-wasm-ext` + - `libp2p-websocket` + - `libp2p-yamux` + ## Version 0.39.1 [2021-07-12] - Update individual crates. diff --git a/Cargo.toml b/Cargo.toml index e1b1b0d92ab..c034a5894ba 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "libp2p" edition = "2018" description = "Peer-to-peer networking library" -version = "0.39.1" +version = "0.40.0" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" @@ -66,23 +66,23 @@ atomic = "0.5.0" bytes = "1" futures = "0.3.1" lazy_static = "1.2" -libp2p-core = { version = "0.29.0", path = "core", default-features = false } -libp2p-floodsub = { version = "0.30.0", path = "protocols/floodsub", optional = true } -libp2p-gossipsub = { version = "0.32.0", path = "./protocols/gossipsub", optional = true } -libp2p-identify = { version = "0.30.0", path = "protocols/identify", optional = true } -libp2p-kad = { version = "0.31.0", path = "protocols/kad", optional = true } -libp2p-mplex = { version = "0.29.0", path = "muxers/mplex", optional = true } -libp2p-noise = { version = "0.32.0", path = "transports/noise", optional = true } -libp2p-ping = { version = "0.30.0", path = "protocols/ping", optional = true } -libp2p-plaintext = { version = "0.29.0", path = "transports/plaintext", optional = true } +libp2p-core = { version = "0.30.0", path = "core", default-features = false } +libp2p-floodsub = { version = "0.31.0", path = "protocols/floodsub", optional = true } +libp2p-gossipsub = { version = "0.33.0", path = "./protocols/gossipsub", optional = true } +libp2p-identify = { version = "0.31.0", path = "protocols/identify", optional = true } +libp2p-kad = { version = "0.32.0", path = "protocols/kad", optional = true } +libp2p-mplex = { version = "0.30.0", path = "muxers/mplex", optional = true } +libp2p-noise = { version = "0.33.0", path = "transports/noise", optional = true } +libp2p-ping = { version = "0.31.0", path = "protocols/ping", optional = true } +libp2p-plaintext = { version = "0.30.0", path = "transports/plaintext", optional = true } libp2p-pnet = { version = "0.21.0", path = "transports/pnet", optional = true } -libp2p-relay = { version = "0.3.0", path = "protocols/relay", optional = true } -libp2p-request-response = { version = "0.12.0", path = "protocols/request-response", optional = true } -libp2p-swarm = { version = "0.30.0", path = "swarm" } +libp2p-relay = { version = "0.4.0", path = "protocols/relay", optional = true } +libp2p-request-response = { version = "0.13.0", path = "protocols/request-response", optional = true } +libp2p-swarm = { version = "0.31.0", path = "swarm" } libp2p-swarm-derive = { version = "0.24.0", path = "swarm-derive" } -libp2p-uds = { version = "0.29.0", path = "transports/uds", optional = true } -libp2p-wasm-ext = { version = "0.29.0", path = "transports/wasm-ext", default-features = false, optional = true } -libp2p-yamux = { version = "0.33.0", path = "muxers/yamux", optional = true } +libp2p-uds = { version = "0.30.0", path = "transports/uds", optional = true } +libp2p-wasm-ext = { version = "0.30.0", path = "transports/wasm-ext", default-features = false, optional = true } +libp2p-yamux = { version = "0.34.0", path = "muxers/yamux", optional = true } multiaddr = { version = "0.13.0" } parking_lot = "0.11.0" pin-project = "1.0.0" @@ -90,12 +90,12 @@ smallvec = "1.6.1" wasm-timer = "0.2.4" [target.'cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")))'.dependencies] -libp2p-deflate = { version = "0.29.0", path = "transports/deflate", optional = true } -libp2p-dns = { version = "0.29.0", path = "transports/dns", optional = true, default-features = false } -libp2p-mdns = { version = "0.31.0", path = "protocols/mdns", optional = true } +libp2p-deflate = { version = "0.30.0", path = "transports/deflate", optional = true } +libp2p-dns = { version = "0.30.0", path = "transports/dns", optional = true, default-features = false } +libp2p-mdns = { version = "0.32.0", path = "protocols/mdns", optional = true } libp2p-quic = { version = "0.6.0", path = "transports/quic", optional = true } -libp2p-tcp = { version = "0.29.0", path = "transports/tcp", default-features = false, optional = true } -libp2p-websocket = { version = "0.30.0", path = "transports/websocket", optional = true } +libp2p-tcp = { version = "0.30.0", path = "transports/tcp", default-features = false, optional = true } +libp2p-websocket = { version = "0.31.0", path = "transports/websocket", optional = true } [dev-dependencies] async-std = { version = "1.6.2", features = ["attributes"] } diff --git a/core/CHANGELOG.md b/core/CHANGELOG.md index dd6596be1cb..8dde82bcd56 100644 --- a/core/CHANGELOG.md +++ b/core/CHANGELOG.md @@ -1,3 +1,15 @@ +# 0.30.0 [unreleased] + +- Change `PublicKey::into_protobuf_encoding` to `PublicKey::to_protobuf_encoding` (see [PR 2145]). + +- Change `PublicKey::into_peer_id` to `PublicKey::to_peer_id` (see [PR 2145]). + +- Change `PeerId::from_public_key(PublicKey)` to `PeerId::from_public_key(&PublicKey)` (see [PR 2145]). + +- Add `From<&PublicKey> for PeerId` (see [PR 2145]). + +[PR 2145]: https://github.com/libp2p/rust-libp2p/pull/2145 + # 0.29.0 [2021-07-12] - Switch from `parity-multiaddr` to upstream `multiaddr`. diff --git a/core/Cargo.toml b/core/Cargo.toml index 8696ea53b22..e2ca3996738 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -2,7 +2,7 @@ name = "libp2p-core" edition = "2018" description = "Core traits and structs of libp2p" -version = "0.29.0" +version = "0.30.0" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" @@ -18,7 +18,7 @@ fnv = "1.0" futures = { version = "0.3.1", features = ["executor", "thread-pool"] } futures-timer = "3" lazy_static = "1.2" -libsecp256k1 = { version = "0.5.0", optional = true } +libsecp256k1 = { version = "0.6.0", optional = true } log = "0.4" multiaddr = { version = "0.13.0" } multihash = { version = "0.14", default-features = false, features = ["std", "multihash-impl", "identity", "sha2"] } diff --git a/core/benches/peer_id.rs b/core/benches/peer_id.rs index 32b2c1f5e3f..5dfb0d7c132 100644 --- a/core/benches/peer_id.rs +++ b/core/benches/peer_id.rs @@ -24,7 +24,7 @@ use libp2p_core::{identity, PeerId}; fn from_bytes(c: &mut Criterion) { let peer_id_bytes = identity::Keypair::generate_ed25519() .public() - .into_peer_id() + .to_peer_id() .to_bytes(); c.bench_function("from_bytes", |b| { @@ -37,7 +37,7 @@ fn from_bytes(c: &mut Criterion) { fn clone(c: &mut Criterion) { let peer_id = identity::Keypair::generate_ed25519() .public() - .into_peer_id(); + .to_peer_id(); c.bench_function("clone", |b| { b.iter(|| { @@ -51,7 +51,7 @@ fn sort_vec(c: &mut Criterion) { .map(|_| { identity::Keypair::generate_ed25519() .public() - .into_peer_id() + .to_peer_id() }) .collect(); diff --git a/core/src/identity.rs b/core/src/identity.rs index c0f3cb7d3ba..282199f55ed 100644 --- a/core/src/identity.rs +++ b/core/src/identity.rs @@ -179,7 +179,7 @@ impl PublicKey { /// Encode the public key into a protobuf structure for storage or /// exchange with other nodes. - pub fn into_protobuf_encoding(self) -> Vec { + pub fn to_protobuf_encoding(&self) -> Vec { use prost::Message; let public_key = match self { @@ -245,7 +245,7 @@ impl PublicKey { } /// Convert the `PublicKey` into the corresponding `PeerId`. - pub fn into_peer_id(self) -> PeerId { + pub fn to_peer_id(&self) -> PeerId { self.into() } } @@ -264,7 +264,7 @@ mod tests { let encoded = base64::decode(base_64_encoded).unwrap(); let keypair = Keypair::from_protobuf_encoding(&encoded).unwrap(); - let peer_id = keypair.public().into_peer_id(); + let peer_id = keypair.public().to_peer_id(); assert_eq!(expected_peer_id, peer_id); } diff --git a/core/src/peer_id.rs b/core/src/peer_id.rs index c4a12f703b3..37d46038243 100644 --- a/core/src/peer_id.rs +++ b/core/src/peer_id.rs @@ -52,8 +52,8 @@ impl fmt::Display for PeerId { impl PeerId { /// Builds a `PeerId` from a public key. - pub fn from_public_key(key: PublicKey) -> PeerId { - let key_enc = key.into_protobuf_encoding(); + pub fn from_public_key(key: &PublicKey) -> PeerId { + let key_enc = key.to_protobuf_encoding(); let hash_algorithm = if key_enc.len() <= MAX_INLINE_KEY_LENGTH { Code::Identity @@ -114,13 +114,19 @@ impl PeerId { pub fn is_public_key(&self, public_key: &PublicKey) -> Option { let alg = Code::try_from(self.multihash.code()) .expect("Internal multihash is always a valid `Code`"); - let enc = public_key.clone().into_protobuf_encoding(); + let enc = public_key.to_protobuf_encoding(); Some(alg.digest(&enc) == self.multihash) } } impl From for PeerId { fn from(key: PublicKey) -> PeerId { + PeerId::from_public_key(&key) + } +} + +impl From<&PublicKey> for PeerId { + fn from(key: &PublicKey) -> PeerId { PeerId::from_public_key(key) } } @@ -184,20 +190,20 @@ mod tests { #[test] fn peer_id_is_public_key() { let key = identity::Keypair::generate_ed25519().public(); - let peer_id = key.clone().into_peer_id(); + let peer_id = key.to_peer_id(); assert_eq!(peer_id.is_public_key(&key), Some(true)); } #[test] fn peer_id_into_bytes_then_from_bytes() { - let peer_id = identity::Keypair::generate_ed25519().public().into_peer_id(); + let peer_id = identity::Keypair::generate_ed25519().public().to_peer_id(); let second = PeerId::from_bytes(&peer_id.to_bytes()).unwrap(); assert_eq!(peer_id, second); } #[test] fn peer_id_to_base58_then_back() { - let peer_id = identity::Keypair::generate_ed25519().public().into_peer_id(); + let peer_id = identity::Keypair::generate_ed25519().public().to_peer_id(); let second: PeerId = peer_id.to_base58().parse().unwrap(); assert_eq!(peer_id, second); } diff --git a/core/tests/transport_upgrade.rs b/core/tests/transport_upgrade.rs index eecace3e46f..191e4b14e81 100644 --- a/core/tests/transport_upgrade.rs +++ b/core/tests/transport_upgrade.rs @@ -80,7 +80,7 @@ where #[test] fn upgrade_pipeline() { let listener_keys = identity::Keypair::generate_ed25519(); - let listener_id = listener_keys.public().into_peer_id(); + let listener_id = listener_keys.public().to_peer_id(); let listener_noise_keys = noise::Keypair::::new().into_authentic(&listener_keys).unwrap(); let listener_transport = MemoryTransport::default() .upgrade(upgrade::Version::V1) @@ -96,7 +96,7 @@ fn upgrade_pipeline() { }); let dialer_keys = identity::Keypair::generate_ed25519(); - let dialer_id = dialer_keys.public().into_peer_id(); + let dialer_id = dialer_keys.public().to_peer_id(); let dialer_noise_keys = noise::Keypair::::new().into_authentic(&dialer_keys).unwrap(); let dialer_transport = MemoryTransport::default() .upgrade(upgrade::Version::V1) diff --git a/misc/multistream-select/tests/transport.rs b/misc/multistream-select/tests/transport.rs index 63c6ed90f93..ad4a9e36938 100644 --- a/misc/multistream-select/tests/transport.rs +++ b/misc/multistream-select/tests/transport.rs @@ -42,7 +42,7 @@ type TestNetwork = Network; fn mk_transport(up: upgrade::Version) -> (PeerId, TestTransport) { let keys = identity::Keypair::generate_ed25519(); - let id = keys.public().into_peer_id(); + let id = keys.public().to_peer_id(); (id, MemoryTransport::default() .upgrade(up) .authenticate(PlainText2Config { local_public_key: keys.public() }) diff --git a/misc/peer-id-generator/src/main.rs b/misc/peer-id-generator/src/main.rs index afa95909256..6ac7af7e358 100644 --- a/misc/peer-id-generator/src/main.rs +++ b/misc/peer-id-generator/src/main.rs @@ -68,7 +68,7 @@ fn main() { thread::spawn(move || loop { let keypair = identity::ed25519::Keypair::generate(); let secret = keypair.secret(); - let peer_id = identity::PublicKey::Ed25519(keypair.public()).into_peer_id(); + let peer_id = identity::PublicKey::Ed25519(keypair.public()).to_peer_id(); let base58 = peer_id.to_base58(); if base58[2..].starts_with(&prefix) { println!("Found {:?}", peer_id); diff --git a/muxers/mplex/CHANGELOG.md b/muxers/mplex/CHANGELOG.md index 7350c34199c..b0b697ae492 100644 --- a/muxers/mplex/CHANGELOG.md +++ b/muxers/mplex/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.30.0 [unreleased] + +- Update dependencies. + # 0.29.0 [2021-07-12] - Update dependencies. diff --git a/muxers/mplex/Cargo.toml b/muxers/mplex/Cargo.toml index 7a3a018b5bf..df0033dea53 100644 --- a/muxers/mplex/Cargo.toml +++ b/muxers/mplex/Cargo.toml @@ -2,7 +2,7 @@ name = "libp2p-mplex" edition = "2018" description = "Mplex multiplexing protocol for libp2p" -version = "0.29.0" +version = "0.30.0" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" @@ -13,7 +13,7 @@ categories = ["network-programming", "asynchronous"] bytes = "1" futures = "0.3.1" asynchronous-codec = "0.6" -libp2p-core = { version = "0.29.0", path = "../../core" } +libp2p-core = { version = "0.30.0", path = "../../core" } log = "0.4" nohash-hasher = "0.2" parking_lot = "0.11" diff --git a/muxers/yamux/CHANGELOG.md b/muxers/yamux/CHANGELOG.md index 9c58fbe9f9a..8923cc23f9e 100644 --- a/muxers/yamux/CHANGELOG.md +++ b/muxers/yamux/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.34.0 [unreleased] + +- Update dependencies. + # 0.33.0 [2021-07-12] - Update dependencies. diff --git a/muxers/yamux/Cargo.toml b/muxers/yamux/Cargo.toml index d4278d75516..28a47cb58cf 100644 --- a/muxers/yamux/Cargo.toml +++ b/muxers/yamux/Cargo.toml @@ -2,7 +2,7 @@ name = "libp2p-yamux" edition = "2018" description = "Yamux multiplexing protocol for libp2p" -version = "0.33.0" +version = "0.34.0" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" @@ -11,7 +11,7 @@ categories = ["network-programming", "asynchronous"] [dependencies] futures = "0.3.1" -libp2p-core = { version = "0.29.0", path = "../../core" } +libp2p-core = { version = "0.30.0", path = "../../core" } parking_lot = "0.11" thiserror = "1.0" yamux = "0.9.0" diff --git a/protocols/floodsub/CHANGELOG.md b/protocols/floodsub/CHANGELOG.md index 162fc0eb563..6abdd6f810d 100644 --- a/protocols/floodsub/CHANGELOG.md +++ b/protocols/floodsub/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.31.0 [unreleased] + +- Update dependencies. + # 0.30.0 [2021-07-12] - Update dependencies. diff --git a/protocols/floodsub/Cargo.toml b/protocols/floodsub/Cargo.toml index 18b5f524454..b4b5b51f954 100644 --- a/protocols/floodsub/Cargo.toml +++ b/protocols/floodsub/Cargo.toml @@ -2,7 +2,7 @@ name = "libp2p-floodsub" edition = "2018" description = "Floodsub protocol for libp2p" -version = "0.30.0" +version = "0.31.0" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" @@ -13,8 +13,8 @@ categories = ["network-programming", "asynchronous"] cuckoofilter = "0.5.0" fnv = "1.0" futures = "0.3.1" -libp2p-core = { version = "0.29.0", path = "../../core" } -libp2p-swarm = { version = "0.30.0", path = "../../swarm" } +libp2p-core = { version = "0.30.0", path = "../../core" } +libp2p-swarm = { version = "0.31.0", path = "../../swarm" } log = "0.4" prost = "0.8" rand = "0.7" diff --git a/protocols/gossipsub/CHANGELOG.md b/protocols/gossipsub/CHANGELOG.md index 0f2a4d6e40a..f0d1d7a5e51 100644 --- a/protocols/gossipsub/CHANGELOG.md +++ b/protocols/gossipsub/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.33.0 [unreleased] + +- Update dependencies. + # 0.32.0 [2021-07-12] - Update dependencies. diff --git a/protocols/gossipsub/Cargo.toml b/protocols/gossipsub/Cargo.toml index feaa120606c..1b99bfbf2e7 100644 --- a/protocols/gossipsub/Cargo.toml +++ b/protocols/gossipsub/Cargo.toml @@ -2,7 +2,7 @@ name = "libp2p-gossipsub" edition = "2018" description = "Gossipsub protocol for libp2p" -version = "0.32.0" +version = "0.33.0" authors = ["Age Manning "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" @@ -10,8 +10,8 @@ keywords = ["peer-to-peer", "libp2p", "networking"] categories = ["network-programming", "asynchronous"] [dependencies] -libp2p-swarm = { version = "0.30.0", path = "../../swarm" } -libp2p-core = { version = "0.29.0", path = "../../core" } +libp2p-swarm = { version = "0.31.0", path = "../../swarm" } +libp2p-core = { version = "0.30.0", path = "../../core" } bytes = "1.0" byteorder = "1.3.4" fnv = "1.0.7" diff --git a/protocols/gossipsub/src/behaviour.rs b/protocols/gossipsub/src/behaviour.rs index eea59d5b161..ea6f6a4aa9f 100644 --- a/protocols/gossipsub/src/behaviour.rs +++ b/protocols/gossipsub/src/behaviour.rs @@ -169,7 +169,7 @@ impl From for PublishConfig { match authenticity { MessageAuthenticity::Signed(keypair) => { let public_key = keypair.public(); - let key_enc = public_key.clone().into_protobuf_encoding(); + let key_enc = public_key.to_protobuf_encoding(); let key = if key_enc.len() <= 42 { // The public key can be inlined in [`rpc_proto::Message::from`], so we don't include it // specifically in the [`rpc_proto::Message::key`] field. @@ -181,7 +181,7 @@ impl From for PublishConfig { PublishConfig::Signing { keypair, - author: public_key.into_peer_id(), + author: public_key.to_peer_id(), inline_key: key, } } diff --git a/protocols/gossipsub/src/protocol.rs b/protocols/gossipsub/src/protocol.rs index ac2584107dd..19293f58d7e 100644 --- a/protocols/gossipsub/src/protocol.rs +++ b/protocols/gossipsub/src/protocol.rs @@ -228,7 +228,7 @@ impl GossipsubCodec { }; // The key must match the peer_id - if source != public_key.clone().into_peer_id() { + if source != public_key.to_peer_id() { warn!("Signature verification failed: Public key doesn't match source peer id"); return false; } diff --git a/protocols/gossipsub/tests/smoke.rs b/protocols/gossipsub/tests/smoke.rs index 1e2ab4a5013..841929a7f0c 100644 --- a/protocols/gossipsub/tests/smoke.rs +++ b/protocols/gossipsub/tests/smoke.rs @@ -153,7 +153,7 @@ fn build_node() -> (Multiaddr, Swarm) { .multiplex(yamux::YamuxConfig::default()) .boxed(); - let peer_id = public_key.clone().into_peer_id(); + let peer_id = public_key.to_peer_id(); // NOTE: The graph of created nodes can be disconnected from the mesh point of view as nodes // can reach their d_lo value and not add other nodes to their mesh. To speed up this test, we @@ -176,7 +176,7 @@ fn build_node() -> (Multiaddr, Swarm) { swarm.listen_on(addr.clone()).unwrap(); addr = addr.with(libp2p_core::multiaddr::Protocol::P2p( - public_key.into_peer_id().into(), + public_key.to_peer_id().into(), )); (addr, swarm) diff --git a/protocols/identify/CHANGELOG.md b/protocols/identify/CHANGELOG.md index 861fba49cb1..2b5a255d73e 100644 --- a/protocols/identify/CHANGELOG.md +++ b/protocols/identify/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.31.0 [unreleased] + +- Update dependencies. + # 0.30.0 [2021-07-12] - Update dependencies. diff --git a/protocols/identify/Cargo.toml b/protocols/identify/Cargo.toml index dc996acff76..8213edc8dc6 100644 --- a/protocols/identify/Cargo.toml +++ b/protocols/identify/Cargo.toml @@ -2,7 +2,7 @@ name = "libp2p-identify" edition = "2018" description = "Nodes identifcation protocol for libp2p" -version = "0.30.0" +version = "0.31.0" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" @@ -11,8 +11,8 @@ categories = ["network-programming", "asynchronous"] [dependencies] futures = "0.3.1" -libp2p-core = { version = "0.29.0", path = "../../core" } -libp2p-swarm = { version = "0.30.0", path = "../../swarm" } +libp2p-core = { version = "0.30.0", path = "../../core" } +libp2p-swarm = { version = "0.31.0", path = "../../swarm" } log = "0.4.1" prost = "0.8" smallvec = "1.6.1" diff --git a/protocols/identify/src/identify.rs b/protocols/identify/src/identify.rs index d6bc6abb5bc..f9c9b137847 100644 --- a/protocols/identify/src/identify.rs +++ b/protocols/identify/src/identify.rs @@ -478,7 +478,7 @@ mod tests { let protocol = Identify::new( IdentifyConfig::new("a".to_string(), pubkey.clone()) .with_agent_version("b".to_string())); - let swarm = Swarm::new(transport, protocol, pubkey.clone().into_peer_id()); + let swarm = Swarm::new(transport, protocol, pubkey.to_peer_id()); (swarm, pubkey) }; @@ -487,7 +487,7 @@ mod tests { let protocol = Identify::new( IdentifyConfig::new("c".to_string(), pubkey.clone()) .with_agent_version("d".to_string())); - let swarm = Swarm::new(transport, protocol, pubkey.clone().into_peer_id()); + let swarm = Swarm::new(transport, protocol, pubkey.to_peer_id()); (swarm, pubkey) }; @@ -555,7 +555,7 @@ mod tests { IdentifyConfig::new("a".to_string(), pubkey.clone()) // Delay identification requests so we can test the push protocol. .with_initial_delay(Duration::from_secs(u32::MAX as u64))); - let swarm = Swarm::new(transport, protocol, pubkey.clone().into_peer_id()); + let swarm = Swarm::new(transport, protocol, pubkey.to_peer_id()); (swarm, pubkey) }; @@ -566,7 +566,7 @@ mod tests { .with_agent_version("b".to_string()) // Delay identification requests so we can test the push protocol. .with_initial_delay(Duration::from_secs(u32::MAX as u64))); - let swarm = Swarm::new(transport, protocol, pubkey.clone().into_peer_id()); + let swarm = Swarm::new(transport, protocol, pubkey.to_peer_id()); (swarm, pubkey) }; @@ -612,7 +612,7 @@ mod tests { } } - swarm2.behaviour_mut().push(std::iter::once(pubkey1.clone().into_peer_id())); + swarm2.behaviour_mut().push(std::iter::once(pubkey1.to_peer_id())); } }) } diff --git a/protocols/identify/src/protocol.rs b/protocols/identify/src/protocol.rs index 896abd7186c..fafa5a37855 100644 --- a/protocols/identify/src/protocol.rs +++ b/protocols/identify/src/protocol.rs @@ -173,7 +173,7 @@ where .map(|addr| addr.to_vec()) .collect(); - let pubkey_bytes = info.public_key.into_protobuf_encoding(); + let pubkey_bytes = info.public_key.to_protobuf_encoding(); let message = structs_proto::Identify { agent_version: Some(info.agent_version), diff --git a/protocols/kad/CHANGELOG.md b/protocols/kad/CHANGELOG.md index 02c18627d0c..0cf78776687 100644 --- a/protocols/kad/CHANGELOG.md +++ b/protocols/kad/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.32.0 [unreleased] + +- Update dependencies. + # 0.31.0 [2021-07-12] - Update dependencies. diff --git a/protocols/kad/Cargo.toml b/protocols/kad/Cargo.toml index c738dbf5f56..2dd5e7287c0 100644 --- a/protocols/kad/Cargo.toml +++ b/protocols/kad/Cargo.toml @@ -2,7 +2,7 @@ name = "libp2p-kad" edition = "2018" description = "Kademlia protocol for libp2p" -version = "0.31.0" +version = "0.32.0" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" @@ -17,8 +17,8 @@ fnv = "1.0" asynchronous-codec = "0.6" futures = "0.3.1" log = "0.4" -libp2p-core = { version = "0.29.0", path = "../../core" } -libp2p-swarm = { version = "0.30.0", path = "../../swarm" } +libp2p-core = { version = "0.30.0", path = "../../core" } +libp2p-swarm = { version = "0.31.0", path = "../../swarm" } prost = "0.8" rand = "0.7.2" sha2 = "0.9.1" diff --git a/protocols/kad/src/behaviour/test.rs b/protocols/kad/src/behaviour/test.rs index f22b4b65a7d..9bd640878d0 100644 --- a/protocols/kad/src/behaviour/test.rs +++ b/protocols/kad/src/behaviour/test.rs @@ -64,7 +64,7 @@ fn build_node_with_config(cfg: KademliaConfig) -> (Multiaddr, TestSwarm) { .multiplex(yamux::YamuxConfig::default()) .boxed(); - let local_id = local_public_key.clone().into_peer_id(); + let local_id = local_public_key.to_peer_id(); let store = MemoryStore::new(local_id.clone()); let behaviour = Kademlia::with_config(local_id.clone(), store, cfg.clone()); diff --git a/protocols/mdns/CHANGELOG.md b/protocols/mdns/CHANGELOG.md index 97489bb764f..b631ac948cd 100644 --- a/protocols/mdns/CHANGELOG.md +++ b/protocols/mdns/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.32.0 [unreleased] + +- Update dependencies. + # 0.31.0 [2021-07-12] - Update dependencies. diff --git a/protocols/mdns/Cargo.toml b/protocols/mdns/Cargo.toml index d4cbed718b8..35015044cbf 100644 --- a/protocols/mdns/Cargo.toml +++ b/protocols/mdns/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "libp2p-mdns" edition = "2018" -version = "0.31.0" +version = "0.32.0" description = "Implementation of the libp2p mDNS discovery method" authors = ["Parity Technologies "] license = "MIT" @@ -16,8 +16,8 @@ dns-parser = "0.8.0" futures = "0.3.13" if-watch = "0.2.0" lazy_static = "1.4.0" -libp2p-core = { version = "0.29.0", path = "../../core" } -libp2p-swarm = { version = "0.30.0", path = "../../swarm" } +libp2p-core = { version = "0.30.0", path = "../../core" } +libp2p-swarm = { version = "0.31.0", path = "../../swarm" } log = "0.4.14" rand = "0.8.3" smallvec = "1.6.1" diff --git a/protocols/mdns/src/dns.rs b/protocols/mdns/src/dns.rs index fa89caa3fc6..82b52b0d134 100644 --- a/protocols/mdns/src/dns.rs +++ b/protocols/mdns/src/dns.rs @@ -419,7 +419,7 @@ mod tests { fn build_query_response_correct() { let my_peer_id = identity::Keypair::generate_ed25519() .public() - .into_peer_id(); + .to_peer_id(); let addr1 = "/ip4/1.2.3.4/tcp/5000".parse().unwrap(); let addr2 = "/ip6/::1/udp/10000".parse().unwrap(); let packets = build_query_response( diff --git a/protocols/ping/CHANGELOG.md b/protocols/ping/CHANGELOG.md index 68ff4c0f6c9..b7ce182e961 100644 --- a/protocols/ping/CHANGELOG.md +++ b/protocols/ping/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.31.0 [unreleased] + +- Update dependencies. + # 0.30.0 [2021-07-12] - Update dependencies. diff --git a/protocols/ping/Cargo.toml b/protocols/ping/Cargo.toml index 6062574b172..7d3c093ee98 100644 --- a/protocols/ping/Cargo.toml +++ b/protocols/ping/Cargo.toml @@ -2,7 +2,7 @@ name = "libp2p-ping" edition = "2018" description = "Ping protocol for libp2p" -version = "0.30.0" +version = "0.31.0" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" @@ -11,8 +11,8 @@ categories = ["network-programming", "asynchronous"] [dependencies] futures = "0.3.1" -libp2p-core = { version = "0.29.0", path = "../../core" } -libp2p-swarm = { version = "0.30.0", path = "../../swarm" } +libp2p-core = { version = "0.30.0", path = "../../core" } +libp2p-swarm = { version = "0.31.0", path = "../../swarm" } log = "0.4.1" rand = "0.7.2" void = "1.0" diff --git a/protocols/ping/tests/ping.rs b/protocols/ping/tests/ping.rs index 4b356e5d5f9..f84bc4650e9 100644 --- a/protocols/ping/tests/ping.rs +++ b/protocols/ping/tests/ping.rs @@ -195,7 +195,7 @@ fn mk_transport(muxer: MuxerChoice) -> ( transport::Boxed<(PeerId, StreamMuxerBox)> ) { let id_keys = identity::Keypair::generate_ed25519(); - let peer_id = id_keys.public().into_peer_id(); + let peer_id = id_keys.public().to_peer_id(); let noise_keys = noise::Keypair::::new().into_authentic(&id_keys).unwrap(); (peer_id, TcpConfig::new() .nodelay(true) diff --git a/protocols/relay/CHANGELOG.md b/protocols/relay/CHANGELOG.md index 4ba329456d0..e06ec87dcdf 100644 --- a/protocols/relay/CHANGELOG.md +++ b/protocols/relay/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.4.0 [unreleased] + +- Update dependencies. + # 0.3.0 [2021-07-12] - Update dependencies. diff --git a/protocols/relay/Cargo.toml b/protocols/relay/Cargo.toml index 36c9ff250a4..159dd7c016a 100644 --- a/protocols/relay/Cargo.toml +++ b/protocols/relay/Cargo.toml @@ -2,7 +2,7 @@ name = "libp2p-relay" edition = "2018" description = "Communications relaying for libp2p" -version = "0.3.0" +version = "0.4.0" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" @@ -14,8 +14,8 @@ asynchronous-codec = "0.6" bytes = "1" futures = "0.3.1" futures-timer = "3" -libp2p-core = { version = "0.29", path = "../../core" } -libp2p-swarm = { version = "0.30", path = "../../swarm" } +libp2p-core = { version = "0.30.0", path = "../../core" } +libp2p-swarm = { version = "0.31.0", path = "../../swarm" } log = "0.4" pin-project = "1" prost = "0.8" diff --git a/protocols/relay/src/behaviour.rs b/protocols/relay/src/behaviour.rs index 81fe6da8957..78e9e5d8d66 100644 --- a/protocols/relay/src/behaviour.rs +++ b/protocols/relay/src/behaviour.rs @@ -756,6 +756,7 @@ impl NetworkBehaviour for Relay { } #[derive(Debug)] +#[allow(clippy::large_enum_variant)] pub enum BehaviourToListenerMsg { ConnectionToRelayEstablished, IncomingRelayedConnection { diff --git a/protocols/relay/src/handler.rs b/protocols/relay/src/handler.rs index 7ea0d8731ac..e336b4821e2 100644 --- a/protocols/relay/src/handler.rs +++ b/protocols/relay/src/handler.rs @@ -733,6 +733,7 @@ impl ProtocolsHandler for RelayHandler { } } +#[allow(clippy::large_enum_variant)] pub enum RelayOutboundOpenInfo { Relay { dst_peer_id: PeerId, diff --git a/protocols/relay/src/lib.rs b/protocols/relay/src/lib.rs index 7f81860534d..c092f494ed6 100644 --- a/protocols/relay/src/lib.rs +++ b/protocols/relay/src/lib.rs @@ -35,7 +35,7 @@ //! # //! # let local_key = identity::Keypair::generate_ed25519(); //! # let local_public_key = local_key.public(); -//! # let local_peer_id = local_public_key.clone().into_peer_id(); +//! # let local_peer_id = local_public_key.to_peer_id(); //! # let plaintext = PlainText2Config { //! # local_public_key: local_public_key.clone(), //! # }; diff --git a/protocols/relay/src/protocol/listen.rs b/protocols/relay/src/protocol/listen.rs index 70a084640f8..168861a2715 100644 --- a/protocols/relay/src/protocol/listen.rs +++ b/protocols/relay/src/protocol/listen.rs @@ -76,7 +76,7 @@ impl upgrade::InboundUpgrade for RelayListen { let msg: bytes::BytesMut = substream .next() .await - .ok_or(std::io::Error::new(std::io::ErrorKind::UnexpectedEof, ""))??; + .ok_or_else(|| std::io::Error::new(std::io::ErrorKind::UnexpectedEof, ""))??; let CircuitRelay { r#type, src_peer, diff --git a/protocols/relay/src/protocol/outgoing_dst_req.rs b/protocols/relay/src/protocol/outgoing_dst_req.rs index 0a257da3bab..7cffb1a1d96 100644 --- a/protocols/relay/src/protocol/outgoing_dst_req.rs +++ b/protocols/relay/src/protocol/outgoing_dst_req.rs @@ -100,7 +100,7 @@ impl upgrade::OutboundUpgrade for OutgoingDstReq { substream .next() .await - .ok_or(OutgoingDstReqError::Io(std::io::Error::new( + .ok_or_else(|| OutgoingDstReqError::Io(std::io::Error::new( std::io::ErrorKind::UnexpectedEof, "", )))??; diff --git a/protocols/relay/src/protocol/outgoing_relay_req.rs b/protocols/relay/src/protocol/outgoing_relay_req.rs index 8f6ed8b3aa3..a34f10eba26 100644 --- a/protocols/relay/src/protocol/outgoing_relay_req.rs +++ b/protocols/relay/src/protocol/outgoing_relay_req.rs @@ -87,7 +87,7 @@ impl upgrade::OutboundUpgrade for OutgoingRelayReq { }), dst_peer: Some(circuit_relay::Peer { id: dst_id.to_bytes(), - addrs: vec![dst_address.unwrap_or(Multiaddr::empty()).to_vec()], + addrs: vec![dst_address.unwrap_or_else(Multiaddr::empty).to_vec()], }), code: None, }; @@ -107,7 +107,7 @@ impl upgrade::OutboundUpgrade for OutgoingRelayReq { substream .next() .await - .ok_or(OutgoingRelayReqError::Io(std::io::Error::new( + .ok_or_else(|| OutgoingRelayReqError::Io(std::io::Error::new( std::io::ErrorKind::UnexpectedEof, "", )))??; diff --git a/protocols/relay/src/transport.rs b/protocols/relay/src/transport.rs index 4aa96f69933..b3729c0582f 100644 --- a/protocols/relay/src/transport.rs +++ b/protocols/relay/src/transport.rs @@ -198,7 +198,7 @@ impl Transport for RelayTransport { }; let (to_listener, from_behaviour) = mpsc::channel(0); - let mut to_behaviour = self.to_behaviour.clone(); + let mut to_behaviour = self.to_behaviour; let msg_to_behaviour = Some( async move { to_behaviour @@ -242,7 +242,7 @@ impl Transport for RelayTransport { let relay_addr = relay_addr.ok_or(RelayError::MissingRelayAddr)?; let dst_peer_id = dst_peer_id.ok_or(RelayError::MissingDstPeerId)?; - let mut to_behaviour = self.to_behaviour.clone(); + let mut to_behaviour = self.to_behaviour; Ok(EitherFuture::Second( async move { let (tx, rx) = oneshot::channel(); diff --git a/protocols/relay/tests/lib.rs b/protocols/relay/tests/lib.rs index 68c7e96a58e..601993f5619 100644 --- a/protocols/relay/tests/lib.rs +++ b/protocols/relay/tests/lib.rs @@ -1249,7 +1249,7 @@ fn build_swarm(reachability: Reachability, relay_mode: RelayMode) -> Swarm Swarm { let plaintext = PlainText2Config { local_public_key: local_public_key.clone(), }; - let local_peer_id = local_public_key.clone().into_peer_id(); + let local_peer_id = local_public_key.to_peer_id(); let transport = MemoryTransport::default(); @@ -1322,7 +1322,7 @@ fn build_keep_alive_only_swarm() -> Swarm { let plaintext = PlainText2Config { local_public_key: local_public_key.clone(), }; - let local_peer_id = local_public_key.clone().into_peer_id(); + let local_peer_id = local_public_key.to_peer_id(); let transport = MemoryTransport::default(); diff --git a/protocols/request-response/CHANGELOG.md b/protocols/request-response/CHANGELOG.md index 3f82fe12459..71188ec9730 100644 --- a/protocols/request-response/CHANGELOG.md +++ b/protocols/request-response/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.13.0 [unreleased] + +- Update dependencies. + # 0.12.0 [2021-07-12] - Update dependencies. diff --git a/protocols/request-response/Cargo.toml b/protocols/request-response/Cargo.toml index 577f8f72b9c..3c493ddd8ec 100644 --- a/protocols/request-response/Cargo.toml +++ b/protocols/request-response/Cargo.toml @@ -2,7 +2,7 @@ name = "libp2p-request-response" edition = "2018" description = "Generic Request/Response Protocols" -version = "0.12.0" +version = "0.13.0" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" @@ -13,11 +13,11 @@ categories = ["network-programming", "asynchronous"] async-trait = "0.1" bytes = "1" futures = "0.3.1" -libp2p-core = { version = "0.29.0", path = "../../core" } -libp2p-swarm = { version = "0.30.0", path = "../../swarm" } +libp2p-core = { version = "0.30.0", path = "../../core" } +libp2p-swarm = { version = "0.31.0", path = "../../swarm" } log = "0.4.11" lru = "0.6" -minicbor = { version = "0.8", features = ["std", "derive"] } +minicbor = { version = "0.9", features = ["std", "derive"] } rand = "0.7" smallvec = "1.6.1" unsigned-varint = { version = "0.7", features = ["std", "futures"] } diff --git a/protocols/request-response/tests/ping.rs b/protocols/request-response/tests/ping.rs index 7681b98b425..43bed41b302 100644 --- a/protocols/request-response/tests/ping.rs +++ b/protocols/request-response/tests/ping.rs @@ -383,7 +383,7 @@ fn ping_protocol_throttled() { fn mk_transport() -> (PeerId, transport::Boxed<(PeerId, StreamMuxerBox)>) { let id_keys = identity::Keypair::generate_ed25519(); - let peer_id = id_keys.public().into_peer_id(); + let peer_id = id_keys.public().to_peer_id(); let noise_keys = Keypair::::new().into_authentic(&id_keys).unwrap(); (peer_id, TcpConfig::new() .nodelay(true) diff --git a/swarm/CHANGELOG.md b/swarm/CHANGELOG.md index fe91936cb76..05141bb8622 100644 --- a/swarm/CHANGELOG.md +++ b/swarm/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.31.0 [unreleased] + +- Update dependencies. + # 0.30.0 [2021-07-12] - Update dependencies. diff --git a/swarm/Cargo.toml b/swarm/Cargo.toml index 90865fce530..b7ea6525447 100644 --- a/swarm/Cargo.toml +++ b/swarm/Cargo.toml @@ -2,7 +2,7 @@ name = "libp2p-swarm" edition = "2018" description = "The libp2p swarm" -version = "0.30.0" +version = "0.31.0" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" @@ -12,7 +12,7 @@ categories = ["network-programming", "asynchronous"] [dependencies] either = "1.6.0" futures = "0.3.1" -libp2p-core = { version = "0.29.0", path = "../core" } +libp2p-core = { version = "0.30.0", path = "../core" } log = "0.4" rand = "0.7" smallvec = "1.6.1" diff --git a/transports/deflate/CHANGELOG.md b/transports/deflate/CHANGELOG.md index 3ba359ac558..4a43c23b83b 100644 --- a/transports/deflate/CHANGELOG.md +++ b/transports/deflate/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.30.0 [unreleased] + +- Update dependencies. + # 0.29.0 [2021-07-12] - Update dependencies. diff --git a/transports/deflate/Cargo.toml b/transports/deflate/Cargo.toml index 6c43b792e1d..6ab23c1cef5 100644 --- a/transports/deflate/Cargo.toml +++ b/transports/deflate/Cargo.toml @@ -2,7 +2,7 @@ name = "libp2p-deflate" edition = "2018" description = "Deflate encryption protocol for libp2p" -version = "0.29.0" +version = "0.30.0" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" @@ -11,7 +11,7 @@ categories = ["network-programming", "asynchronous"] [dependencies] futures = "0.3.1" -libp2p-core = { version = "0.29.0", path = "../../core" } +libp2p-core = { version = "0.30.0", path = "../../core" } flate2 = "1.0" [dev-dependencies] diff --git a/transports/dns/CHANGELOG.md b/transports/dns/CHANGELOG.md index 40acc71c23e..96b4f41babe 100644 --- a/transports/dns/CHANGELOG.md +++ b/transports/dns/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.30.0 [unreleased] + +- Update dependencies. + # 0.29.0 [2021-07-12] - Update dependencies. diff --git a/transports/dns/Cargo.toml b/transports/dns/Cargo.toml index aaa6a82a2e6..df388345486 100644 --- a/transports/dns/Cargo.toml +++ b/transports/dns/Cargo.toml @@ -2,7 +2,7 @@ name = "libp2p-dns" edition = "2018" description = "DNS transport implementation for libp2p" -version = "0.29.0" +version = "0.30.0" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" @@ -10,7 +10,7 @@ keywords = ["peer-to-peer", "libp2p", "networking"] categories = ["network-programming", "asynchronous"] [dependencies] -libp2p-core = { version = "0.29.0", path = "../../core" } +libp2p-core = { version = "0.30.0", path = "../../core" } log = "0.4.1" futures = "0.3.1" trust-dns-resolver = { version = "0.20", default-features = false, features = ["system-config"] } diff --git a/transports/dns/src/lib.rs b/transports/dns/src/lib.rs index 0d2e2212211..499f33e8e5e 100644 --- a/transports/dns/src/lib.rs +++ b/transports/dns/src/lib.rs @@ -330,6 +330,7 @@ where /// The possible errors of a [`GenDnsConfig`] wrapped transport. #[derive(Debug)] +#[allow(clippy::large_enum_variant)] pub enum DnsErr { /// The underlying transport encountered an error. Transport(TErr), diff --git a/transports/noise/CHANGELOG.md b/transports/noise/CHANGELOG.md index 016ab8e3c86..1df94010538 100644 --- a/transports/noise/CHANGELOG.md +++ b/transports/noise/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.33.0 [unreleased] + +- Update dependencies. + # 0.32.0 [2021-07-12] - Update dependencies. diff --git a/transports/noise/Cargo.toml b/transports/noise/Cargo.toml index 9e0c5e88b6d..cf3880ec84f 100644 --- a/transports/noise/Cargo.toml +++ b/transports/noise/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "libp2p-noise" description = "Cryptographic handshake protocol using the noise framework." -version = "0.32.0" +version = "0.33.0" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" @@ -12,7 +12,7 @@ bytes = "1" curve25519-dalek = "3.0.0" futures = "0.3.1" lazy_static = "1.2" -libp2p-core = { version = "0.29.0", path = "../../core" } +libp2p-core = { version = "0.30.0", path = "../../core" } log = "0.4" prost = "0.8" rand = "0.8.3" diff --git a/transports/noise/src/io/handshake.rs b/transports/noise/src/io/handshake.rs index fa74ed8555a..21faa84d100 100644 --- a/transports/noise/src/io/handshake.rs +++ b/transports/noise/src/io/handshake.rs @@ -432,7 +432,7 @@ where let mut pb = payload_proto::NoiseHandshakePayload::default(); if state.send_identity { - pb.identity_key = state.identity.public.clone().into_protobuf_encoding() + pb.identity_key = state.identity.public.to_protobuf_encoding() } if let Some(ref sig) = state.identity.signature { diff --git a/transports/noise/src/lib.rs b/transports/noise/src/lib.rs index 6b09f636cd1..3cb685454bb 100644 --- a/transports/noise/src/lib.rs +++ b/transports/noise/src/lib.rs @@ -354,7 +354,7 @@ where fn upgrade_inbound(self, socket: T, info: Self::Info) -> Self::Future { Box::pin(self.config.upgrade_inbound(socket, info) .and_then(|(remote, io)| match remote { - RemoteIdentity::IdentityKey(pk) => future::ok((pk.into_peer_id(), io)), + RemoteIdentity::IdentityKey(pk) => future::ok((pk.to_peer_id(), io)), _ => future::err(NoiseError::AuthenticationFailed) })) } @@ -377,7 +377,7 @@ where fn upgrade_outbound(self, socket: T, info: Self::Info) -> Self::Future { Box::pin(self.config.upgrade_outbound(socket, info) .and_then(|(remote, io)| match remote { - RemoteIdentity::IdentityKey(pk) => future::ok((pk.into_peer_id(), io)), + RemoteIdentity::IdentityKey(pk) => future::ok((pk.to_peer_id(), io)), _ => future::err(NoiseError::AuthenticationFailed) })) } diff --git a/transports/plaintext/CHANGELOG.md b/transports/plaintext/CHANGELOG.md index 6ed0eb79442..88f9e8d4766 100644 --- a/transports/plaintext/CHANGELOG.md +++ b/transports/plaintext/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.30.0 [unreleased] + +- Update dependencies. + # 0.29.0 [2021-07-12] - Update dependencies. diff --git a/transports/plaintext/Cargo.toml b/transports/plaintext/Cargo.toml index 58ae9b02583..f9b206fb663 100644 --- a/transports/plaintext/Cargo.toml +++ b/transports/plaintext/Cargo.toml @@ -2,7 +2,7 @@ name = "libp2p-plaintext" edition = "2018" description = "Plaintext encryption dummy protocol for libp2p" -version = "0.29.0" +version = "0.30.0" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" @@ -13,7 +13,7 @@ categories = ["network-programming", "asynchronous"] bytes = "1" futures = "0.3.1" asynchronous-codec = "0.6" -libp2p-core = { version = "0.29.0", path = "../../core" } +libp2p-core = { version = "0.30.0", path = "../../core" } log = "0.4.8" prost = "0.8" unsigned-varint = { version = "0.7", features = ["asynchronous_codec"] } diff --git a/transports/plaintext/src/handshake.rs b/transports/plaintext/src/handshake.rs index a77c265a112..d981df4d964 100644 --- a/transports/plaintext/src/handshake.rs +++ b/transports/plaintext/src/handshake.rs @@ -53,8 +53,8 @@ pub struct Remote { impl HandshakeContext { fn new(config: PlainText2Config) -> Self { let exchange = Exchange { - id: Some(config.local_public_key.clone().into_peer_id().to_bytes()), - pubkey: Some(config.local_public_key.clone().into_protobuf_encoding()) + id: Some(config.local_public_key.to_peer_id().to_bytes()), + pubkey: Some(config.local_public_key.to_protobuf_encoding()) }; let mut buf = Vec::with_capacity(exchange.encoded_len()); exchange.encode(&mut buf).expect("Vec provides capacity as needed"); @@ -95,7 +95,7 @@ impl HandshakeContext { }; // Check the validity of the remote's `Exchange`. - if peer_id != public_key.clone().into_peer_id() { + if peer_id != public_key.to_peer_id() { debug!("the remote's `PeerId` isn't consistent with the remote's public key"); return Err(PlainTextError::InvalidPeerId) } diff --git a/transports/plaintext/tests/smoke.rs b/transports/plaintext/tests/smoke.rs index aedbda21239..20a79c32e1d 100644 --- a/transports/plaintext/tests/smoke.rs +++ b/transports/plaintext/tests/smoke.rs @@ -86,7 +86,7 @@ fn variable_msg_length() { let client_fut = async { debug!("dialing {:?}", server_address); let (received_server_id, mut client_channel) = client_transport.dial(server_address).unwrap().await.unwrap(); - assert_eq!(received_server_id, server_id.public().into_peer_id()); + assert_eq!(received_server_id, server_id.public().to_peer_id()); debug!("Client: writing message."); client_channel.write_all(&mut msg_to_send).await.expect("no error"); diff --git a/transports/quic/Cargo.toml b/transports/quic/Cargo.toml index b7a526d096f..397d3f63fe7 100644 --- a/transports/quic/Cargo.toml +++ b/transports/quic/Cargo.toml @@ -21,7 +21,7 @@ ed25519-dalek = "1.0.1" fnv = "1.0.7" futures = "0.3.15" if-watch = "0.2.2" -libp2p-core = { version = "0.29.0", path = "../../core" } +libp2p-core = { version = "0.30.0", path = "../../core" } multihash = { version = "0.14.0", default-features = false } parking_lot = "0.11.1" quinn-noise = { version = "0.3.0", optional = true } @@ -40,7 +40,7 @@ yasna = { version = "0.4.0", optional = true } [dev-dependencies] async-std = { version = "1.9.0", features = ["attributes"] } async-trait = "0.1.50" -libp2p = { version = "0.39.1", default-features = false, features = ["request-response"], path = "../.." } +libp2p = { version = "0.40.0", default-features = false, features = ["request-response"], path = "../.." } log-panics = "2.0.0" rand = "0.8.4" tracing-subscriber = "0.2.19" diff --git a/transports/quic/src/lib.rs b/transports/quic/src/lib.rs index 622e25ac2b6..086ec07dd15 100644 --- a/transports/quic/src/lib.rs +++ b/transports/quic/src/lib.rs @@ -102,7 +102,7 @@ pub trait ToLibp2p { fn to_keypair(&self) -> identity::Keypair; fn to_public(&self) -> identity::PublicKey; fn to_peer_id(&self) -> PeerId { - self.to_public().into_peer_id() + self.to_public().to_peer_id() } } diff --git a/transports/quic/src/tls/certificate.rs b/transports/quic/src/tls/certificate.rs index 38e02808998..df071cc8376 100644 --- a/transports/quic/src/tls/certificate.rs +++ b/transports/quic/src/tls/certificate.rs @@ -54,7 +54,7 @@ pub(crate) fn make_cert(keypair: &Keypair) -> Result) -> Result, E pub fn extract_peerid_or_panic(certificate: &[u8]) -> PeerId { let r = parse_certificate(certificate) .expect("we already checked that the certificate was valid during the handshake; qed"); - PeerId::from_public_key(r.1.peer_key) + PeerId::from_public_key(&r.1.peer_key) } diff --git a/transports/tcp/CHANGELOG.md b/transports/tcp/CHANGELOG.md index 6b01961caa3..6972aa2a513 100644 --- a/transports/tcp/CHANGELOG.md +++ b/transports/tcp/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.30.0 [unreleased] + +- Update dependencies. + # 0.29.0 [2021-07-12] - Update dependencies. diff --git a/transports/tcp/Cargo.toml b/transports/tcp/Cargo.toml index 96599bfdfc4..a4572cbcf70 100644 --- a/transports/tcp/Cargo.toml +++ b/transports/tcp/Cargo.toml @@ -2,7 +2,7 @@ name = "libp2p-tcp" edition = "2018" description = "TCP/IP transport protocol for libp2p" -version = "0.29.0" +version = "0.30.0" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" @@ -17,7 +17,7 @@ if-watch = { version = "0.2.0", optional = true } if-addrs = { version = "0.6.4", optional = true } ipnet = "2.0.0" libc = "0.2.80" -libp2p-core = { version = "0.29.0", path = "../../core" } +libp2p-core = { version = "0.30.0", path = "../../core" } log = "0.4.11" socket2 = { version = "0.4.0", features = ["all"] } tokio-crate = { package = "tokio", version = "1.0.1", default-features = false, features = ["net"], optional = true } diff --git a/transports/uds/CHANGELOG.md b/transports/uds/CHANGELOG.md index 60618cc1df2..ce66f13cd8f 100644 --- a/transports/uds/CHANGELOG.md +++ b/transports/uds/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.30.0 [unreleased] + +- Update dependencies. + # 0.29.0 [2021-07-12] - Update dependencies. diff --git a/transports/uds/Cargo.toml b/transports/uds/Cargo.toml index 22efbe2d1ca..1a079ab8ac8 100644 --- a/transports/uds/Cargo.toml +++ b/transports/uds/Cargo.toml @@ -2,7 +2,7 @@ name = "libp2p-uds" edition = "2018" description = "Unix domain sockets transport for libp2p" -version = "0.29.0" +version = "0.30.0" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" @@ -11,7 +11,7 @@ categories = ["network-programming", "asynchronous"] [target.'cfg(all(unix, not(target_os = "emscripten")))'.dependencies] async-std = { version = "1.6.2", optional = true } -libp2p-core = { version = "0.29.0", path = "../../core" } +libp2p-core = { version = "0.30.0", path = "../../core" } log = "0.4.1" futures = "0.3.1" tokio = { version = "1.0.1", default-features = false, features = ["net"], optional = true } diff --git a/transports/wasm-ext/CHANGELOG.md b/transports/wasm-ext/CHANGELOG.md index fc8f8e69d6d..a5047f28c94 100644 --- a/transports/wasm-ext/CHANGELOG.md +++ b/transports/wasm-ext/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.30.0 [unreleased] + +- Update dependencies. + # 0.29.0 [2021-07-12] - Update dependencies. diff --git a/transports/wasm-ext/Cargo.toml b/transports/wasm-ext/Cargo.toml index 8decb921731..bc34c37472f 100644 --- a/transports/wasm-ext/Cargo.toml +++ b/transports/wasm-ext/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "libp2p-wasm-ext" -version = "0.29.0" +version = "0.30.0" authors = ["Pierre Krieger "] edition = "2018" description = "Allows passing in an external transport in a WASM environment" @@ -12,7 +12,7 @@ categories = ["network-programming", "asynchronous"] [dependencies] futures = "0.3.1" js-sys = "0.3.50" -libp2p-core = { version = "0.29.0", path = "../../core" } +libp2p-core = { version = "0.30.0", path = "../../core" } parity-send-wrapper = "0.1.0" wasm-bindgen = "0.2.42" wasm-bindgen-futures = "0.4.4" diff --git a/transports/websocket/CHANGELOG.md b/transports/websocket/CHANGELOG.md index 81d98bfb77b..eddc2a8f2ac 100644 --- a/transports/websocket/CHANGELOG.md +++ b/transports/websocket/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.31.0 [unreleased] + +- Update dependencies. + # 0.30.0 [2021-07-12] - Update dependencies. diff --git a/transports/websocket/Cargo.toml b/transports/websocket/Cargo.toml index a7a378a5fdc..5fce54bc80a 100644 --- a/transports/websocket/Cargo.toml +++ b/transports/websocket/Cargo.toml @@ -2,7 +2,7 @@ name = "libp2p-websocket" edition = "2018" description = "WebSocket transport for libp2p" -version = "0.30.0" +version = "0.31.0" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" @@ -13,7 +13,7 @@ categories = ["network-programming", "asynchronous"] futures-rustls = "0.21" either = "1.5.3" futures = "0.3.1" -libp2p-core = { version = "0.29.0", path = "../../core" } +libp2p-core = { version = "0.30.0", path = "../../core" } log = "0.4.8" quicksink = "0.1" rw-stream-sink = "0.2.0"