ink: Uploading wasm file appear function non-existent error

I want to use the signature verification method in my contract,and add dependency in cargo.toml as fellow: schnorrkel = { version = "0.9.1",features = ["preaudit_deprecated", "u64_backend"], default-features = false}
using cargo contract build command can generate wasm file normally and uploading the wasm file to node, got some error message:

2020-03-22 22:13:36.028 tokio-blocking-driver DEBUG runtime  DispatchError
2020-03-22 22:13:36.028 tokio-blocking-driver DEBUG runtime  module imports a non-existent function

using cargo-contract version is 0.5.0 ; node of substrate version is: version 2.0.0-alpha.4-0b3020796-x86_64-linux-gnu more about reproduce code, please go to my repository example

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 30 (12 by maintainers)

Most upvoted comments

point_up Quickly added an option to disable manifest modifications for troubleshooting. However this (with rlib as a crate-type) will likely result in a significant increase in binary size: e.g. for incrementer 18.8k vs 5.1k (optimized)

Usage of this command is generally not recommended for use cases other than debugging. My guess so far is that the library you are using is non compatible with contracts for some reason and we should find out why and not work around that problem by fiddling around with some configs here and there. Our current findings is that the rlib target causes trouble if it is being removed. However, the reality is that this rlib option only exists because of our metadata generation process and should ideally not even be there at all. Not removing something that shouldn’t exists in the first place is a clear indicator that something else is broken.

😱

It appears that this is back. What a tragedy. My minimal reproducer does not trigger it anymore. This is why it passed our regression test in rustc I assume. In order to reproduce:

cargo-contract 0.15.0-unknown-x86_64-macos
rustc 1.58.0-nightly (cc946fcd3 2021-11-18)
cargo +nightly contract new flipper
cd flipper
cargo +nightly contract build

ERROR: Validation of the Wasm failed.

...

Please note that the error does not appear in nightly-2021-11-17. So nightly-2021-11-18 introduces this regression.

@athei Yes, for contract size regressions: https://github.com/paritytech/ink-waterfall/issues/4.

It’s a good idea to add a contract which provoked this bug to the waterfall and see if it still deploys fine in the future, I’ll add it.

I was able to strip down this issue to its cause: https://github.com/rust-lang/rust/issues/78744

I can reproduce the error with this repo and cargo-contract 0.7.1: https://github.com/athei/test_verify

The only known workaround when you encounter this bug is adding this to your Cargo.toml:

[profile.release]
overflow-checks = false