-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test(mempool): add commit block test different leader scenario #490
test(mempool): add commit block test different leader scenario #490
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #490 +/- ##
=======================================
Coverage 81.21% 81.21%
=======================================
Files 42 42
Lines 1826 1826
Branches 1826 1826
=======================================
Hits 1483 1483
Misses 269 269
Partials 74 74 ☔ View full report in Codecov by Sentry. |
530c747
to
dd8816d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @MohammadNassar1)
crates/mempool/src/mempool_test.rs
line 448 at r2 (raw file):
// Check that in the transaction queue there is a single transaction, tx 4, of address "0x0". assert_eq_mempool_queue(&mempool, &[tx_address0_nonce6]) }
Suggestion:
#[rstest]
#[ignore]
fn test_commit_block_from_different_leader() {
// Setup.
let tx_address0_nonce3 = add_tx_input!(tip: 1, tx_hash: 1, sender_address: "0x0", tx_nonce: 3_u8, account_nonce: 2_u8).tx;
let tx_address0_nonce5 = add_tx_input!(tip: 1, tx_hash: 2, sender_address: "0x0", tx_nonce: 5_u8, account_nonce: 2_u8).tx;
let tx_address0_nonce6 = add_tx_input!(tip: 1, tx_hash: 3, sender_address: "0x0", tx_nonce: 6_u8, account_nonce: 2_u8).tx;
let tx_address1_nonce2 = add_tx_input!(tip: 1, tx_hash: 4, sender_address: "0x1", tx_nonce: 2_u8, account_nonce: 1_u8).tx;
let queued_txs = [TransactionReference::new(&tx_address1_nonce2)];
let pool_txs =
[tx_address0_nonce3, tx_address0_nonce5, tx_address0_nonce6.clone(), tx_address1_nonce2];
let mut mempool: Mempool = MempoolState::new(pool_txs, queued_txs).into();
// Test.
let state_changes = HashMap::from([
(contract_address!("0x0"), AccountState { nonce: Nonce(felt!(5_u16)) }),
// A hole, missing nonce 1.
(contract_address!("0x1"), AccountState { nonce: Nonce(felt!(0_u16)) }),
(contract_address!("0x2"), AccountState { nonce: Nonce(felt!(1_u16)) }),
]);
assert!(mempool.commit_block(commit_state).is_ok());
// Assert.
assert_eq_mempool_queue(&mempool, &[tx_address0_nonce6])
}
dd8816d
to
1e0044a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @MohammadNassar1)
This change is