Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,12 @@ env_logger = "0.11"
futures = "0.3.30"
futures-bounded = { version = "0.3", features = ["tokio"] }
futures-rustls = { version = "0.26.0", default-features = false }
getrandom = "0.2"
if-watch = "3.2.2"
futures-timer = { version = "3" }
getrandom = { version = "0.2", features = ["js"] }
hashlink = "0.11.0"
hickory-proto = { version = "0.25.2", default-features = false }
hickory-resolver = { version = "0.25.2", default-features = false }
if-watch = "3.2.2"
multiaddr = "0.18.1"
multihash = "0.19.1"
multistream-select = { version = "0.14.0", path = "misc/multistream-select" }
Expand All @@ -141,8 +143,8 @@ tokio = { version = "1.50", default-features = false }
tracing = "0.1.44"
tracing-subscriber = "0.3.23"
unsigned-varint = { version = "0.8.0" }
wasm-bindgen-futures = "0.4"
web-time = "1.1.0"
hashlink = "0.11.0"

[patch.crates-io]

Expand Down
4 changes: 2 additions & 2 deletions examples/browser-webrtc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ mime_guess = "2.0.4"

[target.'cfg(target_arch = "wasm32")'.dependencies]
js-sys = "0.3.69"
libp2p = { path = "../../libp2p", features = [ "ed25519", "macros", "ping", "wasm-bindgen"] }
libp2p = { path = "../../libp2p", features = [ "ed25519", "macros", "ping"] }
libp2p-webrtc-websys = { workspace = true }
tracing-wasm = "0.2.1"
wasm-bindgen = "0.2.90"
wasm-bindgen-futures = "0.4.42"
wasm-bindgen-futures = { workspace = true}
web-sys = { version = "0.3", features = ['Document', 'Element', 'HtmlElement', 'Node', 'Response', 'Window'] }

[lints]
Expand Down
4 changes: 2 additions & 2 deletions interop-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ tracing = { workspace = true }
tracing-subscriber = { workspace = true, features = ["env-filter"] }

[target.'cfg(target_arch = "wasm32")'.dependencies]
libp2p = { path = "../libp2p", features = [ "ping", "macros", "webtransport-websys", "wasm-bindgen", "identify", "websocket-websys", "yamux", "noise"] }
libp2p = { path = "../libp2p", features = [ "ping", "macros", "webtransport-websys", "identify", "websocket-websys", "yamux", "noise"] }
libp2p-mplex = { path = "../muxers/mplex" }
libp2p-webrtc-websys = { workspace = true }
wasm-bindgen = { version = "0.2" }
wasm-bindgen-futures = { version = "0.4" }
wasm-bindgen-futures = { workspace = true}
wasm-logger = { version = "0.2.0" }
web-time = { workspace = true }
reqwest = { version = "0.12", features = ["json"] }
Expand Down
2 changes: 2 additions & 0 deletions libp2p/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## 0.57.0

- Remove `wasm-bindgen` feature and make `wasm` support implicit.
See [PR 6102](https://github.com/libp2p/rust-libp2p/pull/6102)
- Raise MSRV to 1.88.0.
See [PR 6273](https://github.com/libp2p/rust-libp2p/pull/6273).
- Fix `metrics` delegation to gossipsub protocol.
Expand Down
8 changes: 4 additions & 4 deletions libp2p/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ full = [
"tls",
"tokio",
"uds",
"wasm-bindgen",
"webrtc-websys",
"websocket-websys",
"websocket",
Expand Down Expand Up @@ -81,7 +80,6 @@ tcp = ["dep:libp2p-tcp"]
tls = ["dep:libp2p-tls"]
tokio = ["libp2p-swarm/tokio", "libp2p-mdns?/tokio", "libp2p-tcp?/tokio", "libp2p-dns?/tokio", "libp2p-quic?/tokio", "libp2p-upnp?/tokio"]
uds = ["dep:libp2p-uds"]
wasm-bindgen = ["futures-timer/wasm-bindgen", "getrandom/js", "libp2p-swarm/wasm-bindgen", "libp2p-gossipsub?/wasm-bindgen"]
webrtc-websys = ['dep:libp2p-webrtc-websys']
websocket-websys = ["dep:libp2p-websocket-websys"]
websocket = ["dep:libp2p-websocket"]
Expand All @@ -93,8 +91,6 @@ upnp = ["dep:libp2p-upnp"]
bytes = "1"
either = "1.9.0"
futures = { workspace = true }
futures-timer = "3.0.2" # Explicit dependency to be used in `wasm-bindgen` feature
getrandom = { workspace = true } # Explicit dependency to be used in `wasm-bindgen` feature
# TODO feature flag?
rw-stream-sink = { workspace = true }
libp2p-allow-block-list = { workspace = true }
Expand Down Expand Up @@ -144,6 +140,10 @@ libp2p-mplex = { workspace = true }
libp2p-tcp = { workspace = true, features = ["tokio"] }
tracing-subscriber = { workspace = true, features = ["env-filter"] }

[target.'cfg(target_family="wasm")'.dependencies]
Comment thread
elenaf9 marked this conversation as resolved.
futures-timer = { workspace = true, features = ["wasm-bindgen"] }
getrandom = { workspace = true}

# 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]
Expand Down
4 changes: 2 additions & 2 deletions libp2p/src/builder/phase/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub enum NoProviderSpecified {}
/// Represents the Tokio runtime environment.
pub enum Tokio {}

#[cfg(feature = "wasm-bindgen")]
#[cfg(target_arch = "wasm32")]
/// Represents the WasmBindgen environment for WebAssembly.
pub enum WasmBindgen {}

Expand All @@ -37,7 +37,7 @@ impl SwarmBuilder<NoProviderSpecified, ProviderPhase> {

/// Configures the SwarmBuilder for WebAssembly using WasmBindgen.
/// This method is available when the `wasm-bindgen` feature is enabled.
#[cfg(feature = "wasm-bindgen")]
#[cfg(target_arch = "wasm32")]
pub fn with_wasm_bindgen(self) -> SwarmBuilder<WasmBindgen, TcpPhase> {
SwarmBuilder {
keypair: self.keypair,
Expand Down
8 changes: 3 additions & 5 deletions libp2p/src/builder/phase/swarm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ pub struct SwarmPhase<T, B> {
pub(crate) transport: T,
}

#[cfg(any(target_arch = "wasm32", feature = "tokio"))]
macro_rules! impl_with_swarm_config {
($providerKebabCase:literal, $providerPascalCase:ty, $config:expr) => {
#[cfg(feature = $providerKebabCase)]
($providerPascalCase:ty, $config:expr) => {
impl<T, B> SwarmBuilder<$providerPascalCase, SwarmPhase<T, B>> {
pub fn with_swarm_config(
self,
Expand Down Expand Up @@ -42,16 +42,14 @@ macro_rules! impl_with_swarm_config {
};
}

#[cfg(not(target_arch = "wasm32"))]
#[cfg(all(not(target_arch = "wasm32"), feature = "tokio"))]
impl_with_swarm_config!(
"tokio",
super::provider::Tokio,
libp2p_swarm::Config::with_tokio_executor()
);

#[cfg(target_arch = "wasm32")]
impl_with_swarm_config!(
"wasm-bindgen",
super::provider::WasmBindgen,
libp2p_swarm::Config::with_wasm_executor()
);
3 changes: 3 additions & 0 deletions protocols/gossipsub/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
- Refactor gossipsub with in-place negative-score peer removal.
See [PR 6209](https://github.com/libp2p/rust-libp2p/pull/6209).

- Remove `wasm-bindgen` feature and make `wasm` support implicit.
See [PR 6102](https://github.com/libp2p/rust-libp2p/pull/6102)

- Avoid direct casting from u128 to u64.
See [PR 6211](https://github.com/libp2p/rust-libp2p/pull/6211).

Expand Down
8 changes: 5 additions & 3 deletions protocols/gossipsub/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ keywords = ["peer-to-peer", "libp2p", "networking"]
categories = ["network-programming", "asynchronous"]

[features]
wasm-bindgen = ["getrandom/js", "futures-timer/wasm-bindgen"]
metrics = ["prometheus-client"]
partial_messages = []

Expand All @@ -24,8 +23,7 @@ bytes = "1.11"
either = "1.11"
fnv = "1.0.7"
futures = { workspace = true }
futures-timer = "3.0.2"
getrandom = { workspace = true }
futures-timer = { workspace = true}
hashlink = { workspace = true }
hex_fmt = "0.3.0"
web-time = { workspace = true }
Expand All @@ -50,6 +48,10 @@ quickcheck = { workspace = true }
tracing-subscriber = { workspace = true, features = ["env-filter"] }
tokio = { workspace = true, features = ["rt", "rt-multi-thread", "time", "macros"] }

[target.'cfg(target_family="wasm")'.dependencies]
futures-timer = { workspace = true, features = ["wasm-bindgen"] }
getrandom = { workspace = true }
Comment thread
elenaf9 marked this conversation as resolved.

# 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]
Expand Down
3 changes: 3 additions & 0 deletions swarm/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## 0.48.0

- Remove `wasm-bindgen` feature and make `wasm` support implicit.
See [PR 6102](https://github.com/libp2p/rust-libp2p/pull/6102)

- Raise MSRV to 1.88.0.
See [PR 6273](https://github.com/libp2p/rust-libp2p/pull/6273).

Expand Down
7 changes: 4 additions & 3 deletions swarm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ either = "1.11.0"
fnv = "1.0"
futures = { workspace = true }
futures-timer = "3.0.3"
getrandom = { workspace = true, features = ["js"], optional = true } # Explicit dependency to be used in `wasm-bindgen` feature
web-time = { workspace = true }
hashlink = { workspace = true }
libp2p-core = { workspace = true }
Expand All @@ -25,15 +24,17 @@ multistream-select = { workspace = true }
rand = "0.8"
smallvec = "1.15.1"
tracing = { workspace = true }
wasm-bindgen-futures = { version = "0.4.42", optional = true }

[target.'cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")))'.dependencies]
tokio = { workspace = true, features = ["rt"], optional = true }

[target.'cfg(target_family="wasm")'.dependencies]
getrandom = { workspace = true}
wasm-bindgen-futures = { workspace = true}

[features]
macros = ["dep:libp2p-swarm-derive"]
tokio = ["dep:tokio"]
wasm-bindgen = ["dep:wasm-bindgen-futures", "dep:getrandom"]

[dev-dependencies]
either = "1.11.0"
Expand Down
4 changes: 2 additions & 2 deletions swarm/src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ impl Executor for TokioExecutor {
}
}

#[cfg(feature = "wasm-bindgen")]
#[cfg(target_arch = "wasm32")]
#[derive(Default, Debug, Clone, Copy, Hash, PartialEq, Eq, PartialOrd, Ord)]
pub(crate) struct WasmBindgenExecutor;
#[cfg(feature = "wasm-bindgen")]
#[cfg(target_arch = "wasm32")]
impl Executor for WasmBindgenExecutor {
fn exec(&self, future: Pin<Box<dyn Future<Output = ()> + Send>>) {
wasm_bindgen_futures::spawn_local(future)
Expand Down
2 changes: 1 addition & 1 deletion swarm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1402,7 +1402,7 @@ impl Config {
/// task()
/// }
/// ```
#[cfg(feature = "wasm-bindgen")]
#[cfg(target_arch = "wasm32")]
pub fn with_wasm_executor() -> Self {
Self::with_executor(crate::executor::WasmBindgenExecutor)
}
Expand Down
3 changes: 3 additions & 0 deletions transports/webrtc-websys/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## 0.5.0

- Require `getrandom/js` feature only under `wasm` target.
See [PR 6102](https://github.com/libp2p/rust-libp2p/pull/6102)

- Raise MSRV to 1.88.0.
See [PR 6273](https://github.com/libp2p/rust-libp2p/pull/6273).

Expand Down
6 changes: 4 additions & 2 deletions transports/webrtc-websys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ publish = true
[dependencies]
bytes = "1"
futures = { workspace = true }
getrandom = { workspace = true, features = ["js"] }
hex = "0.4.3"
js-sys = { version = "0.3" }
libp2p-core = { workspace = true }
Expand All @@ -24,8 +23,11 @@ send_wrapper = { version = "0.6.0", features = ["futures"] }
thiserror = { workspace = true }
tracing = { workspace = true }
wasm-bindgen = { version = "0.2.90" }
wasm-bindgen-futures = { version = "0.4.42" }
wasm-bindgen-futures = { workspace = true}
web-sys = { version = "0.3.70", features = ["Document", "Location", "MessageEvent", "Navigator", "RtcCertificate", "RtcConfiguration", "RtcDataChannel", "RtcDataChannelEvent", "RtcDataChannelInit", "RtcDataChannelState", "RtcDataChannelType", "RtcPeerConnection", "RtcSdpType", "RtcSessionDescription", "RtcSessionDescriptionInit", "Window"] }

[target.'cfg(target_family="wasm")'.dependencies]
getrandom = { workspace = true}

[lints]
workspace = true
2 changes: 1 addition & 1 deletion wasm-tests/webtransport-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ libp2p-webtransport-websys = { workspace = true }
multiaddr = { workspace = true }
multihash = { workspace = true }
wasm-bindgen = "0.2.93"
wasm-bindgen-futures = "0.4.43"
wasm-bindgen-futures = { workspace = true}
wasm-bindgen-test = "0.3.43"
web-sys = { version = "0.3.70", features = ["Response", "Window"] }

Expand Down
Loading