zebra
zebra copied to clipboard
change(consensus): Allow configurable Nu5 activation height on Regtest
Motivation
We want to allow configuring an NU5 activation height on Regtest. This was removed in a recent PR because I thought Zebra didn't support Canopy block construction, it does, it was the proposal_block_from_template()
function used in tests and the internal-miner that only worked with NU5.
PR Author Checklist
Check before marking the PR as ready for review:
- [x] Will the PR name make sense to users?
- [x] Does the PR have a priority label?
- [x] Have you added or updated tests?
- [x] Is the documentation up to date?
For significant changes:
- [x] Is there a summary in the CHANGELOG?
- [x] Can these changes be split into multiple PRs?
If a checkbox isn't relevant to the PR, mark it as done.
Solution
- Accept a
current_network_upgrade
argument inproposal_block_from_template()
- Select which field from the template should be used in the block based on the current network upgrade
- Use the
testnet_parameters.activation_heights.nu5
field as the NU5 activation height on Regtest
Related Changes:
- Updates
with_activation_heights()
to overwrite activation heights for all network upgrades except Genesis
Testing
The regtest_submit_blocks()
test was updated to submit Canopy blocks and switch to NU5 blocks at height 100
Review
Anyone can review.
Reviewer Checklist
Check before approving the PR:
- [ ] Does the PR scope match the ticket?
- [ ] Are there enough tests to make sure it works? Do the tests cover the PR motivation?
- [ ] Are all the PR blockers dealt with? PR blockers can be dealt with in new tickets or PRs.
And check the PR Author checklist is complete.