-
Notifications
You must be signed in to change notification settings - Fork 111
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 validation of Sapling shielded data in transaction::Verifier
#2419
Refactor validation of Sapling shielded data in transaction::Verifier
#2419
Conversation
Yes, we can merge #2397 now if you want. I triaged it as optional because it didn't impact any other work. But now we need it for other things we can merge. Can you please add an estimate to #2397 before you merge it? |
These all look like cryptographic tests to me. Can you open a ticket? Then I'll get one of the cryptographers to triage it, and make sure we're not duplicating that work. |
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.
We could merge this code as-is.
But we might want to change the validation function arguments so they will work for V5 transactions.
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.
We need to rebase on main, and use the shared runtime.
Move the code to verify Sapling shielded data into a new helper method that returns `AsyncChecks`.
841f070
to
0f0d40f
Compare
Use the test vectors to find a transaction that has Sapling spends and test if it the verifier considers it valid.
Transforms the block test vectors into a list of transactions and block heights for each transaction.
Also use the block height for that transaction as specified in the test vector.
Find a transaction V4 vector that has Sapling outputs but no spends, and check that the verifier accepts it.
0f0d40f
to
ec8e9bc
Compare
Done: #2426. |
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.
It passes
Motivation
As part of NU5, there is a new transaction format and consensus rules (version 5). Zebra already had initial support for the new transaction, but the consensus rules aren't fully implemented. In order to properly validate the new transaction version, some validation code related to Sapling shielded data will be shared between V4 and V5 transactions, so this PRs refactors it to prepare for code sharing.
This is the fourth PR that's part of #1981.
Specifications
The new transaction encoding and consensus rules are detailed in the specification.
Designs
Solution
A new
verify_sapling_shielded_data
method is created by this PR, and theverify_v4_transaction
uses it.Two tests were also added. Both test if transactions from the test vectors are accepted by the verifier.
These tests might need some sort of fix or workaround for the shared batch verifier worker task issue (#2390). If the CI fails with a
Closed
error message, then it is likely the same cause. Can #2397 be merged as a temporary solution?Review
@teor2345
Reviewer Checklist
Follow Up Work
proptest-impl
feature into something clearer (Renameproptest-impl
feature #2424).transaction::Verifier
rejection tests for Sapling #2426).