fix(utxo-lib): update zcash NU5_BRANCH_ID#2259
Conversation
c0903ad to
37bfff3
Compare
195cde9 to
d7f735a
Compare
Codecov Report
@@ Coverage Diff @@
## master #2259 +/- ##
===========================================
+ Coverage 0 52.61% +52.61%
===========================================
Files 0 6 +6
Lines 0 574 +574
Branches 0 94 +94
===========================================
+ Hits 0 302 +302
- Misses 0 262 +262
- Partials 0 10 +10
Flags with carried forward coverage won't be shown. Click here to find out more.
|
brandonblack
left a comment
There was a problem hiding this comment.
Code changes look good to me, but I admit I don't fully understand the sequence of changes needed to stay in sync with ZCash.
See zcash/zcash@77a971f Use v4.7.0 as zcash reference node. BREAKING CHANGE: signature validity of certain zcash transaction is changed Issue: BG-47967
Unsurprisingly we have a lot of circular dependencies, which means that certain constructors are not available at module init time (On my system it was Avax, Sol and some others). This change defers the initialization of the "constructor map" to the time it is actually needed (the first `getInstance()` call) Issue: BG-47967
Reflects consensusBranchId changes Issue: BG-47967
d7f735a to
68c615f
Compare
| const OVERWINTER_BRANCH_ID = 0x5ba81b19; | ||
| const CANOPY_BRANCH_ID = 0xe9ff75a6; | ||
| const NU5_BRANCH_ID = 0x37519621; | ||
| const NU5_BRANCH_ID = 0xc2d6d0b4; |
There was a problem hiding this comment.
So this changed between releases? Kind of weird to change constants like this.
There was a problem hiding this comment.
The reason this constant changed is documented in ZIP 200:
The relationship between
CONSENSUS_BRANCH_IDandACTIVATION_HEIGHTis many-to-one: it is possible for many distinct consensus branches to descend from the same parent block (and thus have the sameACTIVATION_HEIGHT), but a specific consensus branch can only have one parent block. Concretely, this means that if theACTIVATION_HEIGHTof a network upgrade is changed for any reason (e.g. security vulnerabilities or consensus bugs are discovered), theCONSENSUS_BRANCH_IDMUST also be changed.
The consensus rules were altered between 4.5.1 and 4.7.0, which required changing the activation height of NU5 on testnet, which therefore required changing the consensus branch ID. More generally, a consensus branch ID refers to a specific set of consensus rules; any change to that set requires a change to the consensus branch ID.
See zcash/zcash@77a971f
Use v4.7.0 as zcash reference node.
Issue: BG-47967 BREAKING CHANGE: signature validity of certain zcash
transaction is changed
6a161f2
chore(utxo-lib): add prettierignore, apply prettier
Issue: BG-47967