-
Notifications
You must be signed in to change notification settings - Fork 15
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
chore(mempool): move account nonces update check to add tx test #878
base: main
Are you sure you want to change the base?
chore(mempool): move account nonces update check to add tx test #878
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #878 +/- ##
===========================================
- Coverage 74.18% 15.26% -58.93%
===========================================
Files 359 31 -328
Lines 36240 2738 -33502
Branches 36240 2738 -33502
===========================================
- Hits 26886 418 -26468
+ Misses 7220 2302 -4918
+ Partials 2134 18 -2116
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
96ce31e
to
e349c54
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.
Reviewable status: 0 of 2 files reviewed, 1 unresolved discussion
crates/mempool/src/mempool_test.rs
line 490 at r2 (raw file):
.with_queue(expected_queue_txs) .build(); expected_mempool_content.assert_eq_pool_and_queue_content(&mempool);
I think it would be better to delete this function since we now have more fields to assert, and we can check each one separately as needed.
Code quote:
assert_eq_pool_and_queue_content
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.
Reviewable status: 0 of 2 files reviewed, 3 unresolved discussions (waiting on @ayeletstarkware)
Cargo.lock
line 9793 at r2 (raw file):
dependencies = [ "async-trait", "derive_more 0.99.17",
The lock was updated, but no toml files were updated. This seems odd...
Code quote:
"derive_more 0.99.17"
crates/mempool/src/mempool_test.rs
line 490 at r2 (raw file):
Previously, ayeletstarkware (Ayelet Zilber) wrote…
I think it would be better to delete this function since we now have more fields to assert, and we can check each one separately as needed.
Delete it from this test - and not in general, I see.
Is this the intended behavior?
crates/mempool/src/mempool_test.rs
line 497 at r2 (raw file):
.with_queue(expected_queue_txs) .with_account_nonces(expected_account_nonces) .build();
For the record, this suggested code does not require .collect
. I am not sure it is a value we should aspire to, though. This suggestion is less readable.
Suggestion:
// Assert: transactions are ordered by priority.
let expected_mempool_content = MempoolContentBuilder::new()
.with_account_nonces(add_tx_inputs.iter().map(|input| {
let Account { sender_address, state: AccountState { nonce } } = input.account;
(sender_address, nonce)
}))
.with_queue(add_tx_inputs.iter().map(|input| TransactionReference::new(&input.tx)))
.with_pool(add_tx_inputs.into_iter().map(|input| input.tx))
.build();
crates/mempool/src/mempool_test.rs
line 497 at r2 (raw file):
.with_queue(expected_queue_txs) .with_account_nonces(expected_account_nonces) .build();
Please align the order of the itereables and the order of the with_
methods (If it is possible). (Not necessarily in the suggested order - but in a readable way).
Suggestion:
// Assert: transactions are ordered by priority.
let expected_account_nonces: Vec<(ContractAddress, Nonce)> = add_tx_inputs
.iter()
.map(|input| {
let Account { sender_address, state: AccountState { nonce } } = input.account;
(sender_address, nonce)
})
.collect();
let expected_queue_txs: Vec<TransactionReference> =
add_tx_inputs.iter().map(|input| TransactionReference::new(&input.tx)).collect();
let expected_pool_txs = add_tx_inputs.into_iter().map(|input| input.tx);
let expected_mempool_content = MempoolContentBuilder::new()
.with_account_nonces(expected_account_nonces)
.with_queue(expected_queue_txs)
.with_pool(expected_pool_txs)
.build();
Previously, ArniStarkware (Arnon Hod) wrote…
Collect is happening inside anyway. |
Previously, ArniStarkware (Arnon Hod) wrote…
So, I regret that comment. |
Previously, ArniStarkware (Arnon Hod) wrote…
Please also extend this order to the |
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.
Reviewable status: 0 of 2 files reviewed, 2 unresolved discussions (waiting on @ArniStarkware)
Cargo.lock
line 9793 at r2 (raw file):
Previously, ArniStarkware (Arnon Hod) wrote…
The lock was updated, but no toml files were updated. This seems odd...
removed
crates/mempool/src/mempool_test.rs
line 490 at r2 (raw file):
Previously, ArniStarkware (Arnon Hod) wrote…
Delete it from this test - and not in general, I see.
Is this the intended behavior?
I considered deleting this function, but it was decided to keep it, so I’m returning to using it.
crates/mempool/src/mempool_test.rs
line 497 at r2 (raw file):
Previously, ArniStarkware (Arnon Hod) wrote…
Please also extend this order to the
assert
lines.
Due to borrowing constraints, the iterators are in this order. I’ve arranged the following flow as optimally as possible.
e349c54
to
73a8306
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 2 of 2 files at r3, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @ayeletstarkware)
This change is