diff --git a/Cargo.lock b/Cargo.lock index 029008a99e1..b85d0955c77 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2498,7 +2498,7 @@ checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a" [[package]] name = "libp2p" -version = "0.52.1" +version = "0.52.2" dependencies = [ "async-std", "async-trait", @@ -2858,7 +2858,7 @@ dependencies = [ [[package]] name = "libp2p-metrics" -version = "0.13.0" +version = "0.13.1" dependencies = [ "instant", "libp2p-core", diff --git a/Cargo.toml b/Cargo.toml index eff66e42986..2ba9639e383 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -75,7 +75,7 @@ libp2p-identify = { version = "0.43.0", path = "protocols/identify" } libp2p-identity = { version = "0.2.1" } libp2p-kad = { version = "0.44.2", path = "protocols/kad" } libp2p-mdns = { version = "0.44.0", path = "protocols/mdns" } -libp2p-metrics = { version = "0.13.0", path = "misc/metrics" } +libp2p-metrics = { version = "0.13.1", path = "misc/metrics" } libp2p-mplex = { version = "0.40.0", path = "muxers/mplex" } libp2p-muxer-test-harness = { path = "muxers/test-harness" } libp2p-noise = { version = "0.43.0", path = "transports/noise" } diff --git a/libp2p/CHANGELOG.md b/libp2p/CHANGELOG.md index fa299284667..9b41d2d570a 100644 --- a/libp2p/CHANGELOG.md +++ b/libp2p/CHANGELOG.md @@ -1,3 +1,10 @@ +## 0.52.2 - unreleased + +- Include gossipsub when compiling for wasm. + See [PR 4217]. + +[PR 4217]: https://github.com/libp2p/rust-libp2p/pull/4217 + ## 0.52.1 - Add `libp2p-webtransport-websys` providing WebTransport for WASM environments. diff --git a/libp2p/Cargo.toml b/libp2p/Cargo.toml index 06f269466ea..280c2d58e05 100644 --- a/libp2p/Cargo.toml +++ b/libp2p/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p" edition = "2021" rust-version = "1.65.0" description = "Peer-to-peer networking library" -version = "0.52.1" +version = "0.52.2" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/libp2p/src/lib.rs b/libp2p/src/lib.rs index 059857d3b8a..d22e4c25d30 100644 --- a/libp2p/src/lib.rs +++ b/libp2p/src/lib.rs @@ -65,7 +65,6 @@ pub use libp2p_dns as dns; #[doc(inline)] pub use libp2p_floodsub as floodsub; #[cfg(feature = "gossipsub")] -#[cfg(not(target_os = "unknown"))] #[doc(inline)] pub use libp2p_gossipsub as gossipsub; #[cfg(feature = "identify")] diff --git a/misc/metrics/CHANGELOG.md b/misc/metrics/CHANGELOG.md index f1f6c343caa..cca9ced5ec7 100644 --- a/misc/metrics/CHANGELOG.md +++ b/misc/metrics/CHANGELOG.md @@ -1,3 +1,10 @@ +## 0.13.1 - unreleased + +- Enable gossipsub related data-type fields when compiling for wasm. + See [PR 4217]. + +[PR 4217]: https://github.com/libp2p/rust-libp2p/pull/4217 + ## 0.13.0 - Previously `libp2p-metrics::identify` would increase a counter / gauge / histogram on each diff --git a/misc/metrics/Cargo.toml b/misc/metrics/Cargo.toml index 90e46cf4fe4..e93d1f663ed 100644 --- a/misc/metrics/Cargo.toml +++ b/misc/metrics/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-metrics" edition = "2021" rust-version = "1.65.0" description = "Metrics for libp2p" -version = "0.13.0" +version = "0.13.1" authors = ["Max Inden "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" @@ -11,32 +11,30 @@ keywords = ["peer-to-peer", "libp2p", "networking"] categories = ["network-programming", "asynchronous"] [features] +dcutr = ["libp2p-dcutr"] gossipsub = ["libp2p-gossipsub"] identify = ["libp2p-identify"] kad = ["libp2p-kad"] ping = ["libp2p-ping"] relay = ["libp2p-relay"] -dcutr = ["libp2p-dcutr"] [dependencies] instant = "0.1.12" libp2p-core = { workspace = true } libp2p-dcutr = { workspace = true, optional = true } +libp2p-gossipsub = { workspace = true, optional = true } libp2p-identify = { workspace = true, optional = true } +libp2p-identity = { workspace = true } libp2p-kad = { workspace = true, optional = true } libp2p-ping = { workspace = true, optional = true } libp2p-relay = { workspace = true, optional = true } libp2p-swarm = { workspace = true } -libp2p-identity = { workspace = true } -prometheus-client = { version = "0.21.2"} once_cell = "1.18.0" - -[target.'cfg(not(target_os = "unknown"))'.dependencies] -libp2p-gossipsub = { workspace = true, optional = true } +prometheus-client = { version = "0.21.2"} # Passing arguments to the docsrs builder in order to properly document cfg's. # More information: https://docs.rs/about/builds#cross-compiling [package.metadata.docs.rs] all-features = true -rustdoc-args = ["--cfg", "docsrs"] rustc-args = ["--cfg", "docsrs"] +rustdoc-args = ["--cfg", "docsrs"] diff --git a/misc/metrics/src/identify.rs b/misc/metrics/src/identify.rs index 0e2527c09df..4e320e7b0a0 100644 --- a/misc/metrics/src/identify.rs +++ b/misc/metrics/src/identify.rs @@ -64,7 +64,6 @@ const ALLOWED_PROTOCOLS: &[StreamProtocol] = &[ #[cfg(feature = "dcutr")] libp2p_dcutr::PROTOCOL_NAME, // #[cfg(feature = "gossipsub")] - // #[cfg(not(target_os = "unknown"))] // TODO: Add Gossipsub protocol name libp2p_identify::PROTOCOL_NAME, libp2p_identify::PUSH_PROTOCOL_NAME, diff --git a/misc/metrics/src/lib.rs b/misc/metrics/src/lib.rs index ec166eebecc..fd977537d96 100644 --- a/misc/metrics/src/lib.rs +++ b/misc/metrics/src/lib.rs @@ -30,7 +30,6 @@ #[cfg(feature = "dcutr")] mod dcutr; #[cfg(feature = "gossipsub")] -#[cfg(not(target_os = "unknown"))] mod gossipsub; #[cfg(feature = "identify")] mod identify; @@ -50,7 +49,6 @@ pub struct Metrics { #[cfg(feature = "dcutr")] dcutr: dcutr::Metrics, #[cfg(feature = "gossipsub")] - #[cfg(not(target_os = "unknown"))] gossipsub: gossipsub::Metrics, #[cfg(feature = "identify")] identify: identify::Metrics, @@ -78,7 +76,6 @@ impl Metrics { #[cfg(feature = "dcutr")] dcutr: dcutr::Metrics::new(sub_registry), #[cfg(feature = "gossipsub")] - #[cfg(not(target_os = "unknown"))] gossipsub: gossipsub::Metrics::new(sub_registry), #[cfg(feature = "identify")] identify: identify::Metrics::new(sub_registry), @@ -107,7 +104,6 @@ impl Recorder for Metrics { } #[cfg(feature = "gossipsub")] -#[cfg(not(target_os = "unknown"))] impl Recorder for Metrics { fn record(&self, event: &libp2p_gossipsub::Event) { self.gossipsub.record(event)