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

Don't consider the "grace period" when decrypting coinbase outputs #3027

Closed
conradoplg opened this issue Nov 5, 2021 · 2 comments
Closed
Labels
C-enhancement Category: This is an improvement

Comments

@conradoplg
Copy link
Collaborator

conradoplg commented Nov 5, 2021

Motivation

ZIP-212 specifies that coinbase transaction with Sapling or Orchard outputs must be decryptable with an all-zero outgoing viewing key, and that

[Canopy onward] Any Sapling or Orchard output of a coinbase transaction decrypted to a note plaintext
according to the preceding rule MUST have note plaintext lead byte equal to 0x02 . (This applies even during
the “grace period” specified in [ZIP-212].)

We'll use librustzcash to implement the decryption in #2362. However, it always allows the "grace period" (some 30K blocks after Canopy activation where the lead byte can be 0x01) and there currently isn't a way to work around that with librustzcash as is.

Work around the issue, either by

  • Waiting librustzcash to support it
  • Changing librustzcash to support it
  • Waiting for our own implementation of the decryption and implementing it there

Since the grace period has long passed, this doesn't seem to be urgent (maybe not even necessary?), but I'm not completely sure.

Specifications

[Heartwood onward] All Sapling and Orchard outputs in coinbase transactions MUST decrypt to a note
plaintext , i.e. the procedure in § 4.19.3 ‘Decryption using a Full Viewing Key ( Sapling and Orchard )’ on p. 67
does not return ⊥, using a sequence of 32 zero bytes as the outgoing viewing key . (This implies that before
Canopy activation, Sapling outputs of a coinbase transaction MUST have note plaintext lead byte equal to
0x01 .)

[Canopy onward] Any Sapling or Orchard output of a coinbase transaction decrypted to a note plaintext
according to the preceding rule MUST have note plaintext lead byte equal to 0x02 . (This applies even during
the “grace period” specified in [ZIP-212].)

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

Alternatives

  1. Modify the librustzcash API
  2. Set the mandatory Zebra checkpoint after the grace period
  3. Document that Zebra will continue to follow the correct chain due to proof of work (is this ok?)

Related Work

@conradoplg conradoplg added C-enhancement Category: This is an improvement S-needs-triage Status: A bug report needs triage labels Nov 5, 2021
@mpguerra mpguerra added the P-Low label Nov 23, 2021
@teor2345
Copy link
Contributor

The fastest way to fix this issue would be to set the mandatory Zebra checkpoint after the grace period. That way, we never use the incorrect consensus rules from librustzcash.

@teor2345
Copy link
Contributor

teor2345 commented Jan 6, 2022

This issue will be resolved by the mandatory checkpoint changes in #2368.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: This is an improvement
Projects
None yet
Development

No branches or pull requests

3 participants