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
Ignore old versionbit activations to avoid 'unknown softforks' warning #16713
Ignore old versionbit activations to avoid 'unknown softforks' warning #16713
Conversation
Alternative to #16704 |
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsNo conflicts as of last run. |
94c75dd
to
85fff24
Compare
Adds a hardcoded height to the consensus chain parameters for ignoring versionbit activations prior to a fixed height.
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.
Concept ACK, but I'd prefer if the correct times were used: https://github.com/bitcoin/bips/blob/master/bip-0009/assignments.mediawiki
src/chainparams.cpp
Outdated
@@ -188,6 +196,14 @@ class CTestNetParams : public CChainParams { | |||
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 1199145601; // January 1, 2008 | |||
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = 1230767999; // December 31, 2008 | |||
|
|||
// CSV and Segwit versionbits parameters required to prevent soft fork warnings | |||
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].bit = 0; | |||
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nStartTime = 1462060800; // May 1st, 2016 |
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 started in march, no?
85fff24
to
fdb3e8f
Compare
I've updated this PR to take @ajtowns branch that changes the height at which we start looking for unknown softforks. |
ACK fdb3e8f Show signature and timestampSignature:
Timestamp of file with hash |
ACK fdb3e8f for what it's worth |
ACK fdb3e8f Code looks good to me. Also tested that the warning is longer being shown. |
Conceptually, shouldn't a minimum warning height be chain dependent? Not just mainnet vs testnet vs regtest, but also which mainnet chain you're on? |
@sdaftuar Why would that be? A reorg that changes the block at |
Well, a node doing IBD and being fed an alternate/bogus chain should probably sound as many alarms as it can... But my concern here is that we're changing utility code (in If others disagree with my assessment, then maybe this approach is fine, but just thought I should mention that this design looks off to me. |
We could add a warning if our chain doesn't contain
|
I think I'm a -0 on this; imo this makes the code a bit harder to reason about, rather than easier to reason about, but I can also see why others disagree. |
This has 2-4 ACKS (unsure how to count), is consistent with the concept of burying, and is easier to review than previous attempts at fixing the 0.19 regression. I think this is good to go in as is, but I am also happy to chat about in in the IRC meeting this week |
Only other simple approach I can see would be to move the holistic info directly into ComputeBlockVersion -- maybe have it return 0x2fff_ffff (signal all the version bits) if it's asked for a version for blocks before the threshold height? Alternatively could do this now and clean it up more in 0.20 -- there's other versionbits cleanups I'd like to do fwiw. |
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.
ACK fdb3e8f
Reviewed code, built/ran tests, verified the "Warning: unknown new rules activated (versionbit 1)" warning in validation.cpp::L2183 is no longer displayed.
The approach seems straightforward and minimal. One with better separation of concerns could be studied as a follow-up.
Threw some LogPrintfs into WarningBitsConditionChecker as a sanity check for the values it sees. bool Condition(const CBlockIndex* pindex, const Consensus::Params& params) const override
{
LogPrintf("SegwitHeight %s\n", params.SegwitHeight);
LogPrintf("nMinerConfirmationWindow %s\n", params.nMinerConfirmationWindow);
LogPrintf("MinBIPWarningHeight %s\n", params.MinBIP9WarningHeight);
LogPrintf("pindex->nHeight %s\n", pindex->nHeight);
LogPrintf("pindex->nVersion %s\n", pindex->nVersion);
LogPrintf("ComputeBlockVersion %s\n", ComputeBlockVersion(pindex->pprev, params));
return pindex->nHeight >= params.MinBIP9WarningHeight &&
((pindex->nVersion & VERSIONBITS_TOP_MASK) == VERSIONBITS_TOP_BITS) &&
((pindex->nVersion >> bit) & 1) != 0 &&
((ComputeBlockVersion(pindex->pprev, params) >> bit) & 1) == 0;
}
|
Sure, that sounds fine to me. |
Thanks @ajtowns . Let me know when you have a PR. |
ACK fdb3e8f. It makes the bit 0 warning go away in mainnet and testnet QT when a new block arrives. I think the code is clear enough. |
…tforks' warning fdb3e8f Ignore old versionbit activations (Anthony Towns) Pull request description: PR 16060 removed the CSV and Segwit BIP9 softfork definitions and hard-coded ('buried') the activation heights. The versionbits code will warn users if an undefined softfork has been signalled in block header versions, and removing the CSV/Segwit definitions caused those warnings to be triggered. Change the BIP 9 warning code to only check for unknown softforks after the segwit activation height. ACKs for top commit: MarcoFalke: ACK fdb3e8f ajtowns: ACK fdb3e8f for what it's worth achow101: ACK fdb3e8f Sjors: ACK fdb3e8f. It makes the bit 0 warning go away in mainnet and testnet QT when a new block arrives. I think the code is clear enough. jonatack: ACK fdb3e8f Tree-SHA512: e6fd34e8902f8c7affb28e8951803e47d542710d5f1229000746656a37ee59d754439fc33e36b7eef87544262e5aac374645db91b74cb507e73514003ca7a67f
I should add that testnet does still warn about bit 28 being activated; not sure what that's about. |
@Sjors segwit activated on testnet3 about 3 years ago. I guess you are correctly seeing the crap that testnet miners did in the last 3 years. |
…own softforks' warning fdb3e8f Ignore old versionbit activations (Anthony Towns) Pull request description: PR 16060 removed the CSV and Segwit BIP9 softfork definitions and hard-coded ('buried') the activation heights. The versionbits code will warn users if an undefined softfork has been signalled in block header versions, and removing the CSV/Segwit definitions caused those warnings to be triggered. Change the BIP 9 warning code to only check for unknown softforks after the segwit activation height. ACKs for top commit: MarcoFalke: ACK fdb3e8f ajtowns: ACK fdb3e8f for what it's worth achow101: ACK fdb3e8f Sjors: ACK fdb3e8f. It makes the bit 0 warning go away in mainnet and testnet QT when a new block arrives. I think the code is clear enough. jonatack: ACK fdb3e8f Tree-SHA512: e6fd34e8902f8c7affb28e8951803e47d542710d5f1229000746656a37ee59d754439fc33e36b7eef87544262e5aac374645db91b74cb507e73514003ca7a67f
Reviewers of this PR might want to take a look at #17449 ("fix uninitialized variable nMinerConfirmationWindow") :) |
Thanks for posting here @practicalswift . I agree that anyone who reviewed this should take a look at #17449. |
…own softforks' warning
…own softforks' warning
…own softforks' warning
…own softforks' warning
…own softforks' warning
…own softforks' warning
PR 16060 removed the CSV and Segwit BIP9 softfork definitions and hard-coded ('buried') the activation heights. The versionbits code will warn users if an undefined softfork has been signalled in block header versions, and removing the CSV/Segwit definitions caused those warnings to be triggered.
Change the BIP 9 warning code to only check for unknown softforks after the segwit activation height.