Skip to content

Conversation

ajtowns
Copy link
Contributor

@ajtowns ajtowns commented Jul 16, 2025

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.

@DrahtBot
Copy link
Contributor

DrahtBot commented Jul 16, 2025

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.

Type Reviewers
Concept ACK darosior

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #32575 (refactor: Split multithreaded case out of CheckInputScripts by fjahr)
  • #32453 ([Policy] Discourage Unsigned Annexes by JeremyRubin)
  • #32317 (kernel: Separate UTXO set access from validation functions by TheCharlatan)
  • #31989 (BIP-119 (OP_CHECKTEMPLATEVERIFY) (regtest only) by jamesob)
  • #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.

@ajtowns
Copy link
Contributor Author

ajtowns commented Jul 16, 2025

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

cc @instagibbs @darosior @benthecarman

@ajtowns ajtowns force-pushed the 202507-script-verify-flags branch from 725dbeb to 0c82b29 Compare July 16, 2025 23:00
@DrahtBot
Copy link
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.

Hints

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.

@ajtowns ajtowns force-pushed the 202507-script-verify-flags branch from 0c82b29 to e193e9b Compare July 17, 2025 00:02
@ajtowns
Copy link
Contributor Author

ajtowns commented Jul 17, 2025

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.

[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]
[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]
[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]
...
[20:12:02.187] Command
[20:12:02.187] -------
[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
[20:12:02.187] 
[20:12:02.187] Output
[20:12:02.187] ------
[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).

@hebasto
Copy link
Member

hebasto commented Jul 17, 2025

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.

@instagibbs
Copy link
Member

agreed, build issue also on my end with gcc 13.3.0

@fanquake
Copy link
Member

Minified this is:

# podman run -it ubuntu:noble

apt update && apt upgrade -y
apt install g++ qt6-base-dev qt6-tools-dev git

git clone https://github.com/bitcoin/bitcoin
cd bitcoin
git fetch origin pull/32998/head:32998
git checkout 32998

/usr/lib/qt6/libexec/moc -I/usr/include/c++/13 --output-dep-file -o test.moc /bitcoin/src/qt/intro.cpp
usr/include/c++/13/bits/cpp_type_traits.:69:1: error: Parse error at "std"

@hebasto
Copy link
Member

hebasto commented Jul 17, 2025

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.

@ajtowns
Copy link
Contributor Author

ajtowns commented Jul 19, 2025

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?

@ajtowns ajtowns force-pushed the 202507-script-verify-flags branch from e193e9b to 81a10f7 Compare July 26, 2025 09:30
@fanquake
Copy link
Member

@hebasto
Copy link
Member

hebasto commented Jul 26, 2025

@hebasto how can we move past the GUI build failures here? https://github.com/bitcoin/bitcoin/actions/runs/16538448423/job/46776353144?pr=32998#step:6:3769.

Sure!

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.

Implemented in bitcoin-core/gui#881.

hebasto added a commit that referenced this pull request Jul 30, 2025
…n module

3a03f07 qt: Avoid header circular dependency (Anthony Towns)
25884bd qt, refactor: Move `FreespaceChecker` class into its own module (Hennadii Stepanov)

Pull request description:

  For some reason, the MOC compiler in older versions of Qt 6 fails to parse `qt/intro.cpp`, as noted in [this comment](#32998 (comment)).

  This PR proposes a move-only refactoring to simplify the source structure by eliminating the need for the inline `#include <qt/intro.moc>`, thereby effectively working around the issue.

  Required for #32998.

ACKs for top commit:
  ajtowns:
    ACK 3a03f07

Tree-SHA512: 4a7261f04fff9bd8edd4dc2df619c90e06417e19da672dd688a917cd0b9a324a6db7185a47c48f0385713b5e6c45d2204bef58cbe6c77299386136ed5682bd8d
@ajtowns ajtowns force-pushed the 202507-script-verify-flags branch from 81a10f7 to 077797c Compare July 31, 2025 00:23
@ajtowns ajtowns force-pushed the 202507-script-verify-flags branch from 077797c to b96c1b9 Compare July 31, 2025 06:50
@darosior
Copy link
Member

Concept ACK.

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.
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.
`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.
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`.
@ajtowns ajtowns force-pushed the 202507-script-verify-flags branch from b96c1b9 to 417437e Compare August 14, 2025 00:58
@ajtowns
Copy link
Contributor Author

ajtowns commented Aug 14, 2025

Rebased past header conflict with #33116

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants