Skip to content
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): rename get_txs test to be more specific #485

Closed
wants to merge 1 commit into from

Conversation

ayeletstarkware
Copy link
Contributor

@ayeletstarkware ayeletstarkware commented Jul 16, 2024

This change is Reviewable

@codecov-commenter
Copy link

codecov-commenter commented Jul 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.21%. Comparing base (93de0bd) to head (0a55844).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #485   +/-   ##
=======================================
  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.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@elintul elintul left a 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 r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @ayeletstarkware and @giladchase)


crates/mempool/src/mempool_test.rs line 143 at r1 (raw file):

#[case::test_get_more_than_all_eligible_txs(5)]
#[case::test_get_less_than_all_eligible_txs(2)]
fn test_get_txs_fetching_order(#[case] requested_txs: usize) {

Not sure it adds to readability, since this is checked in every get_txs tets, right?

Code quote:

test_get_txs_fetching_order

Copy link
Contributor Author

@ayeletstarkware ayeletstarkware left a 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, 1 unresolved discussion (waiting on @giladchase)


crates/mempool/src/mempool_test.rs line 143 at r1 (raw file):

Previously, elintul (Elin) wrote…

Not sure it adds to readability, since this is checked in every get_txs tets, right?

not really. For example, when we want to fill a hole, we check that no txs are fetched.
Also, it is one of the splits @giladchase asked for, here #254

Copy link
Collaborator

@elintul elintul left a 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, 1 unresolved discussion (waiting on @giladchase)


crates/mempool/src/mempool_test.rs line 143 at r1 (raw file):

Previously, ayeletstarkware (Ayelet Zilber) wrote…

not really. For example, when we want to fill a hole, we check that no txs are fetched.
Also, it is one of the splits @giladchase asked for, here #254

"when we want to fill a hole, we check that no txs are fetched"
Can you explain?

Isn't the case is that in all tests of get_txs we check the order of the returned transactions?

Copy link
Contributor Author

@ayeletstarkware ayeletstarkware left a 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, 1 unresolved discussion (waiting on @giladchase)


crates/mempool/src/mempool_test.rs line 143 at r1 (raw file):

Previously, elintul (Elin) wrote…

"when we want to fill a hole, we check that no txs are fetched"
Can you explain?

Isn't the case is that in all tests of get_txs we check the order of the returned transactions?

In most tests, we focus on something else, but order. for example, only one tx is returned, so the order is not checked.

Copy link
Collaborator

@elintul elintul left a 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, 1 unresolved discussion (waiting on @giladchase)


crates/mempool/src/mempool_test.rs line 143 at r1 (raw file):

Previously, ayeletstarkware (Ayelet Zilber) wrote…

In most tests, we focus on something else, but order. for example, only one tx is returned, so the order is not checked.

Right, it's trivial there. What about rest of get_txs tests?

Copy link
Contributor Author

@ayeletstarkware ayeletstarkware left a 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, 1 unresolved discussion (waiting on @giladchase)


crates/mempool/src/mempool_test.rs line 143 at r1 (raw file):

Previously, elintul (Elin) wrote…

Right, it's trivial there. What about rest of get_txs tests?

  • test_get_txs - checks order by the tip.
  • test_get_txs_multi_nonce - only one account, so doesn't check order by tip
  • test_get_txs_with_holes_multiple_accounts - two txs of two accounts, one with a hole, so only one tx is returned. no order check
  • test_get_txs_with_holes_single_account - single account, one tx, with a hole, nothing is returned, no order check.
  • test_flow_filling_holes - flow of add_tx and get_txs.

@ayeletstarkware ayeletstarkware force-pushed the ayelet/mempool/test-get-txs/rename branch from 0aba599 to 3773163 Compare July 17, 2024 12:40
Copy link
Collaborator

@elintul elintul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed all commit messages.
Reviewable status: 0 of 1 files reviewed, all discussions resolved (waiting on @giladchase)


crates/mempool/src/mempool_test.rs line 143 at r1 (raw file):

Previously, ayeletstarkware (Ayelet Zilber) wrote…
  • test_get_txs - checks order by the tip.
  • test_get_txs_multi_nonce - only one account, so doesn't check order by tip
  • test_get_txs_with_holes_multiple_accounts - two txs of two accounts, one with a hole, so only one tx is returned. no order check
  • test_get_txs_with_holes_single_account - single account, one tx, with a hole, nothing is returned, no order check.
  • test_flow_filling_holes - flow of add_tx and get_txs.

If we always check order when >= 2 transactions are returned, this test name might be confusing.

Copy link
Contributor Author

@ayeletstarkware ayeletstarkware left a 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 1 files reviewed, all discussions resolved (waiting on @elintul and @giladchase)


crates/mempool/src/mempool_test.rs line 143 at r1 (raw file):

Previously, elintul (Elin) wrote…

If we always check order when >= 2 transactions are returned, this test name might be confusing.

wdym? we don't check 2+ txs in all the tests

Copy link
Collaborator

@elintul elintul left a 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.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @ayeletstarkware and @giladchase)


crates/mempool/src/mempool_test.rs line 147 at r2 (raw file):

#[case::test_get_more_than_all_eligible_txs(5)]
#[case::test_get_less_than_all_eligible_txs(2)]
fn test_get_txs_fetching_order(#[case] requested_txs: usize) {

Suggestion:

test_get_txs_returns_by_priority_order

@ayeletstarkware ayeletstarkware force-pushed the ayelet/mempool/test-get-txs/rename branch from 3773163 to 0a55844 Compare July 24, 2024 12:12
Copy link
Collaborator

@elintul elintul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @giladchase)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants