Make deployment configuration available outside of regtest in unit tests #35335

pull darosior wants to merge 2 commits into bitcoin:master from darosior:2605_more_deployment_config changing 5 files +143 −77
  1. darosior commented at 4:29 PM on May 20, 2026: member

    It's sometimes useful to test a deployment on other networks than regtest. This may be e.g. because regtest lacks a property relevant for the test, or simply because the test aims to be portable while regtest is Bitcoin Core specific.

    This PR makes it possible to set the -vbparams and -testactivationheight options on any network in unit tests, and on any test network as a startup option.

    This is preparatory work for a BIP 54 implementation, but may be useful separately.

  2. DrahtBot commented at 4:29 PM on May 20, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/35335.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    Concept ACK sedited, willcl-ark

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #34566 (feature: Use different datadirs for different signets by ekzyis)
    • #17783 (common: Disallow calling IsArgSet() on ALLOW_LIST options by ryanofsky)
    • #17581 (refactor: Remove settings merge reverse precedence code by ryanofsky)
    • #17580 (refactor: Add ALLOW_LIST flags and enforce usage in CheckArgFlags by ryanofsky)
    • #17493 (util: Forbid ambiguous multiple assignments in config file 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.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  3. chainparams: encapsulate deployment configuration logic
    This encapsulates the soft fork configuration logic as set by the `-testactivationheight` (for
    buried deployments) and `-vbparams` (for version bits deployments) options which for the moment
    are regtest-only, in order to make them available on other networks as well in the next commit.
    
    Can be reviewed using git's `--color-moved` option with `--color-moved-ws=allow-indentation-change`.
    df7ed5f355
  4. chainparams: make deployment configuration available on all test networks
    This allows unit tests to set `-testactivationheight` and `-vbparams` on
    all networks instead of exclusively on regtest. Those are kept
    test-network-only when used as startup parameters.
    93c3b39b2a
  5. DrahtBot added the label CI failed on May 20, 2026
  6. DrahtBot commented at 5:58 PM on May 20, 2026: contributor

    <!--85328a0da195eb286784d51f73fa0af9-->

    🚧 At least one of the CI tasks failed. <sub>Task test ancestor commits: https://github.com/bitcoin/bitcoin/actions/runs/26175913652/job/77006888711</sub> <sub>LLM reason (✨ experimental): CI failed due to a C++ build error: chainparams.cpp references missing member dep_opts in CChainParams::SigNetOptions (compile error: “no member named 'dep_opts'”).</sub>

    <details><summary>Hints</summary>

    Try to run the tests locally, according to the documentation. However, a CI failure may still happen due to a number of reasons, for example:

    • Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.

    • A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test.

    • An intermittent issue.

    Leave a comment here, if you need help tracking down a confusing failure.

    </details>

  7. darosior force-pushed on May 20, 2026
  8. sedited commented at 7:15 PM on May 20, 2026: contributor

    Concept ACK

  9. DrahtBot removed the label CI failed on May 20, 2026
  10. sedited requested review from ajtowns on May 21, 2026
  11. willcl-ark commented at 8:08 PM on May 21, 2026: member

    Concept ACK.

    Seems generally useful and, if I'm honest, I'm kind of surprised we didn't need/have this ability already.

    Are you after this for BIP54 because some of the timestamp/retarget-boundary behavior is awkward to model cleanly on regtest? It seems useful to be able to test deployments on signet/testnet without needing custom chainparams patches in any case.

  12. darosior commented at 8:16 PM on May 21, 2026: member

    The BIP 54 test vectors use mainnet headers and blocks for the timewarp(s) test cases and nlocktime-in-coinbase test cases. This is because regtest does not have retargets, and is Bitcoin Core specific. Mainnet is more portable to other clients and closer to what we want to test for, so i went the extra mile and generated valid mainnet blocks / block headers for the BIP test vectors (implementation here, documentation to reproduce here).


ajtowns


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-22 19:51 UTC

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