-
Notifications
You must be signed in to change notification settings - Fork 108
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
Add V5 transparent and sapling to transaction::check, add missing coinbase PrevOut check #2070
Conversation
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, I'll just push a quick commit that tweaks the dependencies and removes some duplicate code.
We only need itertools when the `proptest-impl` feature is enabled.
I pushed a fix that makes the |
…inputs This is a bugfix on V4 transaction validation. The PrevOut consensus rule was not explicitly stated in the Zcash spec until April 2021. (But it was implied by Bitcoin, and partially implemented by Zebra.) Also do the shielded sapling input check for V5 transactions.
Also make the variable names match the spec.
Move counts or iterators into `Transaction` methods, so we can remove duplicate code, and make the consensus rule logic clearer.
I added PRs in your repository with spec updates and refactors:
Here's what was missing from the PR:
While I was changing that code, I also:
|
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.
- Quote from the spec - Explain why the function is redunant for v5 - Rename the function so it's clear that it is sapling-specific
Update sapling_balances_match for Transaction v5
Simplify transaction checks, add missing coinbase PrevOut check
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, now we just need to do the rest of #1981.
But this PR is a good size to merge.
Motivation
We need some tests in the consensus side for the new sapling data in V5 transactions.
Solution
Add a test that converts the transactions from all test blocks we have(real past blocks from testnet and mainnet) into V5 transactions and validate them.
Also this PR moves the utility functions needed for the transaction conversion so they can be used by
zebra-chain
andzebra-consensus
crates.Update the "check" functions for transaction v5, and simplify.
Add the missing "no transparent inputs with prevouts" coinbase check.
Simplify a bunch of the transaction checks, so the consensus rules are easier to review.
The code in this pull request has:
Review
Related Issues
Implement Transparent and Sapling validation for transaction v5 #1981 - "check" part
Hard-coded sapling-only transaction v5 test vectors #2047
Follow Up Work
Implement Transparent and Sapling validation for transaction v5 #1981 - transaction verifier part