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

transports/noise: fix compilation #2264

Merged
merged 1 commit into from
Oct 4, 2021
Merged

Conversation

Milerius
Copy link
Contributor

@Milerius Milerius commented Oct 4, 2021

For crate that depends on generic-array = { version = "0.14.3", features = ["serde", "more_lengths"] } It's seems that as_ref() is ambiguous.

more-lengths features seem to create this problem.

error[E0282]: type annotations needed
   --> /home/azureagent/.cargo/git/checkouts/rust-libp2p-98135dbcf5b63918/20183c1/transports/noise/src/protocol/x25519.rs:221:45
    |
221 |         curve25519_sk.copy_from_slice(&hash.as_ref()[..32]);
    |                                        -----^^^^^^--
    |                                        |    |
    |                                        |    cannot infer type for type parameter `T` declared on the trait `AsRef`
    |                                        this method call resolves to `&T`
    |
    = note: type must be known at this point

For crate that depends on `generic-array = { version = "0.14.3", features = ["serde", "more_lengths"] }` It's seems that `as_ref()` is ambiguous.
Copy link
Member

@mxinden mxinden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Milerius. Appreciate the patch.

In case you would need a backport of this change, please see #2231 (comment).

@mxinden mxinden merged commit c7abb6f into libp2p:master Oct 4, 2021
@Milerius
Copy link
Contributor Author

Milerius commented Oct 4, 2021

Thanks @Milerius. Appreciate the patch.

In case you would need a backport of this change, please see #2231 (comment).

It would be lovely. It seems that our project doesn't compile anymore if I use this last commit - a bit new into rust/cargo. Could you please tell me a bit more about how to achieve that?

Personally we use: 0.32.0

@mxinden
Copy link
Member

mxinden commented Oct 5, 2021

Personally we use: 0.32.0

Double checking here: You are referring to tag libp2p-noise-0.32.0 (libp2p-noise crate version v0.32.0 respectively), correct?

@Milerius
Copy link
Contributor Author

Milerius commented Oct 6, 2021

Personally we use: 0.32.0

Double checking here: You are referring to tag libp2p-noise-0.32.0 (libp2p-noise crate version v0.32.0 respectively), correct?

no sorry, I'm referring to this commit: 20183c1

But otherwise I would love to have some inputs on the upgrade regarding:

error[E0277]: the trait bound `GossipsubEvent: ProtocolsHandler` is not satisfied
  --> mm2src/gossipsub/src/behaviour.rs:49:13
   |
49 |     events: VecDeque<NetworkBehaviourAction<Arc<GossipsubRpc>, GossipsubEvent>>,
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `ProtocolsHandler` is not implemented for `GossipsubEvent`
   |
   = note: required because of the requirements on the impl of `IntoProtocolsHandler` for `GossipsubEvent`

I've read https://github.com/libp2p/rust-libp2p/pull/2191/files#r692527903 but since I'm new to libp2p and rust I've some struggling understanding the update path ^^' From what I understand NetworkBehaviourAction doesn't take an event as second parameter but an handler - a bit lost ^^'

mxinden pushed a commit to mxinden/rust-libp2p that referenced this pull request Oct 6, 2021
…res (libp2p#2264)

For crate that depends on `generic-array = { version = "0.14.3", features =
["serde", "more_lengths"] }` It's seems that `as_ref()` is ambiguous.
@mxinden
Copy link
Member

mxinden commented Oct 6, 2021

May I ask why you are not running on a released version of rust-libp2p but 20183c1 instead?

In regards to your compile time errors, you would need to adjust the trait parameters of NetworkBehaviourAction like done here:

type GossipsubNetworkBehaviourAction =
NetworkBehaviourAction<GossipsubEvent, GossipsubHandler, Arc<GossipsubHandlerIn>>;

@Milerius
Copy link
Contributor Author

Milerius commented Oct 6, 2021

May I ask why you are not running on a released version of rust-libp2p but 20183c1 instead?

In regards to your compile time errors, you would need to adjust the trait parameters of NetworkBehaviourAction like done here:

type GossipsubNetworkBehaviourAction =
NetworkBehaviourAction<GossipsubEvent, GossipsubHandler, Arc<GossipsubHandlerIn>>;

Thanks - then I will update directly to last libp2p -thanks for the input

@mxinden
Copy link
Member

mxinden commented Oct 6, 2021

@Milerius be aware of #2242 though. It will be fixed via #2248.

mxinden added a commit that referenced this pull request Oct 6, 2021
* transports/noise: Bump snow and rand

* transports/noise: Bump crate version

* transports/noise: Fix compilation with additional generic-array features (#2264)

For crate that depends on `generic-array = { version = "0.14.3", features =
["serde", "more_lengths"] }` It's seems that `as_ref()` is ambiguous.

* .github/workflows/ci.yml: Use clang 11 (#2233)

* transports/noise/CHANGELOG: Add entry

Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
Co-authored-by: Sztergbaum Roman <rmscastle@gmail.com>
mxinden added a commit that referenced this pull request Oct 6, 2021
* transports/noise: Bump snow and rand

* transports/noise: Bump crate version

* transports/noise: Fix compilation with additional generic-array features (#2264)

For crate that depends on `generic-array = { version = "0.14.3", features =
["serde", "more_lengths"] }` It's seems that `as_ref()` is ambiguous.

* .github/workflows/ci.yml: Use clang 11 (#2233)

* transports/noise/CHANGELOG: Add entry

Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
Co-authored-by: Sztergbaum Roman <rmscastle@gmail.com>
nguquen pushed a commit to nguquen/rust-libp2p that referenced this pull request Oct 28, 2021
…res (libp2p#2264)

For crate that depends on `generic-array = { version = "0.14.3", features =
["serde", "more_lengths"] }` It's seems that `as_ref()` is ambiguous.
tzemanovic added a commit to heliaxdev/rust-libp2p that referenced this pull request Feb 22, 2022
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 this pull request may close these issues.

None yet

2 participants