15

I have a brand new macbook m2.

I followed all the steps on https://docs.substrate.io/install/macos

% rustup show
Default host: aarch64-apple-darwin
rustup home:  /Users/bear/.rustup

installed toolchains
--------------------

stable-aarch64-apple-darwin (default)
nightly-aarch64-apple-darwin

active toolchain
----------------

stable-aarch64-apple-darwin (default)
rustc 1.68.0 (2c8cc3432 2023-03-06)
% rustup +nightly show
Default host: aarch64-apple-darwin
rustup home:  /Users/bear/.rustup

installed toolchains
--------------------

stable-aarch64-apple-darwin (default)
nightly-aarch64-apple-darwin

installed targets for active toolchain
--------------------------------------

aarch64-apple-darwin
wasm32-unknown-unknown

active toolchain
----------------

nightly-aarch64-apple-darwin (overridden by +toolchain on the command line)
rustc 1.70.0-nightly (4a04d086c 2023-03-18)

While trying to run substrate, I run into:

% ./target/release/substrate --dev
2023-03-19 22:51:50 Substrate Node    
2023-03-19 22:51:50 ✌️  version 3.0.0-dev-f8a1dd4c836    
2023-03-19 22:51:50 ❤️  by Parity Technologies <[email protected]>, 2017-2023    
2023-03-19 22:51:50 📋 Chain specification: Development    
2023-03-19 22:51:50 🏷  Node name: dramatic-road-4106    
2023-03-19 22:51:50 👤 Role: AUTHORITY    
2023-03-19 22:51:50 💾 Database: RocksDb at /var/folders/0n/4nqy69197mdfz6tz2sbrpwcm0000gn/T/substrateYXoVQu/chains/dev/db/full    
2023-03-19 22:51:50 ⛓  Native runtime: node-268 (substrate-node-0.tx2.au10)    
Error: Service(Client(VersionInvalid("cannot deserialize module: UnknownOpcode(192)")))
2023-03-19 22:51:51 [0] 💸 generated 1 npos voters, 1 from validators and 0 nominators    
2023-03-19 22:51:51 [0] 💸 generated 1 npos targets    
2023-03-19 22:51:51 Cannot create a runtime error=Other("cannot deserialize module: UnknownOpcode(192)")

which is coming from client/executor/common/src/runtime_blob/runtime_blob.rs

The same happens with a few other repositories, namely:

  • substrate-node-template
  • frontier-node-template

but it does not happen with polkadot.

3
  • I tried everything explained here in the above comments but having same error. My machine configuration is: MacBook Pro 2.3 GHz Dual-Core Intel Core i5 macOS ventura 13.1 any other step?
    – Shapath
    Mar 30, 2023 at 18:56
  • Same issues here with rust version 1.68.2 on ubuntu 22.04 linux.
    – b0zero
    Apr 4, 2023 at 13:48
  • I also had issue on my new M1 MacBook Pro Ventura 13.3. Previously I had stable-1.68.2 and nightly-1.70. I had to fallback into nightly-1.68 Created rust-toolchain.toml with toml [toolchain] channel = "nightly-2023-01-01" components = [ "rustfmt" ] targets = [ "wasm32-unknown-unknown" ] profile = "minimal" Thanks to the community for help. Here is the error message I was getting: ```sh ./target/release/node-template --dev Error: Service(Client(VersionInvalid("cannot deserialize module: UnknownOpcode(192)"))) 2023-04-05 16:10:40 Substrate Node 2023-04-05 16:10:40 ✌️ version 4.0 Apr 5, 2023 at 11:06

5 Answers 5

12

solved by downgrading nightly from 1.70 to 1.68

interestingly, I couldn't really downgrade by simply calling rustup commands

I had to do rustup install nightly-2023-01-01 to make 1.68available, then I had to rename ~/.rustup/toolchains/nightly-2023-01-01-aarch64-apple-darwin to ~/.rustup/toolchains/nightly-aarch64-apple-darwin. This was the only way I could successfully downgrade nightly.

4
  • 1
    Use rustup default to set your default toolchain. I think your default toolchain is nightly. Mar 20, 2023 at 10:19
  • 2
    i use rustup override Mar 23, 2023 at 7:36
  • 3
    i followed the official substrate installation instructions i was able to solve the issue on substrate-node-template repo by running rustup override set nightly-2023-01-01 && rustup target add wasm32-unknown-unknown. view the override with rustup toolchain list. if you want to remove the override and revert back to defaults just run rustup override unset. Apr 16, 2023 at 23:11
  • 1
    that renaming was a ninja move, and worked for me Jun 8, 2023 at 10:45
8

I had the same error, and solved it by adding a rust-toolchain.toml file in my project root folder to override the toolchain. The content of rust-toolchain.toml is:

[toolchain]
channel = "nightly-2023-01-01"
components = [ "rustfmt" ]
targets = [ "wasm32-unknown-unknown" ]
profile = "minimal"
1
  • i upvoted this before trying it. but this didn't work for me. it just returned error error[E0786]: found invalid metadata files for crate sp_std and error: cannot determine resolution for the derive macro sp_std::hash::Hash Apr 16, 2023 at 23:22
3

There are a bunch of ways to override your nightly toolchain, see https://rust-lang.github.io/rustup/overrides.html for further information.

3

after downgrading to nightly 1.68, and you need to cargo build --package node-template --release again.

5
  • i tried this but doesn't work. i used latest substrate repo master commit 35049b176e49ca23240d1ee3ec6c190804e3b4d1, followed the official substrate installation instructions but when i ran cargo build --package node-template --release it gave error error: unknown --json option future-incompat` and error: could not compile ff (lib), then i downgraded to 1.68 nightly rustup override set nightly-2023-01-01 && rustup target add wasm32-unknown-unknown and ran cargo build --package node-template --release again but gave error found invalid metadata files for crate proc_macro2 Apr 17, 2023 at 1:42
  • 1
    if i use latest substrate repo master commit 35049b176e49ca23240d1ee3ec6c190804e3b4d1, follow official substrate install instructions and build with just cargo build --release it compiles successfully and i can run node without error. but if i use latest substrate-node-template repo master commit 700c3a186e55d0d6542c564ccff17260238ed752, follow official substrate installation instructions, then it gives error cannot deserialize module: UnknownOpcode(192) unless i run rustup override set nightly-2023-01-01 && rustup target add wasm32-unknown-unknown before running cargo build --release Apr 17, 2023 at 1:50
  • Luke i run this rustup override set nightly-2023-01-01 && rustup target add wasm32-unknown-unknown but it in rustup +nightly show i get: ... nightly-2023-01-01-x86_64-unknown-linux-gnu nightly-x86_64-unknown-linux-gnu 1.68-x86_64-unknown-linux-gnu 1.68.2-x86_64-unknown-linux-gnu (default) installed targets for active toolchain -------------------------------------- wasm32-unknown-unknown x86_64-unknown-linux-gnu active toolchain ---------------- nightly-x86_64-unknown-linux-gnu (overridden by +toolchain on the command line) rustc 1.72.0-nightly (e6d4725c7 2023-06-05) Jun 8, 2023 at 8:44
  • as it doesnt seem to be changing the night to 1.68, it still says 1.72... Jun 8, 2023 at 9:23
  • actually i followed Bernado's renaming procedure, and it now shows the correct version. Jun 8, 2023 at 10:42
3

The WASM_BUILD_TOOLCHAIN env variable should be able to override the nightly that is used for the WASM build. So if you set that to something older it should work.

2
  • 1
    i upvoted this before trying it, but after trying it with WASM_BUILD_TOOLCHAIN=nightly-2023-01-01 cargo build --release in the subtrate-node-template repo i found it doesn't work. it just gives the Rust WASM toolchain not installed, please install it! error, and even if you then follow its suggestion and install it with rustup target add wasm32-unknown-unknown and then build again it just shows the same error. Apr 16, 2023 at 23:04
  • Yea the recommendation is not really correct. AFAIK it should be rustup target add wasm32-unknown-unknown --toolchain nightly, or whatever exact nightly you are using. Apr 17, 2023 at 9:03

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.