zebra icon indicating copy to clipboard operation
zebra copied to clipboard

Add semantic block validation during the ZIP-212 grace period after Canopy activation

Open arya2 opened this issue 1 year ago • 3 comments

Motivation

We want to fully validate Canopy blocks and abide by the ZIP-212 grace period where note plaintext lead bytes are allowed to be either 0x01 or 0x02 so that Regtest is as close to the Mainnet consensus rules as possible. Prior to Canopy activation those lead bytes must be 0x01, and after the grace period, they must be 0x02.

This rule only applies to nodes and not wallets, and librustzcash may only allow for lead bytes of 0x02 after Canopy activation, so Zebra is currently mandating checkpoint validation until the end of the ZIP-212 grace period.

Possible Design

The grace period after Canopy should only apply until the next network upgrade (NU5) is activated, so it should be the lesser of Canopy Activation Height + ZIP_212_DURATION or NU5 Activation Height

Testing

  • Ensure that Zebra can validate transactions with note plaintexts that have lead bytes of 0x01 as well as 0x02 during the ZIP-212 grace period
  • Ensure that Zebra will only validate transactions with note plaintexts that have lead bytes of 0x02 after the ZIP-212 grace period

arya2 avatar Apr 23 '24 16:04 arya2

Both the latest version of zcash_primitives and the version Zebra currently uses (0.13.0) allow for plaintext lead bytes of 0x01 or 0x02 during the grace period, see:

arya2 avatar May 01 '24 02:05 arya2

Let's wait until Zebra is using zcash_primitives v0.14.0 and then pass Zip212Enforcement::On in the call to try_sapling_note_decryption() in zcash_note_encryption

arya2 avatar May 03 '24 18:05 arya2

depends-on: #8540

mpguerra avatar May 16 '24 10:05 mpguerra