From cc3abb889ce52500a9b80c3bd190cd8fe31e8e13 Mon Sep 17 00:00:00 2001 From: lilyjjo Date: Tue, 1 Oct 2024 11:24:34 -0400 Subject: [PATCH] fix tests --- crates/astria-sequencer/src/mempool/mod.rs | 12 ++++++++---- .../src/service/mempool/tests.rs | 17 +++++------------ 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/crates/astria-sequencer/src/mempool/mod.rs b/crates/astria-sequencer/src/mempool/mod.rs index 47b013eb0d..9946ccdf09 100644 --- a/crates/astria-sequencer/src/mempool/mod.rs +++ b/crates/astria-sequencer/src/mempool/mod.rs @@ -669,7 +669,7 @@ mod tests { #[tokio::test] async fn run_maintenance_promotion() { - let metrics = Box::leak(Box::new(Metrics::noop_metrics(&()).unwrap())); + let metrics = Box::leak(Box::new(Metrics::noop_metrics(&()).unwrap())); let mempool = Mempool::new(metrics); // create transaction setup to trigger promotions @@ -742,7 +742,7 @@ mod tests { #[tokio::test] async fn run_maintenance_demotion() { - let metrics = Box::leak(Box::new(Metrics::noop_metrics(&()).unwrap())); + let metrics = Box::leak(Box::new(Metrics::noop_metrics(&()).unwrap())); let mempool = Mempool::new(metrics); // create transaction setup to trigger demotions @@ -837,7 +837,7 @@ mod tests { #[tokio::test] async fn remove_invalid() { - let metrics = Box::leak(Box::new(Metrics::noop_metrics(&()).unwrap())); + let metrics = Box::leak(Box::new(Metrics::noop_metrics(&()).unwrap())); let mempool = Mempool::new(metrics); let account_balances = mock_balances(100, 100); let tx_cost = mock_tx_cost(10, 10, 10); @@ -1130,7 +1130,11 @@ mod tests { // remove the transacitons from the mempool via maintenance let mut mock_state = mock_state_getter().await; - mock_state_put_account_nonce(&mut mock_state, astria_address_from_hex_string(ALICE_ADDRESS).bytes(), 2); + mock_state_put_account_nonce( + &mut mock_state, + astria_address_from_hex_string(ALICE_ADDRESS).bytes(), + 2, + ); mempool.run_maintenance(&mock_state, false).await; // check that the transactions are not in the tracked set diff --git a/crates/astria-sequencer/src/service/mempool/tests.rs b/crates/astria-sequencer/src/service/mempool/tests.rs index 13758bf5e9..bb9b6ea0d8 100644 --- a/crates/astria-sequencer/src/service/mempool/tests.rs +++ b/crates/astria-sequencer/src/service/mempool/tests.rs @@ -12,7 +12,7 @@ use tendermint::{ use crate::{ app::{ - test_utils::get_alice_signing_key, + test_utils::MockTxBuilder, App, }, mempool::{ @@ -38,11 +38,7 @@ async fn future_nonce_ok() { app.commit(storage.clone()).await; let the_future_nonce = 10; - let tx = mock_tx( - the_future_nonce, - &get_alice_signing_key(), - "target_rollup_id", - ); + let tx = MockTxBuilder::new().nonce(the_future_nonce).build(); let req = CheckTx { tx: tx.to_raw().encode_to_vec().into(), kind: CheckTxKind::New, @@ -71,8 +67,7 @@ async fn rechecks_pass() { .unwrap(); app.commit(storage.clone()).await; - let nonce = 0; - let tx = mock_tx(nonce, &get_alice_signing_key(), "target_rollup_id"); + let tx = MockTxBuilder::new().nonce(0).build(); let req = CheckTx { tx: tx.to_raw().encode_to_vec().into(), kind: CheckTxKind::New, @@ -110,8 +105,7 @@ async fn can_reinsert_after_recheck_fail() { .unwrap(); app.commit(storage.clone()).await; - let nonce = 0; - let tx = mock_tx(nonce, &get_alice_signing_key(), "target_rollup_id"); + let tx = MockTxBuilder::new().nonce(0).build(); let req = CheckTx { tx: tx.to_raw().encode_to_vec().into(), kind: CheckTxKind::New, @@ -159,8 +153,7 @@ async fn receck_adds_non_tracked_tx() { .unwrap(); app.commit(storage.clone()).await; - let nonce = 0; - let tx = mock_tx(nonce, &get_alice_signing_key(), "target_rollup_id"); + let tx = MockTxBuilder::new().nonce(0).build(); let req = CheckTx { tx: tx.to_raw().encode_to_vec().into(), kind: CheckTxKind::Recheck,