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

refactor: reverse order iterator for transaction queue #364

Merged
merged 1 commit into from
Jul 7, 2024

Conversation

ayeletstarkware
Copy link
Contributor

@ayeletstarkware ayeletstarkware commented Jul 4, 2024

Update TransactionQueue iter to return reverse order iterator.

  • Refactored the iter function to return an iterator in reverse order, contrasting with the BTreeSet iterator which returns in ascending order.
  • This change makes the iteration more intuitive for the mempool queue, which returns transactions by reverse tip order.

This change is Reviewable

@ayeletstarkware ayeletstarkware requested a review from elintul July 4, 2024 11:16
@codecov-commenter
Copy link

codecov-commenter commented Jul 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (main@fb92713). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #364   +/-   ##
=======================================
  Coverage        ?   80.80%           
=======================================
  Files           ?       35           
  Lines           ?     1620           
  Branches        ?     1620           
=======================================
  Hits            ?     1309           
  Misses          ?      245           
  Partials        ?       66           

☔ 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 2 of 2 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @ayeletstarkware)


crates/mempool/src/transaction_queue.rs line 43 at r1 (raw file):

    /// Gets an iterator that visits the elements in the queue in descending
    /// order, in contrast to the `BTreeSet` iterator which visits in ascending order.

We can use the same doc. as mempool's iter.
Note that referencing BTreeSet is beyond the scope here; focus on behavioral documentation, avoiding implementation details as much as possible.

Suggestion:

    /// Returns an iterator of the current eligible transactions for sequencing, ordered by their
    /// priority.

@ayeletstarkware ayeletstarkware force-pushed the ayelet/mempool/transaction-queue-iter-func branch from 919b369 to 04203ff Compare July 7, 2024 08:27
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 2 of 2 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @ayeletstarkware)

@ayeletstarkware ayeletstarkware merged commit a2b8df2 into main Jul 7, 2024
8 checks passed
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