Skip to content

Commit

Permalink
e2e testing: remove subxt manual nonce increment
Browse files Browse the repository at this point in the history
  • Loading branch information
ascjones committed Oct 29, 2022
1 parent 54d1bb1 commit 6360098
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions crates/e2e/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,6 @@ where
return Err(Error::InstantiateDryRun(dry_run))
}

self.set_current_nonce(signer).await;
let tx_events = self
.api
.instantiate_with_code(
Expand All @@ -376,7 +375,6 @@ where
signer,
)
.await;
signer.increment_nonce();

let mut account_id = None;
for evt in tx_events.iter() {
Expand Down Expand Up @@ -467,9 +465,7 @@ where
return Err(Error::UploadDryRun(dry_run))
}

self.set_current_nonce(signer).await;
let tx_events = self.api.upload(signer, code, storage_deposit_limit).await;
signer.increment_nonce();

let mut hash = None;
for evt in tx_events.iter() {
Expand Down Expand Up @@ -556,7 +552,6 @@ where
return Err(Error::CallDryRun(dry_run))
}

self.set_current_nonce(signer).await;
let tx_events = self
.api
.call(
Expand All @@ -568,7 +563,6 @@ where
signer,
)
.await;
signer.increment_nonce();

for evt in tx_events.iter() {
let evt = evt.unwrap_or_else(|err| {
Expand Down Expand Up @@ -640,24 +634,4 @@ where
));
Ok(alice_pre.data.free)
}

/// Fetches the next system account index for `signer.account_id()`
/// and sets it as nonce for `signer`.
async fn set_current_nonce(&mut self, signer: &mut Signer<C>) {
let nonce = self
.api
.client
.rpc()
.system_account_next_index(signer.account_id())
.await
.unwrap_or_else(|err| {
panic!(
"error getting next index for {:?}: {:?}",
signer.account_id(),
err
);
});
log_info(&format!("setting signer nonce to {:?}", nonce));
signer.set_nonce(nonce);
}
}

0 comments on commit 6360098

Please sign in to comment.