-
Notifications
You must be signed in to change notification settings - Fork 21
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): impl update gas price threshold flow test #1882
base: main
Are you sure you want to change the base?
test(mempool): impl update gas price threshold flow test #1882
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1882 +/- ##
==========================================
- Coverage 40.10% 3.02% -37.09%
==========================================
Files 26 108 +82
Lines 1895 13766 +11871
Branches 1895 13766 +11871
==========================================
- Hits 760 416 -344
- Misses 1100 13332 +12232
+ Partials 35 18 -17 ☔ View full report in Codecov by Sentry. |
1600fe6
to
8648666
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 4 files at r1, all commit messages.
Reviewable status: 2 of 4 files reviewed, 1 unresolved discussion (waiting on @MohammadNassar1)
crates/mempool/tests/flow_test.rs
line 298 at r2 (raw file):
// Setup. let input_tip_100_gas_price_20 = add_tx_input!(tx_hash: 1, address: "0x0", tip: 100, max_l2_gas_price: 20);
why do we need to mention the tip?
Code quote:
tip: 100
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: 2 of 4 files reviewed, 1 unresolved discussion (waiting on @ayeletstarkware)
crates/mempool/tests/flow_test.rs
line 298 at r2 (raw file):
Previously, ayeletstarkware (Ayelet Zilber) wrote…
why do we need to mention the tip?
I added tip in the name as it's the priority order, and to show that although the first tx has a higher tip, mempool couldn't get the first tx as the gas price threshold is high.
wdyt?
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: 2 of 4 files reviewed, 1 unresolved discussion (waiting on @MohammadNassar1)
crates/mempool/tests/flow_test.rs
line 298 at r2 (raw file):
Previously, MohammadNassar1 (mohammad-starkware) wrote…
I added tip in the name as it's the priority order, and to show that although the first tx has a higher tip, mempool couldn't get the first tx as the gas price threshold is high.
wdyt?
I think the tip should be tested in a unitest: create a mempool with high threshold, and one tx with high tip, low gas price, and call get_txs
.
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: 2 of 4 files reviewed, 1 unresolved discussion (waiting on @ayeletstarkware)
crates/mempool/tests/flow_test.rs
line 298 at r2 (raw file):
Previously, ayeletstarkware (Ayelet Zilber) wrote…
I think the tip should be tested in a unitest: create a mempool with high threshold, and one tx with high tip, low gas price, and call
get_txs
.
I already have a unit test that checks get_txs functionality with different gas price values.
This test checks both update_gas_price_threshold
and get_txs
.
8648666
to
fd719f9
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 4 files at r1, 4 of 4 files at r3, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @MohammadNassar1)
crates/mempool/tests/flow_test.rs
line 298 at r2 (raw file):
Previously, MohammadNassar1 (mohammad-starkware) wrote…
I already have a unit test that checks get_txs functionality with different gas price values.
This test checks both
update_gas_price_threshold
andget_txs
.
Ok, I'm not sure it's necessary since it's being checked in a unit test, but it's up to you.
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: all files reviewed, 2 unresolved discussions (waiting on @ayeletstarkware)
crates/mempool/tests/flow_test.rs
line 298 at r2 (raw file):
Previously, ayeletstarkware (Ayelet Zilber) wrote…
Ok, I'm not sure it's necessary since it's being checked in a unit test, but it's up to you.
I've implemented a unit test that checks get_txs with pending queue.
We need this flow test, as it checks a flow that can happened and verify the invariant that mempool pops out only txs with gas prices higher than the threshold while updating the gas threshold.
crates/mempool/tests/flow_test.rs
line 311 at r2 (raw file):
mempool.update_gas_price_threshold(GasPrice(30)); get_txs_and_assert_expected(&mut mempool, 2, &[input_tip_50_gas_price_30.tx]);
In a real scenario, we would call update_gas_price_threshold
only after a new round, which occurs after commit_block
.
I didn't add commit_block
in this test to simplify it, as including it wouldn't affect the test outcome.
wdyt?
Code quote:
mempool.update_gas_price_threshold(GasPrice(40));
get_txs_and_assert_expected(&mut mempool, 2, &[]);
mempool.update_gas_price_threshold(GasPrice(30));
get_txs_and_assert_expected(&mut mempool, 2, &[input_tip_50_gas_price_30.tx]);
I've made
update_gas_price_threshold
API to be public, so I can use it flow test.