-
Notifications
You must be signed in to change notification settings - Fork 36.5k
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
Bury bip9 deployments #16060
Bury bip9 deployments #16060
Conversation
Concept ACK |
Concept ACK |
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
8fcba73
to
152af4d
Compare
Force-pushed to fix some minor issues from rebasing.
All three commits change the output of |
Concept ACK |
152af4d
to
f395b23
Compare
Thanks for the review @PastaPastaPasta . I've fixed your two comments. |
@@ -69,6 +69,8 @@ class CMainParams : public CChainParams { | |||
consensus.BIP34Hash = uint256S("0x000000000000024b89b42a942fe0d9fea3bb44ab7bd1b19115dd6a759c0808b8"); | |||
consensus.BIP65Height = 388381; // 000000000000000004c2b624ed5d7756c508d90fd0da2c7c679febfa6c4735f0 | |||
consensus.BIP66Height = 363725; // 00000000000000000379eaa19dce8c9b722d46ae6a57c2f1a988119488b50931 | |||
consensus.CSVHeight = 419328; // 000000000000000004a1b34462cb8aeebd5799177f7a29cf28f2d1961716b5b5 | |||
consensus.SegwitHeight = 481824; // 0000000000000000001c8018d9cb3b742ef25114f27563e3fc4a1902167f9893 |
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.
Checked blockhashes against bock chain, and checked the activation heights against getblockchaininfo
that they match since
"bip9_softforks": {
"csv": {
"status": "active",
"startTime": 1462060800,
"timeout": 1493596800,
"since": 419328
},
"segwit": {
"status": "active",
"startTime": 1479168000,
"timeout": 1510704000,
"since": 481824
}
},
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.
It's slightly inconsistent how all of these (BIP34, BIP65, BIP66) are BIPxx and the new ones are written out as name. I don't personally mind, to be honest, I even think this is clearer than having numbers.
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.
Neither the CSV nor segwit softforks were specified by a single BIP. CSV was BIPs 68, 112, and 113 and segwit was BIPs 141, 143, and 147. We could go back and give BIP34, BIP65 and BIP66 'descriptive' names, but I think that's an unnecessary breaking change.
" }, ...\n" | ||
" ],\n" | ||
" \"bip9_softforks\": { (object) status of BIP9 softforks in progress\n" | ||
" \"softforks\": { (object) status of softforks\n" |
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 like making this a object indexed by name, makes it easier to look one up in languages that treat them as dictionaries.
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.
Agree, but this is a breaking change, seems unnecessary.
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 like making this a object indexed by name, makes it easier to look one up in languages that treat them as dictionaries.
For the benefit of other reviewers - that's what this PR does already.
this is a breaking change, seems unnecessary
I doubt that there are many clients programmatically querying this, since the value never changes once it's locked in. After this PR, there don't need to be further breaking changes, since the new softfork
object is able to hold both bip9 and buried fork details (or any other potential activation method types).
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.
We are on the same page then, but for the sake of complaints, just add a small release note? @MarcoFalke also asked it above.
src/validation.cpp
Outdated
LOCK(cs_main); | ||
return (VersionBitsState(pindexPrev, params, Consensus::DEPLOYMENT_SEGWIT, versionbitscache) == ThresholdState::ACTIVE); | ||
int height = pindexPrev == nullptr ? 0 : pindexPrev->nHeight + 1; | ||
return (height >= params.SegwitHeight); | ||
} | ||
|
||
bool IsNullDummyEnabled(const CBlockIndex* pindexPrev, const Consensus::Params& params) | ||
{ | ||
LOCK(cs_main); |
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.
Can this LOCK(cs_main) be removed just like the one in IsWitnessEnabled was? If it shouldn't be, the reason would be unintuitive, so could you leave a comment why it is still needed/desirable in that case?
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.
Yes, it can. In fact, this function is only called from within GetBlockScriptFlags()
, which holds cs_main
. After this PR, this is now a simple one-line check, so I've removed the function and placed the conditional directly into GetBlockScriptFlags()
.
{ | ||
if (gArgs.IsArgSet("-segwitheight")) { |
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.
It would be nicer to do something more generic that works for other deployments, not just segwit. For example, if anybody was relying on vparams to test csv activation, it won't be possible after this PR.
But perhaps this is out of the scope for this PR,
With something like #8994 we could simply make the all the buried heights configurable for custom regtests.
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.
Perhaps we can call the argument "-con_segwitheight" like in #8994 ?
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.
This argument is just for testing, so it's not disruptive to change this in future if we think the -con_xxx
naming scheme is better. For now, I'd like to keep this as it is, rather than optimizing for a PR that hasn't been merged yet.
I didn't check the actual activation heights, but beyond that and my small nit, utACK f395b23 |
Concept ACK |
I've looked through the history of the 3 PRs trying to get this change merged, and there is widespread support for it, but we need to get it to the finish line! Now that it has been added to the high priority list, would one or two of the following folks be able to review this in the next week or so? @sdaftuar @TheBlueMatt @sipa @jl2012 🙏 |
just noting there is a competing proposal at #16229 |
Why are there competing proposals? Is there a comparison sometimes of the pros/cons of either approach? |
f395b23
to
d251466
Compare
This needs release notes if it reaches a stage where it's ready for merge. |
The propsals take different approaches: this one (#16060) changes segwit/csv from bip9 deployments to be hardcoded fixed height deployments; the other one (#16229) generalises bip9 deployments to also support fixed height deployments, and converts strictder and cltv into this generalised deployment method and updates segwit/csv to be fixed height rather than bip9 based. I think the benefits of hardcoded fixed height stuff is that it's a bit more efficient (the height's hardcoded and every codepath knows the height is hardcoded), while the cost is that anytime you change a bip9 deployment to a fixed height deployment you have to change the code in a few places. Doing it this way also means you can't have tests that want to control how the forks activated, which results in substantive changes to the test suite when burying a deployment. The cost of the generalised approach is that you can't assume that the deployments are just activated at a particular height, which slows mainnet handling of the deployments down for (at most) a benefit in regtest. I think this slowdown is pretty trivial, but haven't benchmarked it. The benefits (I think) are that it means we can bury BIP9 deployments in future just by changing the declaration in chainparams.cpp, with tests generally continuing to work unchanged, and no code changes needed for getblockchaininfo or in checking when the soft-fork is enabled. This approach can also be done with minimal changes to getblockchaininfo output if we thought that was a benefit. |
Hard code CSV deployment height to 419328 for mainnet.
Hardcode segwit deployment height to 481824 for mainnet.
dbe75a0
to
e78aaf4
Compare
Thanks for the review @ariard - I've addressed your comments. |
ACK e78aaf4 ; checked diff to previous acked commit, checked tests still work |
ACK e78aaf4, check diff, run the tests again and successfully activated csv/segwit heights on mainnet as expected. |
ACK e78aaf4 (still didn't check if the mainnet block heights are correct, but the code looks good now) Show signature and timestampSignature:
Timestamp of file with hash |
e78aaf4 [docs] Add release notes for burying bip 9 soft fork deployments (John Newbery) 8319e73 [tests] Add coverage for the content of getblockchaininfo.softforks (James O'Beirne) 0328dcd [Consensus] Bury segwit deployment (John Newbery) 1c93b9b [Consensus] Bury CSV deployment height (John Newbery) 3862e47 [rpc] Tidy up reporting of buried and ongoing softforks (John Newbery) Pull request description: This hardcodes CSV and segwit activation heights, similar to the BIP 90 buried deployments for BIPs 34, 65 and 66. CSV and segwit have been active for over 18 months. Hardcoding the activation height is a code simplification, makes it easier to understand segwit activation status, and reduces technical debt. This was originally attempted by jl2012 in #11398 and again by me in #12360. ACKs for top commit: ajtowns: ACK e78aaf4 ; checked diff to previous acked commit, checked tests still work ariard: ACK e78aaf4, check diff, run the tests again and successfully activated csv/segwit heights on mainnet as expected. MarcoFalke: ACK e78aaf4 (still didn't check if the mainnet block heights are correct, but the code looks good now) Tree-SHA512: 7e951829106e21a81725f7d3e236eddbb59349189740907bb47e33f5dbf95c43753ac1231f47ae7bee85c8c81b2146afcdfdc11deb1503947f23093a9c399912
Unify our own height-based activation of Segwit and CSV (previously together with BIP16) with the upstream change bitcoin/bitcoin#16060. Also includes some basic fixes to stuff in the diff of bitcoin..auxpow that is not needed (anymore) and has been forgotten to be cleaned up.
60e855f doc: Bump version in bips.md, mention bumping in release process (Wladimir J. van der Laan) 82c1177 doc: Add mention of BIP158 indexing since v0.19.0 (Wladimir J. van der Laan) 2267006 doc: Add mention of BIP125 used by wallet GUI by default since v0.18.1 (Wladimir J. van der Laan) b11514d doc: Add mention of BIP70 disabling by default in bips.md (Wladimir J. van der Laan) Pull request description: - Add mention of BIP70 disabling by default at build time. Any others? E.g. does the burying of deployments of #16060 need to be mentioned? If so, where and how? For all of BIPs 34, 65 and 66? ACKs for top commit: hebasto: ACK 60e855f Tree-SHA512: 76aac3118bb9b56eeea75d046a55d8678a4c5c43004bec98a653f285ef59c34e67af01b0af3ddcefe4e92d37eea89f4f6627e4d056194f54e2e6168c79b4865c
60e855f doc: Bump version in bips.md, mention bumping in release process (Wladimir J. van der Laan) 82c1177 doc: Add mention of BIP158 indexing since v0.19.0 (Wladimir J. van der Laan) 2267006 doc: Add mention of BIP125 used by wallet GUI by default since v0.18.1 (Wladimir J. van der Laan) b11514d doc: Add mention of BIP70 disabling by default in bips.md (Wladimir J. van der Laan) Pull request description: - Add mention of BIP70 disabling by default at build time. Any others? E.g. does the burying of deployments of bitcoin#16060 need to be mentioned? If so, where and how? For all of BIPs 34, 65 and 66? ACKs for top commit: hebasto: ACK 60e855f Tree-SHA512: 76aac3118bb9b56eeea75d046a55d8678a4c5c43004bec98a653f285ef59c34e67af01b0af3ddcefe4e92d37eea89f4f6627e4d056194f54e2e6168c79b4865c
412d5fe QA: feature_segwit: Check that template "rules" includes "!segwit" as appropriate (Luke Dashjr) 2abe8cc Bugfix: Include "csv","!segwit" in "rules" (Luke Dashjr) Pull request description: #16060 removed CSV & segwit from versionbits, breaking the "rules" key returned by GBT. Without this, miners don't know they're mining segwit blocks, and should fall back to pre-segwit block creation. ACKs for top commit: sipa: ACK 412d5fe jnewbery: Tested ACK 412d5fe. Tree-SHA512: 825d72e257dc0dd4941f2fe498d8d4f4f2a21b9505cd21a8f9eb7fb5d6d7dd9219347928cf90bb57a777920ce24295859763e64fa8a22ebb58fc2380f80f5615
412d5fe QA: feature_segwit: Check that template "rules" includes "!segwit" as appropriate (Luke Dashjr) 2abe8cc Bugfix: Include "csv","!segwit" in "rules" (Luke Dashjr) Pull request description: bitcoin#16060 removed CSV & segwit from versionbits, breaking the "rules" key returned by GBT. Without this, miners don't know they're mining segwit blocks, and should fall back to pre-segwit block creation. ACKs for top commit: sipa: ACK 412d5fe jnewbery: Tested ACK 412d5fe. Tree-SHA512: 825d72e257dc0dd4941f2fe498d8d4f4f2a21b9505cd21a8f9eb7fb5d6d7dd9219347928cf90bb57a777920ce24295859763e64fa8a22ebb58fc2380f80f5615
60e855f doc: Bump version in bips.md, mention bumping in release process (Wladimir J. van der Laan) 82c1177 doc: Add mention of BIP158 indexing since v0.19.0 (Wladimir J. van der Laan) 2267006 doc: Add mention of BIP125 used by wallet GUI by default since v0.18.1 (Wladimir J. van der Laan) b11514d doc: Add mention of BIP70 disabling by default in bips.md (Wladimir J. van der Laan) Pull request description: - Add mention of BIP70 disabling by default at build time. Any others? E.g. does the burying of deployments of bitcoin#16060 need to be mentioned? If so, where and how? For all of BIPs 34, 65 and 66? ACKs for top commit: hebasto: ACK 60e855f Tree-SHA512: 76aac3118bb9b56eeea75d046a55d8678a4c5c43004bec98a653f285ef59c34e67af01b0af3ddcefe4e92d37eea89f4f6627e4d056194f54e2e6168c79b4865c
This hardcodes CSV and segwit activation heights, similar to the BIP 90 buried deployments for BIPs 34, 65 and 66.
CSV and segwit have been active for over 18 months. Hardcoding the activation height is a code simplification, makes it easier to understand segwit activation status, and reduces technical debt.
This was originally attempted by jl2012 in #11398 and again by me in #12360.