-
Notifications
You must be signed in to change notification settings - Fork 480
Closed as not planned
Closed as not planned
Copy link
Labels
Description
If you try and instantiate or call a contract message from different E2E test using the
same signer you end up running into the following error:
❯ cargo +nightly test --manifest-path ./examples/flipper/Cargo.toml
running 4 tests
test flipper::tests::it_works ... ok
test flipper::tests::default_works ... ok
test flipper::e2e_tests::e2e_first_instantiation ... FAILED
test flipper::e2e_tests::e2e_second_instantiation ... ok
failures:
---- flipper::e2e_tests::e2e_first_instantiation stdout ----
thread 'flipper::e2e_tests::e2e_first_instantiation' panicked at 'error on call `sign_and_submit_then_watch_default`: Rpc(ClientError(Call(Custom(ErrorObject { code: ServerError(1014), message: "Priority is too low: (318 vs 318)", data: Some(RawValue("The transaction has too low priority to replace another transaction already in the pool.")) }))))', /Users/hcastano/Workspace/ParityTech/ink/crates/e2e/src/xts.rs:259:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
failures:
flipper::e2e_tests::e2e_first_instantiation
test result: FAILED. 3 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.17s
error: test failed, to rerun pass `--lib`
However, if you change the signer in one of the tests then everything passes.
I'm not sure if the error lies in the E2E tests, or in subxt, but either way I imagine
there needs to be some better nonce management here.
This can be reproduced with ink@7789caf, cargo-contract@3e24722, and
[email protected] using the following tests with Flipper:
#[cfg(test)]
mod e2e_tests {
type E2EResult<T> = std::result::Result<T, Box<dyn std::error::Error>>;
#[ink_e2e::test]
async fn e2e_first_instantiation(
mut client: ink_e2e::Client<C, E>,
) -> E2EResult<()> {
let constructor = flipper::constructors::default();
client
.instantiate(&mut ink_e2e::alice(), constructor, 0, None)
.await
.expect("Instantiate `flipper` failed");
Ok(())
}
#[ink_e2e::test]
async fn e2e_second_instantiation(
mut client: ink_e2e::Client<C, E>,
) -> E2EResult<()> {
// N.B, If we use `ink_e2e::bob()` this passes
let constructor = flipper::constructors::default();
client
.instantiate(&mut ink_e2e::alice(), constructor, 0, None)
.await
.expect("Instantiate `flipper` failed");
Ok(())
}
}