Skip to content

Bug Report: InstantiateDryRun Fails with Contracts::CodeRejectedΒ #76

@duythien

Description

@duythien

When running e2e tests with the e2e-tests feature enabled, contract instantiation fails with the following error:

cd ink-examples/flipper
RUST_BACKTRACE=full cargo test --features e2e-tests

Logs issue below:

unning 5 tests
test flipper::e2e_tests::e2e_test_deployed_contract ... ignored
test flipper::tests::it_works ... ok
test flipper::tests::default_works ... ok
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.16s
    Finished `release` profile [optimized] target(s) in 0.16s
test flipper::e2e_tests::default_works ... FAILED
test flipper::e2e_tests::it_works ... FAILED

failures:

---- flipper::e2e_tests::default_works stdout ----
 [==] Checking clippy linting rules
 [==] Building cargo project

thread 'flipper::e2e_tests::default_works' panicked at lib.rs:103:18:
instantiate failed: InstantiateDryRun(DryRunError { debug_message: "Can't load the module into wasmi!", error: Module(ModuleError(<Contracts::CodeRejected>)) })
stack backtrace:
   0:        0x1022fa268 - std::backtrace_rs::backtrace::libunwind::trace::hd09570c029a6744a
                               at /rustc/17067e9ac6d7ecb70e50f92c1944e545188d2359/library/std/src/../../backtrace/src/backtrace/libunwind.rs:117:9
   1:        0x1022fa268 - std::backtrace_rs::backtrace::trace_unsynchronized::h8d2fa64833f91cb3
                               at /rustc/17067e9ac6d7ecb70e50f92c1944e545188d2359/library/std/src/../../backtrace/src/backtrace/mod.rs:66:14
   2:        0x1022fa268 - std::sys::backtrace::_print_fmt::h567d2a106a3b0dee

πŸ“Œ Environment
ink! version: v5.x.x

Rust toolchain: rustc 1.87.0 (17067e9ac 2025-05-09)

Substrate node: substrate-contracts-node 0.42.0-f209befc88c

OS: macOS M4

Contract: cargo-contract-contract 5.0.3-unknown-aarch64-apple-darwin

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