test: Activate all regtest softforks at height 1, unless overridden #22818

pull MarcoFalke wants to merge 5 commits into bitcoin:master from MarcoFalke:2108-regtestSoft changing 19 files +96 −90
  1. MarcoFalke commented at 1:39 PM on August 27, 2021: member

    All softforks that are active at the tip of mainnet, should also be active from genesis in regtest. Otherwise their rules might not be enforced in user testing, thus making their testing less useful.

    To still allow tests to check pre-softfork rules, a runtime argument can change the activation height.

  2. DrahtBot added the label Validation on Aug 27, 2021
  3. laanwj commented at 7:57 PM on August 27, 2021: member

    Concept ACK. But I would personally prefer to overload one argument for the different activation heights, instead of adding a new argument for every single thing, for now and in the future. Either e,g,:

    -testactivationheights=<bip34height>,<dersigheight>,<cltvheight>,<csvheight>
    

    (this will work fine for the tests which "know" about everything anyway, even if new things get added) or, alternatively

    -testactivationheight=bip34,<height>
    -testactivationheight=dersig,<height>
    …
    
  4. DrahtBot commented at 7:28 AM on August 28, 2021: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #22976 (scripted-diff: Rename overloaded int GetArg to GetIntArg by ryanofsky)
    • #22711 (test: check for specific block reject reasons in p2p_segwit.py by theStack)
    • #19461 (multiprocess: Add bitcoin-gui -ipcconnect option by ryanofsky)
    • #19460 (multiprocess: Add bitcoin-wallet -ipcconnect option by ryanofsky)
    • #10102 ([experimental] Multiprocess bitcoin by ryanofsky)

    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.

  5. DrahtBot cross-referenced this on Aug 28, 2021 from issue refactor: Clarify and disable unused ArgsManager flags by ryanofsky
  6. theStack commented at 6:11 PM on August 28, 2021: contributor

    Concept ACK

  7. kristapsk commented at 6:19 PM on August 28, 2021: contributor

    Concept ACK

  8. DrahtBot cross-referenced this on Aug 28, 2021 from issue multiprocess: Add bitcoin-gui -ipcconnect option by ryanofsky
  9. DrahtBot cross-referenced this on Aug 28, 2021 from issue multiprocess: Add bitcoin-wallet -ipcconnect option by ryanofsky
  10. DrahtBot cross-referenced this on Aug 28, 2021 from issue refactor: Implement missing error checking for ArgsManager flags by ryanofsky
  11. DrahtBot cross-referenced this on Aug 29, 2021 from issue Multiprocess bitcoin by ryanofsky
  12. MarcoFalke force-pushed on Aug 30, 2021
  13. MarcoFalke force-pushed on Aug 30, 2021
  14. MarcoFalke force-pushed on Aug 30, 2021
  15. MarcoFalke force-pushed on Aug 30, 2021
  16. MarcoFalke commented at 2:52 PM on August 30, 2021: member

    -testactivationheight=bip34,<height>

    Done

  17. DrahtBot cross-referenced this on Aug 30, 2021 from issue test: check for specific block reject reasons in p2p_segwit.py by theStack
  18. MarcoFalke force-pushed on Sep 3, 2021
  19. practicalswift commented at 1:51 PM on September 4, 2021: contributor

    Strong Concept ACK

  20. in src/chainparams.cpp:398 in fae8d474f3 outdated
     397 | -        consensus.BIP66Height = 102; // BIP66 activated on regtest (Block at height 101 and earlier not enforced for testing purposes)
     398 | -        consensus.CSVHeight = 432; // CSV activated on regtest (Used in rpc activation tests)
     399 | +        consensus.BIP65Height = 1;  // Always active unless overridden
     400 | +        consensus.BIP66Height = 1;  // Always active unless overridden
     401 | +        consensus.CSVHeight = 1;    // Always active unless overridden
     402 |          consensus.SegwitHeight = 0; // SEGWIT is always activated on regtest unless overridden
    


    theStack commented at 10:23 AM on September 5, 2021:

    nit: For consistency reasons, could also set SegwitHeight to 1? Otherwise this implies to the reader that there's a subtle difference. (Maybe there is one that I'm not aware of, but at least the tests still seem to pass with a value of 1).


    MarcoFalke commented at 8:14 AM on September 6, 2021:

    Thanks, done.

  21. in test/functional/feature_dersig.py:115 in cccc7ae722 outdated
     108 | @@ -110,7 +109,7 @@ def run_test(self):
     109 |              peer.sync_with_ping()
     110 |  
     111 |          self.log.info("Test that transactions with non-DER signatures cannot appear in a block")
     112 | -        block.nVersion = 3
     113 | +        block.nVersion = 4
    


    theStack commented at 10:29 AM on September 5, 2021:

    After changing this, the log message "Test that a version 3 block with..." should also be updated.


    MarcoFalke commented at 8:14 AM on September 6, 2021:

    Thanks, done.

  22. theStack commented at 10:30 AM on September 5, 2021: contributor

    LGTM overall, left two small improvement suggestions.

  23. MarcoFalke force-pushed on Sep 6, 2021
  24. MarcoFalke force-pushed on Sep 6, 2021
  25. theStack approved
  26. theStack commented at 12:28 PM on September 6, 2021: contributor

    ACK fa32518ae3a670f2a964812806d4b07cc488c8a2 🍴

  27. DrahtBot cross-referenced this on Sep 7, 2021 from issue test: Avoid intermittent test failure in feature_csv_activation.py by MarcoFalke
  28. DrahtBot added the label Needs rebase on Sep 9, 2021
  29. MarcoFalke force-pushed on Sep 9, 2021
  30. DrahtBot removed the label Needs rebase on Sep 9, 2021
  31. DrahtBot added the label Needs rebase on Sep 10, 2021
  32. theStack approved
  33. theStack commented at 10:09 AM on September 10, 2021: contributor

    re-ACK fa5b518f165dd220dce2f46ad590b8ce8bdd26d8

    Checked via git range-diff fa32518a...fa5b518f that changes since my last ACK are only rebase-related.

  34. MarcoFalke force-pushed on Sep 10, 2021
  35. MarcoFalke commented at 10:21 AM on September 10, 2021: member

    Force pushed (trivial, without rebase)

  36. DrahtBot removed the label Needs rebase on Sep 10, 2021
  37. theStack approved
  38. theStack commented at 12:22 PM on September 10, 2021: contributor

    D'oh, didn't see the "Needs rebase" label when I did the previous review. At least the re-review is trivial now.

    ACK fae5b05486ae90f630cb26226f2e656507b391c9 1️⃣

  39. DrahtBot cross-referenced this on Sep 13, 2021 from issue test: Set peertimeout in write_config by MarcoFalke
  40. DrahtBot cross-referenced this on Sep 15, 2021 from issue scripted-diff: Rename overloaded int GetArg to GetIntArg by ryanofsky
  41. DrahtBot added the label Needs rebase on Sep 16, 2021
  42. test: Remove unused ~TestChain100Setup
    segwitheight is already 0 for regtest
    fa086ef539
  43. test: Remove version argument from build_next_block in p2p_segwit test
    The block version does not have any effect on the segwit consensus rules
    or block relay logic.
    
    Same for feature_dersig.
    faa46986aa
  44. test: Add extra_args argument to TestChain100Setup constructor
    This will be needed in a later commit.
    fadb2ef2fa
  45. Introduce -testactivationheight=name@height setting faad1e5ffd
  46. test: Activate all regtest softforks at height 1, unless overridden fa4db8671b
  47. MarcoFalke force-pushed on Sep 16, 2021
  48. DrahtBot removed the label Needs rebase on Sep 16, 2021
  49. in test/functional/rpc_blockchain.py:143 in fa4db8671b
     139 | @@ -142,11 +140,11 @@ def _test_getblockchaininfo(self):
     140 |          assert_greater_than(res['size_on_disk'], 0)
     141 |  
     142 |          assert_equal(res['softforks'], {
     143 | -            'bip34': {'type': 'buried', 'active': True, 'height': 2},
     144 | -            'bip66': {'type': 'buried', 'active': True, 'height': DERSIG_HEIGHT},
     145 | -            'bip65': {'type': 'buried', 'active': True, 'height': CLTV_HEIGHT},
     146 | -            'csv': {'type': 'buried', 'active': False, 'height': 432},
     147 | -            'segwit': {'type': 'buried', 'active': True, 'height': 0},
     148 | +            'bip34': {'type': 'buried', 'active': True, 'height': 1},
    


    laanwj commented at 9:06 PM on September 20, 2021:

    Wouldn't having slightly different activation heights here (even it its 1,2,3,4,5) make for a better test?


    MarcoFalke commented at 7:14 AM on September 21, 2021:

    Can do on the next force push or another pull request (whichever happens earlier)

  50. laanwj commented at 9:06 PM on September 20, 2021: member

    Code review ACK fa4db8671bb604e11b43a837f91de8866226f166

  51. theStack approved
  52. theStack commented at 11:32 PM on September 22, 2021: contributor

    re-ACK fa4db8671bb604e11b43a837f91de8866226f166

  53. MarcoFalke merged this on Sep 24, 2021
  54. MarcoFalke closed this on Sep 24, 2021

  55. MarcoFalke deleted the branch on Sep 24, 2021
  56. MarcoFalke cross-referenced this on Sep 24, 2021 from issue test: Add -testactivationheight tests to rpc_blockchain by MarcoFalke
  57. sidhujag referenced this in commit 2d58c2f315 on Sep 24, 2021
  58. sidhujag referenced this in commit da9da689f1 on Sep 24, 2021
  59. MarcoFalke referenced this in commit 16ccb3a1cd on Sep 25, 2021
  60. sidhujag referenced this in commit 51e8ce8571 on Sep 25, 2021
  61. MarcoFalke cross-referenced this on Nov 13, 2021 from issue Bury taproot deployment by MarcoFalke
  62. mzumsande commented at 6:02 PM on March 10, 2022: contributor

    The change of consensus.SegwitHeight from 0 to 1 has the effect that if I create a regtest enviroment with a current master (or 23.0), and then try to load the chain with an older version (e.g. 22.0), I get an InitError Witness data for blocks after height 0 requires validation. Please restart with -reindex because BLOCK_OPT_WITNESS is no longer set for the Genesis block and NeedsRedownload() in validation returns true. That might be a bit annoying for some tests - @MarcoFalke @theStack what do you think?

  63. MarcoFalke commented at 6:51 PM on March 10, 2022: member

    No objection setting it back to 0. An alternative might be to just use -reindex with 22.x, which will make the datadir compatible for 22.x and 23.x at the same time.

  64. mzumsande referenced this in commit 5ce3057c8e on Mar 10, 2022
  65. mzumsande cross-referenced this on Mar 10, 2022 from issue test: set segwit height back to 0 on regtest by mzumsande
  66. mzumsande commented at 7:48 PM on March 10, 2022: contributor

    see #24527

  67. MarcoFalke referenced this in commit 2860a91df0 on Mar 13, 2022
  68. jonatack referenced this in commit b1646f1bb5 on Mar 13, 2022
  69. sidhujag referenced this in commit 9464ddbfe4 on Mar 13, 2022
  70. hebasto referenced this in commit af3ef5b386 on Mar 31, 2022
  71. delta1 referenced this in commit 9bdd001cdc on Apr 23, 2023
  72. delta1 referenced this in commit 13fb374543 on Apr 24, 2023
  73. delta1 referenced this in commit 7856df2733 on Apr 24, 2023
  74. bitcoin locked this on Jun 24, 2023

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: 2026-05-20 06:53 UTC