2

Im getting the following error while trying to run e2e rust ink! smart contracts tests: #![feature(min_specialization)] using the following command: cargo test --features e2e-tests

Im using the following example to run the e2e tests : https://github.com/swanky-dapps/manic-minter

The smart contract itself compiles successfully with the following command: cargo contract build

Here is how the e2e test looks like:

    #[cfg(all(test, feature = "e2e-tests"))]
    mod e2e_tests {
        use super::*;
        use crate::manicminter::ManicMinterRef;
        use ink::primitives::AccountId;
        use ink_e2e::build_message;
        use openbrush::contracts::ownable::ownable_external::Ownable;
        use openbrush::contracts::psp22::psp22_external::PSP22;
        use oxygen::oxygen::OxygenRef;

        type E2EResult<T> = std::result::Result<T, Box<dyn std::error::Error>>;

        const AMOUNT: Balance = 100;
        const PRICE: Balance = 10;

        /// Helper to get Bob's account_id from `ink_e2e::bob()` PairSigner
        fn get_bob_account_id() -> AccountId {
            let bob = ink_e2e::bob::<ink_e2e::PolkadotConfig>();
            let bob_account_id_32 = bob.account_id();
            let bob_account_id = AccountId::try_from(bob_account_id_32.as_ref()).unwrap();

            bob_account_id
        }

Here is my Cargo.toml file:

[dependencies]
ink = { version = "4.0.0", default-features = false }
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true }
openbrush = { git = "https://github.com/727-Ventures/openbrush-contracts", tag="3.0.0", default-features= false, features = ["psp22"] }
my_psp22 = { path = "../my_psp22",version="1.0.0",default-features = false, features = ["ink-as-dependency"] }

[dev-dependencies]
ink_e2e = "4.0.1" 

Thanks in advance :)

1 Answer 1

3

Whenever you see this macro #![feature(min_specialization)] in the error message it is most likely that you are not using rust nightly. This macro is not supported by the stable rust version and you need to add +nightlyto build it:

cargo +nightly contract build --release

You might be using manic-minter as example but you are using different ink versions than manic-minter which uses ink v4.1. If you use manic-minter example you do not need to worry about this +nightlybecause you will have rust-toolchain.toml.

Also in your cargo.toml the version of ink and ink_e2e better be the same.

Please upgrade all of your contracts to ink v4.2.1 due to known security issue.

4
  • Im getting the following error when trying to switch to +nightly toolchain ERROR: Mismatching versions of parity-scale-codec were found! Please ensure that your contract and your ink! dependencies use a compatible version of this package. Jun 15 at 11:58
  • Try to use same set of dependencies like in manic-minter. You can move openbrush and my_psp34 under dev-dependencies
    – Maario
    Jun 15 at 12:33
  • in general it is the fastest if you give link to the source code and let community try to see what is wrong. Otherwise there is a lot of back and forth and the answers can't be straight forward
    – Maario
    Jun 15 at 12:35
  • your openbrush version is also wrong
    – Maario
    Jun 15 at 12:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.