maflcko
commented at 9:30 AM on August 25, 2026:
member
In test code, assert is used. This is perfectly fine, but sometimes confusion arises, when it is unclear whether NDEBUG can disable the assertions, or whether to use assert or Assert.
Avoid that confusion in test code with a scripted replacement and a small linter to enforce it going forward.
Scope: This change is only about test code (bench, fuzz, unit), other code can be done later, if there is need to.
DrahtBot renamed this: scripted-diff: [test] replace assert with Assert scripted-diff: [test] replace assert with Assert on Aug 25, 2026
DrahtBot added the label Refactoring on Aug 25, 2026
DrahtBot
commented at 9:30 AM on August 25, 2026:
contributor
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
#36091 (test: Add debug output to common tested types by rustaceanrob)
#36087 (util: Add and use AssertUnreachable by maflcko)
#36068 (fuzz: reuse one fuzzed wallet across inputs by brunoerg)
#36042 (build: Bump g++ minimum supported version to 13 by maflcko)
#36033 ([wip,nomerge,rfc] build: Require C++23 compiler by maflcko)
#36031 (wallet: Remove mapMasterKeys and enforce that only one encryption key can exist by achow101)
#36015 (txorphanage: bound orphan memory by storing transactions serialized by brunoerg)
#35998 (wallet: Handle or explicitly ignore WalletBatch write failures by achow101)
#35975 (wallet: Fix CWalletTx malleated transaction metadata sync by achow101)
#35911 (Warn on and add missing [[noreturn]] by fanquake)
#35793 (Implement BIP 54 (Consensus Cleanup) without mainnet activation by darosior)
#35752 (wallet: make encryption state updates atomic by l0rinc)
#35733 (sign: Remove FillableSigningProvider by achow101)
#35731 (Indexes: Harden the flush-error notification invariant by arejula27)
#35716 (wallet: Replace mapWallet and wtxOrdered with a boost::multi_index by achow101)
#35714 (validation: stop writes after flush failure by l0rinc)
#35713 (Remove boost as a unit test runner by rustaceanrob)
#35662 (script: prevent stale sighash caches across transactions by l0rinc)
#35570 (refactor: Change some validation.cpp methods to return BlockValidationState by optout21)
#35569 (Encapsulation for CTransaction by purpleKarrot)
#35557 (kernel, validation: Add btck_chainstate_manager_set_clock_time by ryanofsky)
#35511 (RFC: consensus: Make CAmount a class by hodlinator)
#35351 (net: Disallow invalid HeadersSyncState due to lagging clock by hodlinator)
#35170 (test: Better test coverage for legacy ParseHDKeypath() by optout21)
#35003 (validation: improve block data I/O error handling in P2P paths by furszy)
#34969 (fuzz: several improvements to scriptpubkeyman harness by brunoerg)
#34864 (coins: tighten cache entry state invariants by l0rinc)
#34861 (wallet: Add importdescriptors interface by polespinasa)
#34778 (logging: rewrite macros to enforce restrictions at compile-time, improve efficiency and usability by ryanofsky)
#34698 (wallet: handle MiniMiner bump fee calculation failures by shuv-amp)
#34681 (wallet: move rescan logic into ChainScanner and wallet/scan by Eunovo)
#34132 (coins,dbwrapper: remove error catcher, make point-read failures fatal by l0rinc)
#32729 (test,script: add sigop helpers (without consensus migration) by l0rinc)
#32554 (bench: replace embedded raw block with configurable block generator by l0rinc)
#30342 (kernel, logging: Pass Logger instances to kernel objects by ryanofsky)
#29278 (Wallet: Add maxfeerate wallet startup option by ismaelsadeeq)
#29256 (log, refactor: Allow log macros to accept context arguments by ryanofsky)
#27865 (wallet: Track no-longer-spendable TXOs separately by achow101)
#27260 (Enhanced error messages for invalid network prefix during address parsing. by portlandhodl)
#24230 (indexes: Stop using node internal types and locking cs_main, improve sync logic 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-->
LLM Linter (✨ experimental)
Possible typos and grammar issues:
// Dont check any values, just that each success result must fit into -> // Don't check any values, just that each successful result must fit into [“Dont” is misspelled; the intended meaning is clear but the apostrophe is missing]
Possible places where named args for integral literals may be used (e.g. func(x, /*named_arg=*/0) in C++, and func(x, named_arg=0) in Python):
CheckBlock(block, cvstate, chainparams.GetConsensus(), false, false) in src/bench/duplicate_inputs.cpp
<sup>2026-08-26 11:29:19</sup>
DrahtBot added the label CI failed on Aug 25, 2026
DrahtBot
commented at 10:52 AM on August 25, 2026:
contributor
<!--85328a0da195eb286784d51f73fa0af9-->
🚧 At least one of the CI tasks failed.
<sub>Task i686, no IPC: https://github.com/bitcoin/bitcoin/actions/runs/32832295932/job/97753466551</sub>
<sub>LLM reason (✨ experimental): CI failed due to a C++ build error treated as fatal (-Werror=return-type) in bench/sign_transaction.cpp where an Assert(false) lambda triggers “control reaches end of non-void function.”</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>
maflcko marked this as a draft on Aug 25, 2026
maflcko
commented at 12:15 PM on August 25, 2026:
member
Hmm, I guess Assert(0/false) being a function trips GCC into thinking it can return? Though, the optimized codegen is unaffected on GCC. Funnily clang doesn't warn, but pessimises codegen: https://godbolt.org/z/h79K1scWK
I guess that means we could add an explicit #define AssertUnreachable() assertion_fail(std::source_location::current(), "Unreachable code")
DrahtBot added the label Needs rebase on Aug 26, 2026
scripted-diff: [test] Add util/check.h includes for assertions
The project has a compile error when compiled without assertions in
util/check.h. Thus, util/check.h should be included for all assertions.
So do that with a scripted-diff for Assert and assert, and remove the
cassert include, which is exported from util/check.h.
-BEGIN VERIFY SCRIPT-
# Select all test .cpp and .h files
paths=(
'src/test/'
'src/bench/'
'src/wallet/test/'
'src/qt/test/'
':(exclude)src/bench/nanobench.h'
)
# Add the util/check.h includes
for f in $(git grep -l --extended-regexp "\<(a|A)ssert\(" -- "${paths[@]}"); do
if ! grep --quiet "util/check.h" "$f"; then
if [[ "$f" == *.cpp ]]; then
line=5
else
line=8
fi
sed --in-place "${line}i#include <util/check.h>" "$f"
fi
done
# Remove cassert includes
for f in $(git grep -l '<cassert>' -- "${paths[@]}"); do
sed --in-place '/^#include <cassert>$/d' "$f"
done
-END VERIFY SCRIPT-
7140a3a35d
refactor: [test] Sort includes
This can be reproduced by checking out the previous commit and running:
git show -U0 | ./contrib/devtools/clang-format-diff.py -p1 -i -v
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-08-26 19:51 UTC
This site is hosted by @0xB10C More mirrored repositories can be found on mirror.b10c.me