-
Notifications
You must be signed in to change notification settings - Fork 120
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
Add Genesis NU, Update Canopy NU Testnet Height #765
Conversation
We can use this network upgrade to implement different consensus rules and chain context handling for genesis blocks. Part of the chain state design in ZcashFoundation#682.
See ZIP 251 and zcash/zips#385 for details. Closes ZcashFoundation#756.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
e0b09a2
to
56b4dff
Compare
/// | ||
/// Zcash genesis blocks use a different set of consensus rules from | ||
/// other BeforeOverwinter blocks, so we treat them like a separate network | ||
/// upgrade. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm skeptical of the complexity trade-off here. There are only a small number of things that differ for the genesis block:
- the height-in-coinbase was missing (this was just a bug);
- there is no Founders' Reward output in the coinbase tx;
- the
hashPrevBlock
, difficulty adjustment, and median-time-past rules are special-cased.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, good point. I'm not sure how we'll use the NetworkUpgrades
enum yet.
But depending on the outcome of the parallel verification RFC in #763, we might have some additional Zebra special cases:
- there are no VerificationConstraints, because the genesis block is the first block (except, perhaps, that the genesis block is the first block to be committed to the state)
- There is no previous verification context
- the on-disk verification state is empty
- the verification context and on-disk state need to be initialised with empty values
- the verification context needs to be updated with the values from the genesis block, based on genesis-specific rules
- there are no chain tips in memory or on disk - the genesis block automatically becomes the first tip
I think a lot of these special cases are covered by checkpoint verification, but we'll definitely need special handling for the on-disk state.
I'll review the need for the Genesis
network upgrade after the RFC.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it still makes sense to have a distinct Genesis
variant, because (unfortunately) the rules are actually different. Downstream code for whom this distinction doesn't matter can combine arms of a match statement, but not making the distinction at all means that we can't handle the differences in the rules in a principled way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just wanted to make sure you'd thought about the complexity tradeoffs — sounds like you have.
Genesis
network upgrade, to handle genesis-specific consensus rulesCanopy
network upgradeThese changes modify the same table, so I put them in the same PR.
Removed:
Add aTestnetMinimumDifficulty
network upgrade, to handle testnet-specific difficulty rule changes