Stop parsing a block height from the genesis block coinbase data #3118
Labels
A-consensus
Area: Consensus rule updates
C-bug
Category: This is a bug
C-security
Category: Security issues
I-consensus
Zebra breaks a Zcash consensus rule
Motivation
Zebra parses the genesis block coinbase data as a coinbase height, but that's not permitted by the spec.
The genesis block coinbase data starts with a 0x04 byte, which is also valid under the "other heights" encoding scheme in the spec. (The first 1+4 bytes correspond to height 520,617,983 under that scheme.) So it's not actually possible to specify an unambiguous encoding for the genesis coinbase data. Because a miner could theoretically insert the exact same coinbase data at block height 520,617,983.
However, the genesis and 520,617,983 coinbase transactions can be distinguished by:
See zcash/zips#540 for some background to the spec, and Zebra's current behaviour.
Scheduling
This fix isn't required for the stable release. We should review the risks as part of the lightwalletd work.
This rule won't actually matter for 1000 years, and we already check the genesis block hash right after downloading (before parsing its height).
Zebra also rejects blocks that are too high after downloading and parsing the height, but before sending them to the verifier. So this issue can't cause any verifier bugs.
Specifications
https://zips.z.cash/protocol/protocol.pdf#txnconsensus
Suggested Solution
Rejected Solutions
Pass the transaction version to the coinbase height parser. Rejected because it's more complicated.
After NU5 or for v5 coinbase transactions, use the coinbase transaction expiry height. For earlier blocks, parse the coinbase height in the script. Rejected because it is hard to identify NU5 blocks using the block header or transaction data, and coinbase transactions could be v4 transactions.
Use the block header hash instead of the previous block hash. Rejected because it is more expensive to calculate the hash.
Related Work
The text was updated successfully, but these errors were encountered: