Add semantic block validation during the ZIP-212 grace period after Canopy activation
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
0x01as well as0x02during the ZIP-212 grace period - Ensure that Zebra will only validate transactions with note plaintexts that have lead bytes of
0x02after the ZIP-212 grace period
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:
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
depends-on: #8540