AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Informational 15 Bitcoin

Merge bitcoin/bitcoin#35729: refactor: test: Unroll `&&` conditions in macros

Public commit record

What the developer wrote

Authored by merge-script

91/100 · Strong
Merge bitcoin/bitcoin#35729: refactor: test: Unroll `&&` conditions in macros

e8691056c0140f8fa850fc6837dde915ebeb22cc test: Unroll `&&` conditions in macros (rustaceanrob)

Pull request description:

Picked from #35713. Given that I think this is a strict debugging improvement, I opened as a separate pull:

Using `&&` in `BOOST_CHECK` is problematic as failures will not indicate which condition failed. By unrolling these checks, the user knows exactly which expression is the failing case.

As an example, here is a line that would be particularly hard to debug if it failed:

```
src/test/net_tests.cpp

BOOST_CHECK((*ret)[1] && (*ret)[1]->m_type == "headers" && std::ranges::equal((*ret)[1]->m_recv, MakeByteSpan(msg_data_2)));
```

If any one of these conditions fail, the whole expression fails, with no values printed or indication as to which condition failed.

This is also required when using test macros that support value decomposition, which requires `&&` and `||` are `delete`. Examples include `BOOST_TEST`, doctest, Catch2, etc.

ref: https://catch2-temp.readthedocs.io/en/latest/assertions.html#other-limitations
ref: https://fekir.info/post/decomposing-an-expression/

ACKs for top commit:
maflcko:
re-ACK e8691056c0140f8fa850fc6837dde915ebeb22cc 🌽
ismaelsadeeq:
reACK e8691056c0140f8fa850fc6837dde915ebeb22cc
sedited:
ACK e8691056c0140f8fa850fc6837dde915ebeb22cc

Tree-SHA512: 9eb74cecd47ee4fdc3f53beb7d50d5056d543303d023c68b8d47cbe52d37f1156488c8b943faf68dd52c192c43626037bbf08172e7cc24753e0f6070db6e3ab2
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This commit only changes Bitcoin Core's internal test code. It splits combined conditions inside test-check macros (like BOOST_CHECK(a && b)) into separate checks so that when a test fails, the test output points to the exact failing condition. It does not change any production code, network behavior, wallet logic, or consensus rules, and it does not fix a security vulnerability.

Recommended action

No security action required. Treat as a normal test-quality improvement.

Security signals we found

No strong security signals were identified.

Risk score

Why this scored 15/100

Our methodology →
Potential impact 0/30
Exploitability 0/25
Stealth signal 0/15
Affected reach 0/15
Confidence 10/10
Evidence quality 5/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.