-
Notifications
You must be signed in to change notification settings - Fork 957
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
deps(webrtc): don't include webrtc
by default if tokio
is enabled
#4962
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good!
We can't really trust CI that much for backports because all sorts of stuff breaks with old Rust versions. Before we make the release, can you confirm that this PR works as intended with polkadot?
transports/webrtc/Cargo.toml
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll need to bump the version of this crate to 0.4.0-alpha.5
.
It seems that we break the MSRV with this update: https://github.com/libp2p/rust-libp2p/actions/runs/7037238673/job/19151620939?pr=4962. We don't normally break MSRV in patch versions but I think we might have to if we want to ship this. @mxinden What do you think? I think it is not that bad too be honest. If somebody wants to stay on a lower MSRV, the can just not upgrade to the new patch release. |
We don't support WebRTC right now in Polkadot but We're planning on bringing WebRTC support after the 0.52 upgrade has been merged |
That seems like a bug! Are you using |
I thought this was intentional and I tried working around with it but no luck. It's very easy to reproduce though, just creating a new project like this (no code): [package]
name = "libp2p-webrtc-test"
version = "0.1.0"
edition = "2021"
[dependencies]
libp2p = { version = "0.51.3", features = ["tokio"], default-features = false } Shows all kinds of webrtc-related dependencies in |
I think you are running into the following
Can you elaborate on how exactly this affects you? We don't depend on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am somewhat hesitant to make a breaking change (MSRV) in a patch release if the actual motivation for this is just working around a cargo bug :(
I'll withdraw my approval for now and I'd like to understand better, what is actually going on here.
We're using an ancient version of schnorrkel ( [package]
name = "libp2p-webrtc-test"
version = "0.1.0"
edition = "2021"
[dependencies]
libp2p = { version = "0.51.3", features = ["tokio"], default-features = false }
schnorrkel = { version = "0.11.3", features = ["preaudit_deprecated"], default-features = false } I get the following error:
Updating |
Damn that is annoying. I think there might be a simpler fix though that is not a breaking change: We can remove the forwarding of the Doing that should remove the entire |
Like this? diff --git a/libp2p/Cargo.toml b/libp2p/Cargo.toml
index f979366b..d36a4621 100644
--- a/libp2p/Cargo.toml
+++ b/libp2p/Cargo.toml
@@ -80,12 +80,12 @@ secp256k1 = ["libp2p-identity/secp256k1"]
serde = ["libp2p-core/serde", "libp2p-kad?/serde", "libp2p-gossipsub?/serde"]
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-webrtc?/tokio"]
+tokio = ["libp2p-swarm/tokio", "libp2p-mdns?/tokio", "libp2p-tcp?/tokio", "libp2p-dns?/tokio", "libp2p-quic?/tokio"]
uds = ["dep:libp2p-uds"]
wasm-bindgen = ["futures-timer/wasm-bindgen", "instant/wasm-bindgen", "getrandom/js", "libp2p-swarm/wasm-bindgen"]
wasm-ext = ["dep:libp2p-wasm-ext"]
wasm-ext-websocket = ["wasm-ext", "libp2p-wasm-ext?/websocket"]
-webrtc = ["dep:libp2p-webrtc", "libp2p-webrtc?/pem"]
+webrtc = ["dep:libp2p-webrtc", "libp2p-webrtc?/pem", "libp2p-webrtc/tokio"]
websocket = ["dep:libp2p-websocket"]
yamux = ["dep:libp2p-yamux"] |
I think so yes. Can you update this PR to that and then try if you can update schnorrkel once you |
webrtc
by default if tokio
is enabled
Yeah this works as well. |
Fine by me. Though seems like you found a much better solution. Feel free to go ahead here. Thanks @thomaseizinger and @altonen. |
Can you confirm that this PR solves your problem? |
Yes I confirmed it, this works for us. |
Awesome! Great to hear that we've found a solution. Can you bump the patch version of I don't think this is worth / possible to forward-port to master because |
This works around a bug in cargo which unconditionally pulls the dependencies even if the `webrtc` feature is not enabled and causes issues in downstream with other conflicting dependencies.
Friendly ping |
👍 |
Damn, merged too quickly here. We forgot to actually bump the version. |
This is now released: https://github.com/libp2p/rust-libp2p/releases/tag/libp2p-v0.51.4 |
Thanks Thomas and Max, really appreciate you accepting this patch. And sorry about forgetting to bump the version. |
Description
Notes & open questions
Don't enable
webrtc
by default iftokio
is enabled. Bug in cargo causes webrtc-related dependencies to be pulled even ifwebrtc
is not enabled and causes issues downstream with incompatible dependencies.Change checklist