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): get txs multi nonce multi account validate replenishin… #502

Conversation

ayeletstarkware
Copy link
Contributor

@ayeletstarkware ayeletstarkware commented Jul 18, 2024

…g queue


This change is Reviewable

@codecov-commenter
Copy link

codecov-commenter commented Jul 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.85%. Comparing base (af61ce5) to head (cbc5c43).

Additional details and impacted files
@@                                      Coverage Diff                                       @@
##           ayelet/mempool/return-requested-txs-after-replenshing-get-txs     #502   +/-   ##
==============================================================================================
  Coverage                                                          81.85%   81.85%           
==============================================================================================
  Files                                                                 42       42           
  Lines                                                               1857     1857           
  Branches                                                            1857     1857           
==============================================================================================
  Hits                                                                1520     1520           
  Misses                                                               259      259           
  Partials                                                              78       78           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ayeletstarkware ayeletstarkware force-pushed the ayelet/mempool/return-requested-txs-after-replenshing-get-txs branch from e63abfd to 4aa3fe5 Compare July 18, 2024 13:34
Copy link
Contributor

@MohammadNassar1 MohammadNassar1 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, 2 unresolved discussions (waiting on @ayeletstarkware, @elintul, and @giladchase)


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

    // and processed after the transaction from account 1, even though it has a higher tip.
    assert_eq!(txs, &[tx_address_0_nonce_0, tx_address_1_nonce_0, tx_address_0_nonce_1]);
    let expected_mempool_state = MempoolState::new([], []);

Use Default.

Code quote:

MempoolState::new([], []);

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

    assert_eq!(txs, &[tx_address_0_nonce_0, tx_address_1_nonce_0, tx_address_0_nonce_1]);
    let expected_mempool_state = MempoolState::new([], []);
    expected_mempool_state.assert_eq_mempool_state(&mempool);

Should we consider adding an is_empty method?

Code quote:

    let expected_mempool_state = MempoolState::new([], []);
    expected_mempool_state.assert_eq_mempool_state(&mempool);

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, 4 unresolved discussions (waiting on @ayeletstarkware, @giladchase, and @MohammadNassar1)


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

#[rstest]
fn test_get_txs_multi_nonce_multi_account_validate_replenishing_queue() {

Suggestion:

test_get_txs_replenishes_queue_only_between_chunks

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

    // Assert: all transactions are returned. The second transaction from account 0 is replenished
    // and processed after the transaction from account 1, even though it has a higher tip.

Suggestion:

    // Assert: all transactions returned.
    // Replenishment done in chunks: account 1 transaction is returned before the one of 
    // account 0, although its priority is higher.

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

Previously, MohammadNassar1 (mohammad-starkware) wrote…

Use Default.

Do we have empty()?


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

Previously, MohammadNassar1 (mohammad-starkware) wrote…

Should we consider adding an is_empty method?

The following line should be readable enough:

MempoolState::empty().assert_eq_mempool_state(&mempool);

Although if repeated a lot, we can consider it (let's have a higher level overview after all tests are merged).

@ayeletstarkware ayeletstarkware force-pushed the ayelet/mempool/return-requested-txs-after-replenshing-get-txs branch 2 times, most recently from 1991f1e to 94e38d5 Compare July 24, 2024 12:36
@ayeletstarkware ayeletstarkware force-pushed the ayelet/mempool/replenishing-queue/test-multi-nonce-multi-account branch from 74f25f4 to 2563c19 Compare July 24, 2024 12:54
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, 2 unresolved discussions (waiting on @giladchase and @MohammadNassar1)


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

Previously, elintul (Elin) wrote…

Do we have empty()?

in a different PR.


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

Previously, elintul (Elin) wrote…

The following line should be readable enough:

MempoolState::empty().assert_eq_mempool_state(&mempool);

Although if repeated a lot, we can consider it (let's have a higher level overview after all tests are merged).

Ok

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 r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @giladchase and @MohammadNassar1)

@ayeletstarkware ayeletstarkware force-pushed the ayelet/mempool/return-requested-txs-after-replenshing-get-txs branch from 94e38d5 to af61ce5 Compare July 24, 2024 13:34
@ayeletstarkware ayeletstarkware force-pushed the ayelet/mempool/replenishing-queue/test-multi-nonce-multi-account branch from 2563c19 to cbc5c43 Compare July 24, 2024 13:36
Copy link
Contributor

@MohammadNassar1 MohammadNassar1 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: :shipit: complete! all files reviewed, all discussions resolved (waiting on @giladchase)

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: :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.

4 participants