Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Lilyjjo committed Oct 1, 2024
1 parent 8812a4e commit cc3abb8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
12 changes: 8 additions & 4 deletions crates/astria-sequencer/src/mempool/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down
17 changes: 5 additions & 12 deletions crates/astria-sequencer/src/service/mempool/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use tendermint::{

use crate::{
app::{
test_utils::get_alice_signing_key,
test_utils::MockTxBuilder,
App,
},
mempool::{
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit cc3abb8

Please sign in to comment.