Skip to content
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

validate orchard flags in v5 #3035

Merged
merged 2 commits into from
Nov 8, 2021
Merged

Conversation

oxarbitrage
Copy link
Contributor

Motivation

We need to make sure at least one flag is set in transactions version 5 when the number of actions is at least one. Attempts to close #2433

Specifications

[NU5 onward] If effectiveVersion >= 5 and nActionsOrchard > 0, then at least one of enableSpendsOrchard and enableOutputsOrchard MUST be 1.

https://zips.z.cash/protocol/protocol.pdf#txnconsensus

Solution

Create a new has_enough_orchard_flags() method and call it from the transaction verification. Performance wise i think there is maybe some overlap between this new method and has_inputs_and_outputs() but i hope that is minimal.

Review

Anyone cvan review but will be good if @teor2345 can take a look.

Reviewer Checklist

  • Code implements Specs and Designs
  • Tests for Expected Behaviour
  • Tests for Errors

Copy link
Contributor

@teor2345 teor2345 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@teor2345 teor2345 enabled auto-merge (squash) November 8, 2021 20:55
@teor2345 teor2345 merged commit f7c1907 into ZcashFoundation:main Nov 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Check that at least one of enableSpendsOrchard or enableOutputsOrchard is set
2 participants