Incompatibility of Concordium smart contracts with Rust 1.70 or newer

In the latest release of the Rust compiler, version 1.70, some code generation features are enabled that make it produce Wasm instructions that are not supported on the current version of the Concordium blockchain.

When building a contract with cargo concordium you might see an error

Error: Could not build smart contract.

Caused by:
    0: Could not build module schema.
    1: Could not generate module schema from Wasm module.
    2: Unsupported instruction 0xc0

There is no workaround other than to use an older version of the Rust toolchain which you can set by running

rustup default 1.69

We are working on supporting the new instruction set in a future protocol version of the Concordium blockchain.

Note that the same consideration applies to any nightly version that is more recent than 1.69.

4 Likes

After changing the Rust version, you will have to install the wasm32-unknown-unknown target so that you can compile to Wasm. You can do that by running:

rustup target add wasm32-unknown-unknown

1 Like

Any update on the topic? I am running into dependency issues because of this. Is there a workaround availabe now maybe?

Yes, since Sept 25 you can use Rust 1.70+ to build your contracts.

Just make sure to use cargo-concordium 3.0.0 or later.

That is excellent news. Saves me some hours. Thanks!

1 Like