Bump SCRIPT_VERIFY flags to 64 bit #32998

pull ajtowns wants to merge 7 commits into bitcoin:master from ajtowns:202507-script-verify-flags changing 27 files +306 −169
  1. ajtowns commented at 10:58 pm on July 16, 2025: contributor

    We currently use 21 of 32 possible bits for SCRIPT_VERIFY_* flags, with open PRs that may use 8 more (#29247, #31989, #32247, #32453). The mutinynet fork that has included many experimental soft fork features is already reusing bits here. Therefore, bump this to 64 bits.

    In order to make it easier to update this logic in future, this PR also introduces a dedicated type for the script flags, and disables implicit conversion between that type and the underlying integer type. To make verifying that this change doesn’t cause flags to disappear, this PR also resurrects the changes from #28806 so that the script flags that are consensus enforced on each block can be queried via getdeploymentinfo.

  2. Move mapFlagNames and FormatScriptFlags logic to script/interpreter.h
    Moves FormatScriptFlags logic into GetScriptFlagNames which returns a
    vector of strings. For completeness, also has GetScriptFlagNames report
    on any bits that do not match a known script flag.
    69c5e8141e
  3. validation: export GetBlockScriptFlags() ab7c9f6f28
  4. rpc: have getdeploymentinfo report script verify flags 8fca7c2e54
  5. DrahtBot commented at 10:58 pm on July 16, 2025: contributor

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

    Code Coverage & Benchmarks

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

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #33012 (script: return verification flag responsible for error upon validation failure by darosior)
    • #32575 (refactor: Split multithreaded case out of CheckInputScripts by fjahr)
    • #32473 (Introduce per-txin sighash midstate cache for legacy/p2sh/segwitv0 scripts by sipa)
    • #32453 ([Policy] Discourage Unsigned Annexes by JeremyRubin)
    • #32317 (kernel: Separate UTXO set access from validation functions by TheCharlatan)
    • #32247 (BIP-348 (OP_CHECKSIGFROMSTACK) (regtest only) by jamesob)
    • #31989 (BIP-119 (OP_CHECKTEMPLATEVERIFY) (regtest only) by jamesob)
    • #31576 (test: Move script_assets_tests into its own suite by hebasto)
    • #29843 (policy: Allow non-standard scripts with -acceptnonstdtxn=1 (test nets only) by ajtowns)
    • #29247 (CAT in Tapscript (BIP-347) by arminsabouri)

    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.

  6. ajtowns commented at 10:59 pm on July 16, 2025: contributor

    The “introduce script_verify_flags typename” commit is probably best reviewed with --word-diff fwiw.

    cc @instagibbs @darosior @benthecarman

  7. ajtowns force-pushed on Jul 16, 2025
  8. DrahtBot added the label CI failed on Jul 16, 2025
  9. DrahtBot commented at 11:01 pm on July 16, 2025: contributor

    🚧 At least one of the CI tasks failed. Task lint: https://github.com/bitcoin/bitcoin/runs/46136681380 LLM reason (✨ experimental): Lint failure caused by missing include guard in src/script/verify_flags.h.

    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.

  10. script/interpreter: introduce script_verify_flags typename
    Previously the SCRIPT_VERIFY_* flags were specified as either uint32_t,
    unsigned int, or unsigned. This converts them to a common type alias in
    preparation for changing the underlying type.
    21fe94d2ca
  11. script/verify_flags: make script_verify_flags type safe
    `using script_verify_flags = uint32_t` allows implicit conversion to
    and from int, so replace it with a class to have the compiler ensure we
    use the correct type. Provide from_int and as_int to allow for explicit
    conversions when desired.
    
    Introduces the type `script_verify_flag_name` for the individual flag
    name enumeration.
    b64970e49f
  12. script/interpreter: make script_verify_flag_name an ordinary enum
    Instead of having `SCRIPT_VERIFY_FOO = (1U << n)` just have it
    be `n` directly, and do the bit shifting when converting it to
    `script_verify_flags`.
    c54e1c0ee7
  13. script/verify_flags: extend script_verify_flags to 64 bits e193e9bb47
  14. ajtowns force-pushed on Jul 17, 2025
  15. ajtowns commented at 1:00 am on July 17, 2025: contributor

    CI failure seems to be due to a bug in qt6 6.4:

    Also for people coming here from Google: I had the same error message, but for me the problem was that I was using Qt 6.4.2 which apparently thinks that #if 202002L < 201103L is true, which causes c++config.h to not be included (and no #error is generated because moc doesn’t support the directive) . This has been fixed somewhere before Qt 6.7.3.

     0[20:04:17.396] Get:287 http://archive.ubuntu.com/ubuntu noble/universe amd64 qt6-base-dev-tools amd64 6.4.2+dfsg-21.1build5 [970 kB]
     1[20:04:17.414] Get:288 http://archive.ubuntu.com/ubuntu noble/universe amd64 qt6-qpa-plugins amd64 6.4.2+dfsg-21.1build5 [89.3 kB]
     2[20:04:17.417] Get:289 http://archive.ubuntu.com/ubuntu noble/universe amd64 qt6-base-dev amd64 6.4.2+dfsg-21.1build5 [1458 kB]
     3...
     4[20:12:02.187] Command
     5[20:12:02.187] -------
     6[20:12:02.187] /usr/lib/qt6/libexec/moc -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION -DBOOST_NO_CXX98_FUNCTION_BASE -DQT_CORE_LIB -DQT_DBUS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_NO_KEYWORDS -DQT_USE_QSTRINGBUILDER -DQT_WIDGETS_LIB -I/ci_container_base/ci/scratch/build-x86_64-pc-linux-gnu/src -I/ci_container_base/src -I/ci_container_base/src/univalue/include -I/ci_container_base/src/leveldb/include -I/usr/include/x86_64-linux-gnu/qt6/QtWidgets -I/usr/include/x86_64-linux-gnu/qt6 -I/usr/include/x86_64-linux-gnu/qt6/QtCore -I/usr/lib/x86_64-linux-gnu/qt6/mkspecs/linux-g++ -I/usr/include/x86_64-linux-gnu/qt6/QtGui -I/usr/include/x86_64-linux-gnu/qt6/QtNetwork -I/usr/include/x86_64-linux-gnu/qt6/QtDBus -I/usr/include -I/usr/include/c++/13 -I/usr/include/x86_64-linux-gnu/c++/13 -I/usr/include/c++/13/backward -I/usr/lib/llvm-20/lib/clang/20/include -I/usr/local/include -I/usr/include/x86_64-linux-gnu --include /ci_container_base/ci/scratch/build-x86_64-pc-linux-gnu/src/qt/bitcoinqt_autogen/moc_predefs.h -p/ci_container_base/src/qt --output-dep-file -o /ci_container_base/ci/scratch/build-x86_64-pc-linux-gnu/src/qt/bitcoinqt_autogen/include/qt/intro.moc /ci_container_base/src/qt/intro.cpp
     7[20:12:02.187] 
     8[20:12:02.187] Output
     9[20:12:02.187] ------
    10[20:12:02.187] usr/include/c++/13/concept:46:1: error: Parse error at "std"
    

    The error output also seems to be cutting off the last letter of the filename (“concept” vs “concepts” here, and “stl_relops.” vs “stl_relops.h” in the original bug report linked above).

  16. hebasto commented at 1:21 pm on July 17, 2025: member

    CI failure seems to be due to a bug in qt6 6.4:

    Although both failed CI job use Clang 20.1.7, the error can also be reproduced with GCC 13.3.

  17. instagibbs commented at 1:31 pm on July 17, 2025: member
    agreed, build issue also on my end with gcc 13.3.0
  18. fanquake commented at 1:43 pm on July 17, 2025: member

    Minified this is:

     0# podman run -it ubuntu:noble
     1
     2apt update && apt upgrade -y
     3apt install g++ qt6-base-dev qt6-tools-dev git
     4
     5git clone https://github.com/bitcoin/bitcoin
     6cd bitcoin
     7git fetch origin pull/32998/head:32998
     8git checkout 32998
     9
    10/usr/lib/qt6/libexec/moc -I/usr/include/c++/13 --output-dep-file -o test.moc /bitcoin/src/qt/intro.cpp
    11usr/include/c++/13/bits/cpp_type_traits.:69:1: error: Parse error at "std"
    
  19. hebasto commented at 1:48 pm on July 17, 2025: member

    CI failure seems to be due to a bug in qt6 6.4:

    Although both failed CI job use Clang 20.1.7, the error can also be reproduced with GCC 13.3.

    Refactoring helps.

  20. ajtowns commented at 5:37 am on July 19, 2025: contributor

    Minified this is:

    I don’t think you need the git fetch; git checkout here – you get the same error with that command (dropping the /bitcoin) on master afaics?


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: 2025-07-23 12:12 UTC

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