-
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
Redesign Transaction V5 serialization, impl trusted vector security, nullifier utility functions #1996
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.
I think we need to go back to the design stage with transaction v5 serialisation, because the spends and outputs are split into multiple arrays during serialisation.
Implement serialization for V4 and V5 spends and outputs, to make sure that the design works.
Also add a few missing v4 tests.
Redesign Transaction V5 serialization
@@ -311,7 +325,7 @@ impl ZcashDeserialize for Transaction { | |||
joinsplit_data, | |||
}) | |||
} | |||
(5, false) => { | |||
(5, true) => { |
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.
Nice catch here by the way 👍
I am happy with the current PR, waiting on @dconnolly to review
And add a missing serialized type.
And link to the spec
shared_anchor: AnchorV::Shared, | ||
// The following fields are in a different order to the serialized data, see: | ||
// https://zips.z.cash/protocol/nu5.pdf#txnencodingandconsensus | ||
first: Either<Spend<AnchorV>, Output>, |
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.
The anchor field is only present when nSpendsSapling > 0
:
shared_anchor: AnchorV::Shared, | |
// The following fields are in a different order to the serialized data, see: | |
// https://zips.z.cash/protocol/nu5.pdf#txnencodingandconsensus | |
first: Either<Spend<AnchorV>, Output>, | |
// The following fields are in a different order to the serialized data, see: | |
// https://zips.z.cash/protocol/nu5.pdf#txnencodingandconsensus | |
first: Either<(Spend<AnchorV>, AnchorV::Shared), Output>, |
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've got 2 open PRs that depend on this PR, and we want to open 2 more, so we're just going to merge it.
Motivation
It's easy to accidentally serialize V5 transaction fields in the wrong order. So we should go back to the design stage for V5 transaction serialization.
Solution
Design
Output
s in the V4 format in V5 transactions, add a wrapper type, and move the serialization impls to that typeCode
Security
The code in this pull request has:
Review
Related Issues
Follow Up Work
Implement V5 shielded data serialization - #1829