Skip to content

Commit

Permalink
test(mempool): add commit block test that exclude some txs (#489)
Browse files Browse the repository at this point in the history
  • Loading branch information
MohammadNassar1 authored Jul 24, 2024
1 parent fc5813a commit 93de0bd
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions crates/mempool/src/mempool_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,3 +421,25 @@ fn test_flow_filling_holes(mut mempool: Mempool) {
// Assert: all remaining transactions are returned.
assert_eq!(txs, &[input_address_0_nonce_0.tx]);
}

#[rstest]
#[ignore]

fn test_commit_block_rewinds_nonce() {
// Setup.
let tx_address0_nonce5 = add_tx_input!(tip: 1, tx_hash: 2, sender_address: "0x0", tx_nonce: 5_u8, account_nonce: 4_u8).tx;

let queued_txs = [TransactionReference::new(&tx_address0_nonce5)];
let pool_txs = [tx_address0_nonce5];
let mut mempool: Mempool = MempoolState::new(pool_txs, queued_txs).into();

// Test.
let state_changes = HashMap::from([
(contract_address!("0x0"), AccountState { nonce: Nonce(felt!(3_u16)) }),
(contract_address!("0x1"), AccountState { nonce: Nonce(felt!(3_u16)) }),
]);
assert!(mempool.commit_block(state_changes).is_ok());

// Assert.
assert_eq_mempool_queue(&mempool, &[])
}

0 comments on commit 93de0bd

Please sign in to comment.