Ignore old versionbit activations to avoid ‘unknown softforks’ warning #16713

pull jnewbery wants to merge 1 commits into bitcoin:master from jnewbery:2019-08-silence-softfork-warning changing 3 files +8 −1
  1. jnewbery commented at 6:09 pm on August 24, 2019: member

    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.

  2. jnewbery commented at 6:10 pm on August 24, 2019: member
    Alternative to #16704
  3. DrahtBot commented at 7:35 pm on August 24, 2019: member

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Conflicts

    No conflicts as of last run.

  4. DrahtBot added the label Validation on Aug 24, 2019
  5. jnewbery force-pushed on Aug 25, 2019
  6. jnewbery renamed this:
    [consensus] Redefine CSV and segwit deployments to avoid 'unknown softforks' warning
    logging: Redefine CSV and segwit deployments to avoid 'unknown softforks' warning
    on Aug 25, 2019
  7. Ignore old versionbit activations
    Adds a hardcoded height to the consensus chain parameters for
    ignoring versionbit activations prior to a fixed height.
    fdb3e8f8b2
  8. in src/chainparams.cpp:201 in 85fff24be3 outdated
    195@@ -188,6 +196,14 @@ class CTestNetParams : public CChainParams {
    196         consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 1199145601; // January 1, 2008
    197         consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = 1230767999; // December 31, 2008
    198 
    199+        // CSV and Segwit versionbits parameters required to prevent soft fork warnings
    200+        consensus.vDeployments[Consensus::DEPLOYMENT_CSV].bit = 0;
    201+        consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nStartTime = 1462060800; // May 1st, 2016
    


    MarcoFalke commented at 5:54 pm on September 5, 2019:
    This started in march, no?
  9. MarcoFalke dismissed
  10. MarcoFalke commented at 5:55 pm on September 5, 2019: member
    Concept ACK, but I’d prefer if the correct times were used: https://github.com/bitcoin/bips/blob/master/bip-0009/assignments.mediawiki
  11. jnewbery force-pushed on Sep 5, 2019
  12. jnewbery commented at 5:58 pm on September 5, 2019: member
    I’ve updated this PR to take @ajtowns branch that changes the height at which we start looking for unknown softforks.
  13. MarcoFalke commented at 6:11 pm on September 5, 2019: member

    ACK fdb3e8f8b2

    Signature:

     0-----BEGIN PGP SIGNED MESSAGE-----
     1Hash: SHA512
     2
     3ACK fdb3e8f8b2
     4-----BEGIN PGP SIGNATURE-----
     5
     6iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
     7pUgH2gwAz7j3RTqo2rmSToD74d8gNagy+RG2uMcdAL+WwhEuk7u3N/KiNp7iO/Qd
     8zuxEIeAWbjLrUA7jKHTGqDWjrjef1+dlhAZB8pocYIrM0cluJZgYnaCIQkbZekeL
     9jg3xgaZ6RXeLnfKNBrNw55M/hjDn2FwF/9BxtcmrDBoUT9m1wPbrATypwvhSQlPG
    10LSbMfW9zl/H98Qpz6WfHc971mqNpsJgHLgJRaizrynN8sXeSYF6DWYCSUW0A4eSb
    11Q+ab/Ox6Z8QSh2fVUzwbFVQonNAvNgsfeIpUGZaiUi47MasORxlm0EFplvEEzQtd
    12ncc8Kr1LCZzWmG5bRL9yAiT08gOv8IqwKI7TsvhXTkCwKn8DMxPVBJzUlvdHg8gU
    137wvwm8tMprvzlS6Q+l7Oy8FXtqtxVqm8uh+3EJCN3l+EYRfeWKbDmZv4mlvF19KD
    14sXZjlmvMmq1kEfzLTvoLrExNBNJ2DITBzKMLDyNHD/eBTuSL3hIkZ2X+YZmbWQ9m
    15dDycm2P1
    16=XXpf
    17-----END PGP SIGNATURE-----
    

    Timestamp of file with hash cd1308070d16f4ec75ba666d53d7ee577ce57d8617bdb8f84dd8d20af9925ccf -

  14. MarcoFalke added this to the milestone 0.19.0 on Sep 5, 2019
  15. MarcoFalke renamed this:
    logging: Redefine CSV and segwit deployments to avoid 'unknown softforks' warning
    Ignore old versionbit activations to avoid 'unknown softforks' warning
    on Sep 5, 2019
  16. ajtowns commented at 8:39 pm on September 5, 2019: member
    ACK fdb3e8f8b27e3b0b2f88c32915975c6e4c299b1e for what it’s worth
  17. achow101 commented at 9:43 pm on September 5, 2019: member

    ACK fdb3e8f8b27e3b0b2f88c32915975c6e4c299b1e

    Code looks good to me. Also tested that the warning is longer being shown.

  18. sdaftuar commented at 1:26 pm on September 10, 2019: member
    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?
  19. MarcoFalke commented at 1:54 pm on September 10, 2019: member
    @sdaftuar Why would that be? A reorg that changes the block at consensus.SegwitHeight is going to split the network, so I think not displaying a warning is a minor (or non-)issue. I think the pull request could be more clear and explain that in a comment maybe?
  20. sdaftuar commented at 2:04 pm on September 10, 2019: member

    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 WarningBitsConditionChecker) that, at least in my mental mapping of our codebase, should be unaware of holistic reasoning around consensus issues like this.

    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.

  21. ajtowns commented at 3:44 am on September 11, 2019: member

    Well, a node doing IBD and being fed an alternate/bogus chain should probably sound as many alarms as it can…

    We could add a warning if our chain doesn’t contain defaultAssumeValid which would catch this? Or that it doesn’t contain the -assumevalid block if that block is non-zero (which would be easier to write tests for).

    But my concern here is that we’re changing utility code (in WarningBitsConditionChecker) that, at least in my mental mapping of our codebase, should be unaware of holistic reasoning around consensus issues like this.

    WarningBitsConditionChecker already knows “holistic” information about activation though – it knows the status of all supported versionbits deployments to avoid triggering on known deployments (via the ((ComputeBlockVersion() >> bit) & 1) == 0 test which will fail if there’s a version bits deployment in STARTED or LOCKED_IN phase on that bit).

  22. sdaftuar commented at 12:43 pm on September 18, 2019: member
    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.
  23. MarcoFalke commented at 7:14 pm on September 18, 2019: member
    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
  24. ajtowns commented at 7:55 am on September 20, 2019: member

    I think I’m a -0 on this; imo this makes the code a bit harder to reason about,

    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.

  25. jonatack commented at 8:44 am on September 20, 2019: member

    ACK fdb3e8f8b27e3b0b2f88c32915975c6e4c299b1e

    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.

  26. jonatack commented at 11:30 am on September 20, 2019: member

    Threw some LogPrintfs into WarningBitsConditionChecker as a sanity check for the values it sees.

     0    bool Condition(const CBlockIndex* pindex, const Consensus::Params& params) const override
     1    {
     2        LogPrintf("SegwitHeight %s\n", params.SegwitHeight);
     3        LogPrintf("nMinerConfirmationWindow %s\n", params.nMinerConfirmationWindow);
     4        LogPrintf("MinBIPWarningHeight %s\n", params.MinBIP9WarningHeight);
     5        LogPrintf("pindex->nHeight %s\n", pindex->nHeight);
     6        LogPrintf("pindex->nVersion %s\n", pindex->nVersion);
     7        LogPrintf("ComputeBlockVersion %s\n", ComputeBlockVersion(pindex->pprev, params));
     8
     9        return pindex->nHeight >= params.MinBIP9WarningHeight &&
    10               ((pindex->nVersion & VERSIONBITS_TOP_MASK) == VERSIONBITS_TOP_BITS) &&
    11               ((pindex->nVersion >> bit) & 1) != 0 &&
    12               ((ComputeBlockVersion(pindex->pprev, params) >> bit) & 1) == 0;
    13    }
    
    02019-09-20T11:26:36Z SegwitHeight 481824
    12019-09-20T11:26:36Z nMinerConfirmationWindow 2016
    22019-09-20T11:26:36Z MinBIPWarningHeight 483840
    32019-09-20T11:26:36Z pindex->nHeight 164836
    42019-09-20T11:26:36Z pindex->nVersion 1
    52019-09-20T11:26:36Z ComputeBlockVersion 536870912
    
    02019-09-20T11:34:30Z SegwitHeight 481824
    12019-09-20T11:34:30Z nMinerConfirmationWindow 2016
    22019-09-20T11:34:30Z MinBIPWarningHeight 483840
    32019-09-20T11:34:30Z pindex->nHeight 137541
    42019-09-20T11:34:30Z pindex->nVersion 1
    52019-09-20T11:34:30Z ComputeBlockVersion 536870912
    
    02019-09-20T11:36:35Z SegwitHeight 481824
    12019-09-20T11:36:35Z nMinerConfirmationWindow 2016
    22019-09-20T11:36:35Z MinBIPWarningHeight 483840
    32019-09-20T11:36:35Z pindex->nHeight 35101
    42019-09-20T11:36:35Z pindex->nVersion 1
    52019-09-20T11:36:35Z ComputeBlockVersion 536870912
    
  27. sdaftuar commented at 4:23 pm on September 20, 2019: member

    Alternatively could do this now and clean it up more in 0.20 – there’s other versionbits cleanups I’d like to do fwiw.

    Sure, that sounds fine to me.

  28. jnewbery commented at 0:39 am on September 21, 2019: member

    could do this now and clean it up more in 0.20 – there’s other versionbits cleanups I’d like to do fwiw.

    Thanks @ajtowns . Let me know when you have a PR.

  29. Sjors commented at 7:18 pm on September 27, 2019: member
    ACK fdb3e8f8b27e3b0b2f88c32915975c6e4c299b1e. 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.
  30. MarcoFalke referenced this in commit 6b2210f101 on Sep 27, 2019
  31. MarcoFalke merged this on Sep 27, 2019
  32. MarcoFalke closed this on Sep 27, 2019

  33. Sjors commented at 7:39 pm on September 27, 2019: member
    I should add that testnet does still warn about bit 28 being activated; not sure what that’s about.
  34. MarcoFalke commented at 7:44 pm on September 27, 2019: member
    @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.
  35. jnewbery deleted the branch on Sep 27, 2019
  36. sidhujag referenced this in commit d21bcbcf9c on Sep 28, 2019
  37. practicalswift commented at 9:54 am on November 12, 2019: contributor
    Reviewers of this PR might want to take a look at #17449 (“fix uninitialized variable nMinerConfirmationWindow”) :)
  38. jnewbery commented at 3:20 pm on November 14, 2019: member
    Thanks for posting here @practicalswift . I agree that anyone who reviewed this should take a look at #17449.
  39. kittywhiskers referenced this in commit 518b47abc0 on Nov 6, 2021
  40. kittywhiskers referenced this in commit a517de205d on Dec 5, 2021
  41. kittywhiskers referenced this in commit 9f125cd755 on Dec 5, 2021
  42. kittywhiskers referenced this in commit 9aa95d176d on Dec 12, 2021
  43. kittywhiskers referenced this in commit 8564b1e705 on Dec 12, 2021
  44. kittywhiskers referenced this in commit ac4dc7f4a6 on Dec 12, 2021
  45. MarcoFalke locked this on Dec 16, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-17 15:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me