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

fix: change inner AddressPrioQueue #240

Merged
merged 1 commit into from
Jun 19, 2024
Merged

Conversation

giladchase
Copy link
Collaborator

@giladchase giladchase commented Jun 13, 2024

  • pop_front in Vec is O(n).
  • should be private to protect invariant.

This change is Reviewable

@codecov-commenter
Copy link

codecov-commenter commented Jun 13, 2024

Codecov Report

Attention: Patch coverage is 0% with 10 lines in your changes missing coverage. Please review.

Project coverage is 74.29%. Comparing base (50d38f0) to head (e2cc261).
Report is 1 commits behind head on main.

Files Patch % Lines
crates/mempool/src/priority_queue.rs 0.00% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #240      +/-   ##
==========================================
- Coverage   74.78%   74.29%   -0.49%     
==========================================
  Files          23       23              
  Lines         916      922       +6     
  Branches      916      922       +6     
==========================================
  Hits          685      685              
- Misses        187      193       +6     
  Partials       44       44              

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

@giladchase giladchase force-pushed the gilad/addr-prio-queue-vis branch 3 times, most recently from b123cb8 to 9f6467f Compare June 13, 2024 09:27
- pop_front in Vec is O(n).
- should be private to protect invariant.
@giladchase giladchase force-pushed the gilad/addr-prio-queue-vis branch from 9f6467f to e2cc261 Compare June 13, 2024 09:30
@giladchase giladchase changed the title fix: make address prio queue inner private fix: change inner AddressPrioQueue Jun 13, 2024
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, 1 unresolved discussion (waiting on @ayeletstarkware and @giladchase)


crates/mempool/src/priority_queue.rs line 67 at r1 (raw file):

// Assumption: Transactions are provided in the correct order.
#[derive(Default)]
pub struct AddressPriorityQueue(VecDeque<ThinTransaction>);

I believe we should use a HashMap<Nonce, ThinTransaction>, as @elintul also suggested. This will support nonce gaps, which will be added soon

Code quote:

VecDeque

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.

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @ayeletstarkware and @giladchase)


crates/mempool/src/priority_queue.rs line 67 at r1 (raw file):

// Assumption: Transactions are provided in the correct order.
#[derive(Default)]
pub struct AddressPriorityQueue(VecDeque<ThinTransaction>);

I think it's not a good name.
These transactions are not priority transactions.

Code quote:

 AddressPriorityQueue

Copy link
Contributor

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

Reviewed all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @elintul and @giladchase)


crates/mempool/src/priority_queue.rs line 67 at r1 (raw file):

Previously, MohammadNassar1 (mohammad-starkware) wrote…

I believe we should use a HashMap<Nonce, ThinTransaction>, as @elintul also suggested. This will support nonce gaps, which will be added soon

Why not implement this in the future or the next version?

Copy link
Collaborator Author

@giladchase giladchase 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 @elintul and @MohammadNassar1)


crates/mempool/src/priority_queue.rs line 67 at r1 (raw file):

Previously, ayeletstarkware (Ayelet Zilber) wrote…

Why not implement this in the future or the next version?

Already fixed on Ayelet's PR, if i change it here as well she'll hit a conflict


crates/mempool/src/priority_queue.rs line 67 at r1 (raw file):

Previously, MohammadNassar1 (mohammad-starkware) wrote…

I think it's not a good name.
These transactions are not priority transactions.

Already fixed on Ayelet's PR, if i change it here as well she'll hit a conflict

Copy link
Contributor

@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 @elintul and @MohammadNassar1)

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.

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @giladchase)

@giladchase giladchase merged commit ccfb58d into main Jun 19, 2024
18 checks passed
@giladchase giladchase deleted the gilad/addr-prio-queue-vis branch June 19, 2024 04:51
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