ink icon indicating copy to clipboard operation
ink copied to clipboard

CodeRejected error when deploying ink! 5 contract compiled with Rust 1.87

Open AlexD10S opened this issue 7 months ago • 1 comments

Problem

When compiling an ink! 5 smart contract using Rust 1.87, the resulting .contract file fails to deploy via https://ui.use.ink/instantiate.

The error shown is:

CodeRejected

The contract's code was found to be invalid during validation.The most likely cause of this is that an API was used which is not supported by thenode. This happens if an older node is used with a new version of ink!. Try updatingyour node to the newest available version.A more detailed error can be found on the node console if debug messages are enabledby supplying `-lruntime::contracts=debug`.

Can't load the module into wasmi!

The logs of the node:

DEBUG tokio-runtime-worker runtime::contracts: Module creation failed: Error { kind: Wasm(BinaryReaderError { inner: BinaryReaderErrorInner { message: "bulk memory support is not enabled", offset: 496, needed_hint: None } }) }    
DEBUG tokio-runtime-worker runtime::contracts: New code rejected on validation: Can't load the module into wasmi!    

Using the same contract, compiling with Rust 1.86 works correctly! And is only for inkv5

Steps to Reproduce

  1. Set Rust version to 1.87: rustup update
  2. Build in debug mode cargo contract build
  3. Upload the resulting .contract file to https://ui.use.ink/instantiate

AlexD10S avatar May 30 '25 08:05 AlexD10S

Additional precision: the deployment fails when the contract is built on debug mode. It works fine when it is built on release mode.

GuiGou12358 avatar May 30 '25 08:05 GuiGou12358