-
Notifications
You must be signed in to change notification settings - Fork 107
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
change(mempool) reject transactions with spent outpoints or nullifiers #5434
Conversation
5120809
to
f158500
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #5434 +/- ##
==========================================
- Coverage 79.12% 79.12% -0.01%
==========================================
Files 308 308
Lines 39324 39394 +70
==========================================
+ Hits 31115 31170 +55
- Misses 8209 8224 +15 |
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.
This looks good to me.
I don't know how often is poll_ready
actually called, so my concern is that if there happen to be two or more blocks mined fast one after another (which can happen), Zebra would skip some blocks. This applies to other checks as well, for example, in remove_same_effects
.
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.
Looks great!
(And it's simpler than I thought 🙂)
I have a minor suggestion about naming things.
This isn't needed, because the mempool only updates by one block at a time. If there are multiple blocks, it assumes it has fallen out of sync, and resets itself. |
This is a bug fix. We want to do it to improve the mempool, it's just a higher priority now we're doing mining RPCs. So don't think we need to put it behind the |
If Zebra gets multiple blocks between mempool updates, it drops all the mempool transactions, and starts fresh with an empty mempool. This is implemented using a zebra/zebra-state/src/service/chain_tip.rs Lines 419 to 433 in 3825caa
We track this as part of zebra/zebra-state/src/service/chain_tip.rs Lines 543 to 549 in 3825caa
|
…mempool that have been invalidated by the latest block commit
…oves nullifier retrieval to the new Storage method, rejects mined_ids, and updates tests
f158500
to
b5cffbf
Compare
I was also concerned about this.
Good to know that's not an issue. |
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.
I think this looks good, just a few minor clarifications.
Do you need help with the test failures?
I know we've done some fixes on the main
branch, so I'll update this PR to the latest main
.
Edit: it was an unrelated test failure
@Mergifyio update |
✅ Branch has been successfully updated |
Ah, the test failure was a ssh issue:
https://github.com/ZcashFoundation/zebra/actions/runs/3300645552/jobs/5445970948#step:6:112 |
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.
Looks good, happy for this to go in without any of my suggestions.
(Or anyone can re-approve once they are done.)
Co-authored-by: teor <[email protected]>
…/zebra into recently-spent-outpoints
#5434) * adds transactions to ChainTipBlock and rejects transactions from the mempool that have been invalidated by the latest block commit * merges remove_same_effects in with reject_invalidated_transactions, moves nullifier retrieval to the new Storage method, rejects mined_ids, and updates tests * updates DuplicateSpend's error message * fixes tests * Update zebrad/src/components/mempool/storage.rs Co-authored-by: teor <[email protected]> * adds comment * formatting for the proptest Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: teor <[email protected]>
Motivation
To reject transactions in the mempool when they're invalidated by recently committed blocks.
Closes #2631
Solution
Review
This PR is part of regular scheduled work.
Reviewer Checklist