4

I am trying to upgrade my parachain node from v1.12.0 to v1.13.0 using psvm but it does not compile successfully due to some mismatch conversion error of libp2p. I believe this PR must cause that issue but not sure how to fix it. https://github.com/paritytech/polkadot-sdk/pull/4198

error[E0277]: the trait bound `sc_network_types::PeerId: From<libp2p::PeerId>` is not satisfied
    --> /Users/chungquantin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sc-network-0.41.0/src/service.rs:1593:51
     |
1593 |                 self.peer_store_handle.add_known_peer(peer_id.into());
     |                                                               ^^^^ the trait `From<libp2p::PeerId>` is not implemented for `sc_network_types::PeerId`, which is required by `libp2p::PeerId: Into<_>`
     |
     = help: the following other types implement trait `From<T>`:
               <sc_network_types::PeerId as From<libp2p_identity::peer_id::PeerId>>
               <sc_network_types::PeerId as From<litep2p::peer_id::PeerId>>
               <sc_network_types::PeerId as From<&libp2p_identity::peer_id::PeerId>>
               <sc_network_types::PeerId as From<&litep2p::peer_id::PeerId>>
     = note: required for `libp2p::PeerId` to implement `Into<sc_network_types::PeerId>`

error[E0277]: the trait bound `sc_network_types::PeerId: From<libp2p::PeerId>` is not satisfied
    --> /Users/chungquantin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sc-network-0.41.0/src/service.rs:1596:51
     |
1596 |                 self.peer_store_handle.add_known_peer(peer_id.into());
     |                                                               ^^^^ the trait `From<libp2p::PeerId>` is not implemented for `sc_network_types::PeerId`, which is required by `libp2p::PeerId: Into<_>`
     |
     = help: the following other types implement trait `From<T>`:
               <sc_network_types::PeerId as From<libp2p_identity::peer_id::PeerId>>
               <sc_network_types::PeerId as From<litep2p::peer_id::PeerId>>
               <sc_network_types::PeerId as From<&libp2p_identity::peer_id::PeerId>>
               <sc_network_types::PeerId as From<&litep2p::peer_id::PeerId>>
     = note: required for `libp2p::PeerId` to implement `Into<sc_network_types::PeerId>`

For more information about this error, try `rustc --explain E0277`.
error: could not compile `sc-network` (lib) due to 106 previous errors

Dependency mismatch error with sc-network-type

After trying to update the crate using command cargo update --precise v0.12.0, I got the another error with RPC crate.

enter image description here

Use of undeclared crate or module alloc

  error[E0433]: failed to resolve: use of undeclared crate or module `alloc`
      --> /Users/chungquantin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/frame-benchmarking-35.0.0/src/v1.rs:1738:2
       |
  1738 | /     sp_runtime::format_runtime_string!(
  1739 | |         "\n* Pallet: {}\n\
  1740 | |         * Benchmark: {}\n\
  1741 | |         * Components: {:?}\n\
  ...    |
  1750 | |         error_message,
  1751 | |     )
       | |_____^ use of undeclared crate or module `alloc`

1 Answer 1

2

I encountered a similar problem when updating from 1.6 to 1.13. After analyzing the cargo.lock file and using the cargo tree command to help me, I isolated the problematic dependencies and resolved the issue by forcing specific versions instead of using the latest version using the --precise flag(^1) provided by cargo. E.g.

cargo update sc-network-types --precise 0.12.0
6
  • Thank you for fast response, after running the command, I ended up getting the another error: the trait From<RpcModule<_>> is implemented for Methods Is this something you got as well? (Updated the post with attachment)
    – Tin Chung
    Commented Jul 29 at 10:11
  • 1
    You probably have to align few other dependencies: - cargo update polkadot-node-core-pvf-common --precise 14.0.0 - cargo update mmr-rpc --precise 35.0.0 - cargo update sc-rpc-server --precise 16.0.1 - cargo update sc-network-types --precise 0.12.0 Commented Jul 29 at 11:58
  • 1
    Thank you Leonardo, it works perfectly now. You saved me 10 hours debugging.
    – Tin Chung
    Commented Jul 29 at 13:53
  • Hi Leonardo, another issue I got is "Use of undeclared crate or module alloc " which I already added more information above. Do you know how can I solve that error?
    – Tin Chung
    Commented Jul 29 at 17:36
  • 1
    I would suggest using Zepter (github.com/ggwpez/zepter) to verify that all the features are propagated correctly. Commented Jul 31 at 7:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.