-
Notifications
You must be signed in to change notification settings - Fork 158
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
Fix specification of genesis coinbase height #540
Comments
I don't think there is a spec bug here. The genesis block (at height 0 of any chain) is explicitly excluded from coinbase height checks in section 7.1.2 of the protocol spec: and in section 7.12: Thanks for pointing out the potential ambiguity at height 520617983, but I think this is resolved by just not trying to parse the coinbase data at height 0. (The spec doesn't claim that you can!) |
How can implementations distinguish between a genesis block, and a block at height Or alternately, how can implementations calculate or verify the height of a genesis block? Edit: If Zcash chooses not to specify how to identify genesis blocks, that's ok. Zebra can just keep checking the entire genesis coinbase data. And assuming that the far future block at height |
I think the assumption is that the genesis block for a given chain is baked-in, so you never need to get it from other nodes. In particular you know the hash of the genesis block, so you could filter it out if another node did send it to you. Also the genesis block has an all-zeros |
Zebra checks the genesis previous block hash and also the genesis block hash. But we don't have that information available during coinbase height parsing. So for now, we'll just check the coinbase data during height parsing. |
I'm a little confused as to why you don't have the block header, since you need |
It's just not passed to the method that does the parsing, because of how our serialization is implemented. |
Recently, we updated the spec with the coinbase height encodings for:
0x50
+ heightHowever, the genesis block does not use either of these encoding schemes. And it starts with a
0x04
byte, which is a valid length under the "other heights" encoding scheme. (The first1+4
bytes correspond to height520,617,983
under that scheme.)So it's not actually possible to specify an unambiguous encoding for the genesis coinbase data. 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 the transaction version. (Or any fields that depend on that version, or the new NU5 coinbase expiry height rule.)The exact genesis coinbase data is:
https://github.com/ZcashFoundation/zebra/blob/24bf952e982bde28eb384b211659159d46150f63/zebra-chain/src/transparent/serialize.rs#L20-L25
The text was updated successfully, but these errors were encountered: