use-ink / ink

Polkadot's ink! to write smart contracts.
https://use.ink
Apache License 2.0
1.35k stars 427 forks source link

End-to-end tests contracts fails despite correct node setup #1875

Closed 0xf333 closed 1 year ago

0xf333 commented 1 year ago

Description:

End-to-end tests (e2e-tests feature) for the Ink contracts fail to run even when substrate-contracts-node is installed and setup properly.



Steps to Reproduce:

  1. Make sure you have the latest substrate-contracts-node and cargo-contract installed; if you don't please run:

    cargo install contracts-node --git https://github.com/paritytech/substrate-contracts-node.git

    and

    cargo install cargo-contract --force
  2. clone this repo

    git clone https://github.com/0xf333/scenario_for_E2E_test_issue
  3. Navigate to the flipper contract directory:

    cd scenario_for_E2E_test_issue/issue/flipper
  4. First, run the following command to build:

    cargo contract build --release
  5. And then run this command for the E2E test:

    cargo test --features e2e-tests



Expected Behavior:

The E2E test should run successfully.

Actual Behavior:

The E2E test fails regardless of having substrate-contracts-node installed. Even if you are running the node in the background and then run the E2E test, it will still fail.

https://github.com/paritytech/ink/assets/100840345/1ab31641-4a8a-4a5d-816f-0e2f6cb2ca3e



Environment:

OS: Debian cargo-contract version 3.0.1 ink! version: 4.2.1 ink_e2e version: 4.2.1 substrate-contracts-node version: 0.30.0-72e68577688 Rustc version: 1.71.1 stable

.

SkymanOne commented 1 year ago

Related to https://github.com/paritytech/cargo-contract/issues/1239#issuecomment-1672202373

ascjones commented 1 year ago

I believe the problem here is that the latest substrate-contracts-node is not compatible with the released 4.2.1 of ink_e2e on crates.io. This is because of changes to the port discovery string.

ink! version: 4.2.1 ink_e2e version: 4.2.1 substrate-contracts-node version: 0.30.0-72e68577688

^^ These are not compatible. You need an earlier substrate-contracts-node version for 4.2.1

Otherwise use ink master branch which is compatible with substrate-contracts-node version: 0.30.0-72e68577688

See https://github.com/paritytech/ink/pull/1876#pullrequestreview-1578317652

ascjones commented 1 year ago

This should be fixed in 4.3.0 and also 5.0.0-alpha