-
Notifications
You must be signed in to change notification settings - Fork 117
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
Further test new transaction consensus rules #2246
Further test new transaction consensus rules #2246
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.
Should the PR include some extra tests for the V4 rules applied to V5 transactions?
Should there be tests for V4 transactions?
What would be useful to have as a proptest? (Should some of these test vectors become proptests?)
This seems like enough tests for now - I'd rather focus on fixes to the network stack, and implementing more NU5 consensus rules.
Similar to the `vec!` macro, but doesn't allow creating an empty list.
Create a dummy transaction with no inputs and no outputs, and add a dummy Orchard action to it. The `check::has_inputs_and_outputs` should succeed, because the consensus rule considers having Orchard actions as having inputs and/or outputs.
Move the code to create a fake Orchard shielded data instance to a helper function in `zebra_chain::transaction::arbitrary`, so that other tests can also use it.
A V5 coinbase transaction that has Orchard shielded data MUST NOT have the enable spends flag set.
A coinbase transaction with Orchard shielded data and without the enable spends flag set should be valid.
Co-authored-by: teor <[email protected]>
6e87237
to
665c84e
Compare
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.
Updated.
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 add a comment about the security implications of the at_least_one
macro, then merge.
Motivation
Some recent PRs (#2229 and #2236) added some new V5 transaction consensus rules. However, they weren't thoroughly tested.
Solution
This PR adds three new test vectors:
check::has_inputs_and_outputs
with a transaction that has Orchard actionscheck::coinbase_tx_no_prevout_joinsplit_spend
with:enableSpendsOrchard
flag setenableSpendsOrchard
flag not setFor the implementation of these tests, a helper function was implemented (
insert_dummy_orchard_shielded_data
) that changes a V5 transaction to include a dummy instance oforchard::ShieldedData
. A mutable reference to the shielded data is returned in case the test wants to customize the data.The PR also includes an
at_least_one!
helper macro, that is usable for tests.The code in this pull request has:
Open questions
Review
Anyone can review this low priority PR.
Related Issues
Part of #1980
Follow Up Work