8

Using this guide to integrate try-runtime on my node i get the error about get random not building for wasm.

  error: the wasm32-unknown-unknown target is not supported by default, you may need to enable the "js" feature. For more information see: https://docs.rs/getrandom/#webassembly-support
     --> /home/simson/.cargo/registry/src/github.com-1ecc6299db9ec823/getrandom-0.2.3/src/lib.rs:219:9
      |
  219 | /         compile_error!("the wasm32-unknown-unknown target is not supported by \
  220 | |                         default, you may need to enable the \"js\" feature. \
  221 | |                         For more information see: \
  222 | |                         https://docs.rs/getrandom/#webassembly-support");
      | |________________________________________________________________________^

  error[E0433]: failed to resolve: use of undeclared crate or module `imp`
     --> /home/simson/.cargo/registry/src/github.com-1ecc6299db9ec823/getrandom-0.2.3/src/lib.rs:246:5
      |
  246 |     imp::getrandom_inner(dest)
      |     ^^^ use of undeclared crate or module `imp`

I get this error when I enable frame-try-runtime on the second line below (In [features] section of runtime/Cargo.toml)

try-runtime = [
    "frame-executive/try-runtime",
    "frame-try-runtime",
    "frame-system/try-runtime",
]

I suspect the root cause of this is not related to wasm but rather that some dependency is leaking std code into the wasm build. What kind of miss-configuration should I be looking for to find this problem?

2
  • Did you make sure to make try-runtime optional and enable it with std? Can you share a diff of the changes you made to your node leading to this error?
    – Shawn Tabrizi
    Commented Feb 9, 2022 at 7:41
  • I will try to boil it down to a minimal reproducible error, hold on
    – Simson
    Commented Feb 10, 2022 at 0:58

1 Answer 1

3

It looks like the latest Rust nightly has broken our Wasm builds.

There have been other reports of this issue here:

https://github.com/paritytech/substrate/issues/10767

And the fix is coming in here:

https://github.com/paritytech/substrate/pull/10837

1
  • No it can't be the tool chain, I can build the same sha withou the changes but this: looks like the problem sudipghimire533 commented 10 days ago Usually this is due to missing some entry features section like [features] std = [ 'sp-std/std', # if some crate entry is missing here ] Or you might be missing default-features = false in some toml file Straight-forward way to resolve this would be compare the commit where everything was fine and carefully analyse the changes in all Cargo.toml file keeping in mind above-mentioned 2 things.
    – Simson
    Commented Feb 11, 2022 at 1:15

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.