Skip to content
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

SwarmBuilder can not use mplex and yamux together #4830

Closed
oblique opened this issue Nov 9, 2023 · 1 comment · Fixed by #4831
Closed

SwarmBuilder can not use mplex and yamux together #4830

oblique opened this issue Nov 9, 2023 · 1 comment · Fixed by #4831

Comments

@oblique
Copy link
Contributor

oblique commented Nov 9, 2023

Summary

With the new SwarmBuilder you can not use mplex and yamux together. The test cases wrongly have feature = "mplex" which is not defined in Cargo.toml, thus the test never gets enabled.

Expected behavior

The following code should compile:

        let _ = SwarmBuilder::with_new_identity()
            .with_tokio()
            .with_tcp(
                Default::default(),
                libp2p_tls::Config::new,
                (
                    libp2p_yamux::Config::default(),
                    libp2p_mplex::MplexConfig::default(),
                ),
            )
            .unwrap()
            .with_behaviour(|_| libp2p_swarm::dummy::Behaviour)
            .unwrap()
            .build();

Actual behavior

I'm getting this error:

error[E0277]: the trait bound `(libp2p_yamux::Config, MplexConfig): phase::IntoMultiplexerUpgrade<TlsStream<multistream_select::negotiated::Negotiated<libp2p_tcp::tokio::TcpStream>>>` is not satisfied
   --> libp2p/src/builder.rs:174:17
    |
171 |               .with_tcp(
    |                -------- required by a bound introduced by this call
...
174 | /                 (
175 | |                     libp2p_yamux::Config::default(),
176 | |                     libp2p_mplex::MplexConfig::default(),
177 | |                 ),
    | |_________________^ the trait `phase::IntoMultiplexerUpgrade<TlsStream<multistream_select::negotiated::Negotiated<libp2p_tcp::tokio::TcpStream>>>` is not implemented for `(libp2p_yamux::Config, MplexConfig)`
    |
    = help: the trait `phase::IntoMultiplexerUpgrade<C>` is implemented for `(U1, U2)`
note: required by a bound in `tcp::<impl builder::SwarmBuilder<Tokio, tcp::TcpPhase>>::with_tcp`
   --> libp2p/src/builder/phase/tcp.rs:72:29
    |
50  |             pub fn with_tcp<SecUpgrade, SecStream, SecError, MuxUpgrade, MuxStream, MuxError>(
    |                    -------- required by a bound in this associated function
...
72  |                 MuxUpgrade: IntoMultiplexerUpgrade<SecStream>,
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `tcp::<impl SwarmBuilder<Tokio, TcpPhase>>::with_tcp`
...
99  | impl_tcp_builder!("tokio", super::provider::Tokio, tokio);
    | --------------------------------------------------------- in this macro invocation
    = note: this error originates in the macro `impl_tcp_builder` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0277`.

Relevant log output

No response

Possible Solution

I got confused a bit with generics in that place, so I chouldn't fix it.

Version

0.53.0

Would you like to work on fixing this bug ?

No

@oblique
Copy link
Contributor Author

oblique commented Nov 9, 2023

Ok I found how to fix the issue (#4831).

@mergify mergify bot closed this as completed in #4831 Nov 9, 2023
mergify bot pushed a commit that referenced this issue Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant