paritytech / substrate-contracts-node

Minimal Substrate node configured for smart contracts via pallet-contracts.
The Unlicense
124 stars 145 forks source link

Installation fails with: could not find `derive_prelude` in `swarm` #163

Closed wottpal closed 1 year ago

wottpal commented 1 year ago

I tried installing the most recent substrate-contracts-node with

cargo install contracts-node --force --git https://github.com/paritytech/substrate-contracts-node.git   

…and it fails with the following error:

   Compiling sc-network v0.10.0-dev (https://github.com/paritytech/substrate?branch=polkadot-v0.9.32#5ea6d953)
error[E0433]: failed to resolve: could not find `derive_prelude` in `swarm`
  --> /Users/wottpal/.cargo/git/checkouts/substrate-7e08433d4c370a21/5ea6d95/client/network/src/behaviour.rs:58:10
   |
58 | #[derive(NetworkBehaviour)]
   |          ^^^^^^^^^^^^^^^^ could not find `derive_prelude` in `swarm`
   |
   = note: this error originates in the derive macro `NetworkBehaviour` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0432]: unresolved import `libp2p`
  --> /Users/wottpal/.cargo/git/checkouts/substrate-7e08433d4c370a21/5ea6d95/client/network/src/behaviour.rs:58:10
   |
58 | #[derive(NetworkBehaviour)]
   |          ^^^^^^^^^^^^^^^^ could not find `derive_prelude` in `swarm`
   |
   = note: this error originates in the derive macro `NetworkBehaviour` (in Nightly builds, run with -Z macro-backtrace for more info)

I brew-installed protobuf before, so it's not a duplicate of #161.

Before, I used v0.21.0 for WeightsV1, which installed successfully.

ganesh1997oli commented 1 year ago

Exactly, I'm also facing same issue

athei commented 1 year ago

I can reproduce. It is probably a dependency that violates semver. Add the --locked flag to the installation command line.

Marky-Shi commented 1 year ago

@athei When compiling the substrate node is also encountering the same problem

the command cargo build --locked -p file://RustCode/parachain/node#my-node@0.01-release

 Compiling sc-network v0.10.0-dev (https://github.com/paritytech/substrate?branch=polkadot-v0.9.32#5ea6d953)
 Compiling sc-informant v0.10.0-dev (https://github.com/paritytech/substrate?branch=polkadot-v0.9.32#5ea6d953)
error[E0433]: failed to resolve: could not find `derive_prelude` in `swarm`
  --> /root/.cargo/git/checkouts/substrate-7e08433d4c370a21/5ea6d95/client/network/src/behaviour.rs:58:10
   |
58 | #[derive(NetworkBehaviour)]
   |          ^^^^^^^^^^^^^^^^ could not find `derive_prelude` in `swarm`
   |
   = note: this error originates in the derive macro `NetworkBehaviour` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0432]: unresolved import `libp2p`
  --> /root/.cargo/git/checkouts/substrate-7e08433d4c370a21/5ea6d95/client/network/src/behaviour.rs:58:10
   |
58 | #[derive(NetworkBehaviour)]
   |          ^^^^^^^^^^^^^^^^ could not find `derive_prelude` in `swarm`
amrm121 commented 1 year ago

Got the same error, when compiling my Parachain node with the contracts pallet. Using the sc-network in v0.9.32.


error[E0433]: failed to resolve: could not find `derive_prelude` in `swarm`
  --> /home/amrm/.cargo/git/checkouts/substrate-7e08433d4c370a21/5ea6d95/client/network/src/behaviour.rs:58:10
   |
58 | #[derive(NetworkBehaviour)]
   |          ^^^^^^^^^^^^^^^^ could not find `derive_prelude` in `swarm`
   |
   = note: this error originates in the derive macro `NetworkBehaviour` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0432]: unresolved import `libp2p`
  --> /home/amrm/.cargo/git/checkouts/substrate-7e08433d4c370a21/5ea6d95/client/network/src/behaviour.rs:58:10
   |
58 | #[derive(NetworkBehaviour)]
   |          ^^^^^^^^^^^^^^^^ could not find `derive_prelude` in `swarm`
   |   = note: this error originates in the derive macro `NetworkBehaviour` (in Nightly builds, run with -Z macro-backtrace for more info)

Some errors have detailed explanations: E0432, E0433.
For more information about an error, try `rustc --explain E0432`.
error: could not compile `sc-network` due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
amrm121 commented 1 year ago

Hey, it was a bug in the libp2p. https://github.com/libp2p/rust-libp2p/pull/3178 Fixed by executing a cargo clean and deleting my cargo.lock. And after, just did a cargo build --release SE Discussion

wottpal commented 1 year ago

Can be closed I think.

ganesh1997oli commented 1 year ago

Can be closed I think.

yes now it works fine🙂

ganesh1997oli commented 1 year ago

Can be closed I think.

yes now it works fine🙂