Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Unsupported Wasm Opcode after updating nightly toolchain #13636

Closed
@atenjin

Description

@atenjin

Is there an existing issue?

  • I have searched the existing issues

Experiencing problems? Have you tried our Stack Exchange first?

  • This is not a support question.

Description of bug

After I update the nightly toolchain for the newest version:

   stable-x86_64-unknown-linux-gnu updated - rustc 1.68.0 (2c8cc3432 2023-03-06) (from rustc 1.66.1 (90743e729 2023-01-10))
  nightly-x86_64-unknown-linux-gnu updated - rustc 1.70.0-nightly (4a04d086c 2023-03-18) (from rustc 1.68.0-nightly (9e75dddf6 2023-01-15))

maybe the problem appears in 1.70.0, for at least 1.68.0 it's still ok.

After I compile the substrate or any substrate based blockchain, the check for the runtime will appear the following error:

-->$ ./target/debug/node-template --tmp --dev
2023-03-19 21:03:00 Substrate Node    
2023-03-19 21:03:00 ✌️  version 4.0.0-dev-d67d92de1be    
2023-03-19 21:03:00 ❤️  by Substrate DevHub <https://github.com/substrate-developer-hub>, 2017-2023    
2023-03-19 21:03:00 📋 Chain specification: Development    
2023-03-19 21:03:00 🏷  Node name: divergent-collar-5282    
2023-03-19 21:03:00 👤 Role: AUTHORITY    
2023-03-19 21:03:00 💾 Database: RocksDb at /tmp/substrateoESZmw/chains/dev/db/full    
2023-03-19 21:03:00 ⛓  Native runtime: node-template-100 (node-template-1.tx1.au1)    
Error: Service(Client(VersionInvalid("cannot deserialize module: UnknownOpcode(192)")))
2023-03-19 21:03:00 Cannot create a runtime error=Other("cannot deserialize module: UnknownOpcode(192)")

I'm familiar with substrate very well, so I know this error is caused by the crate parity-wasm that developed by parity to check and decode and etc to handle wasm file.

This error comes from
image

So the unknown Opcode is 0xc0 (192), while the function deserialize_buffer comes from crate parity-wasm.

And for current substrate (at least for the branch polkadot-0.9.39), the parity-wasm is using the version 0.45.0

In this version, the Opcode 0xc0 is under the control of feature sign_ext

image

I know that substrate runtime wasm should be limited in the most concise Wasm specification.

So I'm not sure whether the Opcode group sign_ext is under the required Wasm specification for the Substrate runtime.

If it's needed, fix this issue is very simple.

However if it's not needed, it's strange why rust toolchain need to add those group Opcode in normal Wasm file.

At least I can ensure that, for the toolchain nightly-1.70.0(2023-03-18) is will appear this problem, while night-1.68.0 not. Not sure for nightly-1.69.0

Steps to reproduce

rust toolchain version:
stable: 1.68.0 (2c8cc3432 2023-03-06)
nightly: 1.70.0-nightly (4a04d086c 2023-03-18)

substrate version: branch: polkadot-0.9.39

how to reproduce:

build any substrate project, and run the node directly. It will meet the error and exit for the error

2023-03-19 21:03:00 Cannot create a runtime error=Other("cannot deserialize module: UnknownOpcode(192)")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions