-
Notifications
You must be signed in to change notification settings - Fork 115
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): Evict transactions from the mempool using the ZIP-317 conventional fee #5703
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #5703 +/- ##
==========================================
+ Coverage 78.73% 78.78% +0.05%
==========================================
Files 305 306 +1
Lines 38503 38552 +49
==========================================
+ Hits 30314 30372 +58
+ Misses 8189 8180 -9 |
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.
Code looks clean and correct, just needs minor updates to a couple doc comments.
I like that zcash_serialized_size
was updated to return a usize
.
Co-authored-by: Daira Hopwood <[email protected]>
Co-authored-by: Arya <[email protected]>
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.
Thank you!
…7 conventional fee (#5703) - manual fix changelog * Add a ZIP-317 conventional fee module * Add a conventional fee calculation stub, and use it for mempool size limiting * Just return a usize from zcash_serialized_size(), removing the unused Result * Add ZIP-317 constants * Calculate the ZIP-317 conventional fee * Update tests * Add a CHANGELOG entry * Fix a comment typo Co-authored-by: Daira Hopwood <[email protected]> * Fix some missing words in a comment Co-authored-by: Arya <[email protected]> Co-authored-by: Daira Hopwood <[email protected]> Co-authored-by: Arya <[email protected]>
Motivation
We want to implement the ZIP-317 conventional fee calculation, and use it to evict transactions from the mempool.
This is a security fix independent of the getblocktemplate work.
(But we also use the conventional fee calculation when selecting transactions for new blocks.)
Close #5335.
Specifications
https://zips.z.cash/zip-0317#fee-calculation
https://zips.z.cash/zip-0317#mempool-size-limiting
This change can be deployed immediately:
https://zips.z.cash/zip-0317#deployment
Designs
Do the fee calculation in the specified order, using similar names for everything:
https://zips.z.cash/zip-0317#fee-calculation
Cache the result as a field on
UnminedTx
, because it only changes when the transaction data changes. This way, it is available during block construction and transaction relaying.This is a standard rule, not a consensus rule, so variations in the implementation are acceptable.
Solution
Related changes:
zcash_serialized_size()
, removing the unusedResult<_, io::Error>
Review
I'd like two people to review this code, including @dconnolly because she helped write the spec.
Here is the corresponding code in
zcash_primitives
(it doesn't have Orchard support yet):https://github.com/zcash/librustzcash/blob/main/zcash_primitives/src/transaction/fees/zip317.rs#L117
Do we need any extra tests?
Reviewer Checklist
Follow Up Work
The changes to transaction relaying and block production depend on enough wallets updating to pay these fees:
https://zips.z.cash/zip-0317#deployment
So they have separate tickets:
getblocktemplate
transactions according to ZIP-317 #5473