4

I having some trouble running the Flipper example from the Ink! webpage.

The cargo contract build outputs the following error log:

ERROR: Loading of original wasm failed

Caused by:
    0: Loading of wasm module at '/Users/winston/workspace/cs/repos/flipper/target/ink/wasm32-unknown-unknown/release/flipper.wasm' failed
    1: Unknown opcode 192

rustup show output:

Default host: aarch64-apple-darwin
rustup home:  /Users/winston/.rustup

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

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

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

aarch64-apple-darwin
wasm32-unknown-unknown
wasm32-wasi

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

nightly-aarch64-apple-darwin (default)
rustc 1.70.0-nightly (17c116721 2023-03-29)

As you can see, I am running on the M1 OSX system.

1
  • 1
    Please, remember to mark this question as solved :) Mar 30 at 17:02

2 Answers 2

6

Solved! This was caused by the nightly toolchain. Switching to the stable toolchain solved this issue.

Edit: As pointed out by Shunsuke, this is specific to the 1.70.0 nightly build. 1.68.0 version seems to work.

2
  • 1
    Lots of contracts including OpenBrush PSP22, PSP34 contracts using nightly features such as #![feature(min_specialization)]. This means existing contracts cannot be compiled with nightly toolchain whose rustc version is higher than 1.70.0 (Confirmed 1.68.0 works). cargo contract is now independent from nightly toolchain but it should still support nightly for compatibility.
    – Shunsuke
    Mar 31 at 7:41
  • 2
3

For cases where updated nightly is still preferred for whatever reason:

rustup update
rustup install nightly-2023-02-07-aarch64-apple-darwin
rustup component add rust-src --toolchain nightly-2023-02-07-aarch64-apple-darwin

...specify nightly version in tag

cargo +nightly-2023-02-07 contract build

Still running updated nightly rustc 1.70.0 as default: image

Your Answer

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

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