diff --git a/Cargo.lock b/Cargo.lock index c13e8367..a4113e63 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2630,7 +2630,7 @@ dependencies = [ [[package]] name = "libp2p-identity" -version = "0.2.5" +version = "0.2.6" dependencies = [ "asn1_der", "base64 0.21.4", @@ -2884,7 +2884,7 @@ dependencies = [ [[package]] name = "libp2p-pnet" -version = "0.23.0" +version = "0.23.1" dependencies = [ "futures", "libp2p-core", @@ -3229,7 +3229,7 @@ dependencies = [ [[package]] name = "libp2p-webrtc-websys" -version = "0.1.0-alpha" +version = "0.2.0-alpha" dependencies = [ "bytes", "futures", diff --git a/Cargo.toml b/Cargo.toml index 3f2de6c2..8d57d1dd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -83,7 +83,7 @@ libp2p-dns = { version = "0.40.1", path = "transports/dns" } libp2p-floodsub = { version = "0.43.0", path = "protocols/floodsub" } libp2p-gossipsub = { version = "0.45.2", path = "protocols/gossipsub" } libp2p-identify = { version = "0.43.1", path = "protocols/identify" } -libp2p-identity = { version = "0.2.5" } +libp2p-identity = { version = "0.2.6" } libp2p-kad = { version = "0.44.6", path = "protocols/kad" } libp2p-mdns = { version = "0.44.0", path = "protocols/mdns" } libp2p-memory-connection-limits = { version = "0.1.0", path = "misc/memory-connection-limits" } @@ -94,7 +94,7 @@ libp2p-noise = { version = "0.43.2", path = "transports/noise" } libp2p-perf = { version = "0.2.0", path = "protocols/perf" } libp2p-ping = { version = "0.43.1", path = "protocols/ping" } libp2p-plaintext = { version = "0.40.1", path = "transports/plaintext" } -libp2p-pnet = { version = "0.23.0", path = "transports/pnet" } +libp2p-pnet = { version = "0.23.1", path = "transports/pnet" } libp2p-quic = { version = "0.9.3", path = "transports/quic" } libp2p-relay = { version = "0.16.2", path = "protocols/relay" } libp2p-rendezvous = { version = "0.13.1", path = "protocols/rendezvous" } @@ -110,7 +110,7 @@ libp2p-uds = { version = "0.39.0", path = "transports/uds" } libp2p-wasm-ext = { version = "0.40.0", path = "transports/wasm-ext" } libp2p-webrtc = { version = "0.6.1-alpha", path = "transports/webrtc" } libp2p-webrtc-utils = { version = "0.1.0", path = "misc/webrtc-utils" } -libp2p-webrtc-websys = { version = "0.1.0-alpha", path = "transports/webrtc-websys" } +libp2p-webrtc-websys = { version = "0.2.0-alpha", path = "transports/webrtc-websys" } libp2p-websocket = { version = "0.42.1", path = "transports/websocket" } libp2p-websocket-websys = { version = "0.2.0", path = "transports/websocket-websys" } libp2p-webtransport-websys = { version = "0.1.0", path = "transports/webtransport-websys" } diff --git a/clippy.toml b/clippy.toml index f66cc0ac..fd38ead0 100644 --- a/clippy.toml +++ b/clippy.toml @@ -1,3 +1,4 @@ disallowed-methods = [ { path = "futures::channel::mpsc::unbounded", reason = "does not enforce backpressure" }, ] +avoid-breaking-exported-api = false diff --git a/identity/CHANGELOG.md b/identity/CHANGELOG.md index 27873e88..3e4cf727 100644 --- a/identity/CHANGELOG.md +++ b/identity/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.2.6 + +- Make `PeerId::to_bytes` and `PeerId::to_base58` take `self` by value to follow Rust convention of `Copy` types. + See [PR 4653](https://github.com/libp2p/rust-libp2p/pull/4653). + ## 0.2.5 - Fix usage of HKDF within `Keypair::derive_secret`. diff --git a/identity/Cargo.toml b/identity/Cargo.toml index 69f8bf55..1502b093 100644 --- a/identity/Cargo.toml +++ b/identity/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "libp2p-identity" -version = "0.2.5" +version = "0.2.6" edition = "2021" description = "Data structures and algorithms for identifying peers in libp2p." rust-version = { workspace = true } diff --git a/identity/src/lib.rs b/identity/src/lib.rs index 9a6c4237..c78e68d1 100644 --- a/identity/src/lib.rs +++ b/identity/src/lib.rs @@ -114,8 +114,9 @@ pub use keypair::{Keypair, PublicKey}; #[cfg(feature = "peerid")] pub use peer_id::{ParseError, PeerId}; -#[derive(Debug, PartialEq, Eq)] /// The type of key a `KeyPair` is holding. +#[derive(Debug, PartialEq, Eq)] +#[allow(clippy::upper_case_acronyms)] pub enum KeyType { Ed25519, RSA, diff --git a/identity/src/peer_id.rs b/identity/src/peer_id.rs index 60ded4ad..83879969 100644 --- a/identity/src/peer_id.rs +++ b/identity/src/peer_id.rs @@ -109,12 +109,12 @@ impl PeerId { } /// Returns a raw bytes representation of this `PeerId`. - pub fn to_bytes(&self) -> Vec { + pub fn to_bytes(self) -> Vec { self.multihash.to_bytes() } /// Returns a base-58 encoded string of this `PeerId`. - pub fn to_base58(&self) -> String { + pub fn to_base58(self) -> String { bs58::encode(self.to_bytes()).into_string() } } diff --git a/protocols/gossipsub/CHANGELOG.md b/protocols/gossipsub/CHANGELOG.md index 51836ec9..4532c6e7 100644 --- a/protocols/gossipsub/CHANGELOG.md +++ b/protocols/gossipsub/CHANGELOG.md @@ -3,6 +3,12 @@ - Deprecate `gossipsub::Config::idle_timeout` in favor of `SwarmBuilder::idle_connection_timeout`. See [PR 4648]. + + [PR 4648]: (https://github.com/libp2p/rust-libp2p/pull/4648) + ## 0.23.0 - Raise MSRV to 1.65. diff --git a/transports/pnet/Cargo.toml b/transports/pnet/Cargo.toml index c6dd93f6..936e3da9 100644 --- a/transports/pnet/Cargo.toml +++ b/transports/pnet/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-pnet" edition = "2021" rust-version = { workspace = true } description = "Private swarm support for libp2p" -version = "0.23.0" +version = "0.23.1" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/transports/pnet/src/lib.rs b/transports/pnet/src/lib.rs index 15f42556..d8aac22e 100644 --- a/transports/pnet/src/lib.rs +++ b/transports/pnet/src/lib.rs @@ -159,6 +159,7 @@ impl fmt::Display for Fingerprint { /// Error when parsing a PreSharedKey #[derive(Clone, Debug, PartialEq, Eq)] +#[allow(clippy::enum_variant_names)] // Maybe fix at some stage, not important now. pub enum KeyParseError { /// file does not have the expected structure InvalidKeyFile, diff --git a/transports/webrtc-websys/CHANGELOG.md b/transports/webrtc-websys/CHANGELOG.md index 7c40c08f..7887d30a 100644 --- a/transports/webrtc-websys/CHANGELOG.md +++ b/transports/webrtc-websys/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.2.0-alpha - unreleased + +- Rename `Error::JsError` to `Error::Js`. + See [PR 4653](https://github.com/libp2p/rust-libp2p/pull/4653) + ## 0.1.0-alpha - Initial alpha release. diff --git a/transports/webrtc-websys/Cargo.toml b/transports/webrtc-websys/Cargo.toml index cb90573b..847e54ab 100644 --- a/transports/webrtc-websys/Cargo.toml +++ b/transports/webrtc-websys/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT" name = "libp2p-webrtc-websys" repository = "https://github.com/libp2p/rust-libp2p" rust-version = { workspace = true } -version = "0.1.0-alpha" +version = "0.2.0-alpha" publish = true [dependencies] diff --git a/transports/webrtc-websys/src/connection.rs b/transports/webrtc-websys/src/connection.rs index dfdebbc9..b026aec0 100644 --- a/transports/webrtc-websys/src/connection.rs +++ b/transports/webrtc-websys/src/connection.rs @@ -252,11 +252,11 @@ impl RtcPeerConnection { let sdp = &self .inner .local_description() - .ok_or_else(|| Error::JsError("No local description".to_string()))? + .ok_or_else(|| Error::Js("No local description".to_string()))? .sdp(); - let fingerprint = parse_fingerprint(sdp) - .ok_or_else(|| Error::JsError("No fingerprint in SDP".to_string()))?; + let fingerprint = + parse_fingerprint(sdp).ok_or_else(|| Error::Js("No fingerprint in SDP".to_string()))?; Ok(fingerprint) } diff --git a/transports/webrtc-websys/src/error.rs b/transports/webrtc-websys/src/error.rs index e226dea8..c95b1caf 100644 --- a/transports/webrtc-websys/src/error.rs +++ b/transports/webrtc-websys/src/error.rs @@ -8,7 +8,7 @@ pub enum Error { InvalidMultiaddr(&'static str), #[error("JavaScript error: {0}")] - JsError(String), + Js(String), #[error("JavaScript typecasting failed")] JsCastFailed, @@ -34,7 +34,7 @@ impl Error { "Unknown error".to_string() }; - Error::JsError(s) + Error::Js(s) } } @@ -46,12 +46,12 @@ impl std::convert::From for Error { impl From for Error { fn from(value: String) -> Self { - Error::JsError(value) + Error::Js(value) } } impl From for Error { fn from(value: std::io::Error) -> Self { - Error::JsError(value.to_string()) + Error::Js(value.to_string()) } }