iwyu: Fix warnings in `src/test/fuzz` and treat them as errors #36808

pull hebasto wants to merge 3 commits into bitcoin:master from hebasto:261108-iwyu-fuzz changing 190 files +945 −383
  1. hebasto commented at 7:03 PM on November 8, 2026: member

    This PR continues the ongoing effort to enforce IWYU warnings.

    See Developer Notes.

    Based on #36844.

  2. DrahtBot commented at 7:03 PM on November 8, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    External sites

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

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

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #36996 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36996.svg"></sub> (fuzz: fix timelock range in miniscript_smart by erickcestari)
    • #36946 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36946.svg"></sub> (scripted-diff: [test] Add util/check.h includes for assertions by maflcko)
    • #36885 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36885.svg"></sub> (wallet, rpc: Add analyzedescriptor for multisig setups by pablomartin4btc)
    • #36822 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36822.svg"></sub> (fuzz: torcontrol: drive the control connection over a mocked socket by erickcestari)
    • #36812 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36812.svg"></sub> (crypto: copy HMAC state instead of rehashing key pads by l0rinc)
    • #36786 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36786.svg"></sub> (fuzz: report more events, and check more invariants in connman target by darosior)
    • #36635 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36635.svg"></sub> (fuzz: Add a target that feeds arbitrary bytes to V2Transport by fametrano)
    • #36603 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36603.svg"></sub> (Improve loadtxoutset performance by ajtowns)
    • #36598 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36598.svg"></sub> ([Demo] validation: remove AssumeUTXO by l0rinc)
    • #36548 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36548.svg"></sub> (net: serve MSG_BLOCK by stripping witnesses in place by l0rinc)
    • #36188 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36188.svg"></sub> (crypto: plug hardware optimized SHA256 into libsecp256k1's context by furszy)
    • #36122 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36122.svg"></sub> (BIP460: CISA for Taproot key path spends by fjahr)
    • #36114 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36114.svg"></sub> (wallet: harden external signer psbt processing, revamp mock by Sjors)
    • #36033 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36033.svg"></sub> ([wip,nomerge,rfc] build: Require C++23 compiler by maflcko)
    • #35888 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/35888.svg"></sub> (net: reject oversized outbound messages by l0rinc)
    • #35229 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/35229.svg"></sub> (refactor: Use CBlockIndex parameters as reference by optout21)
    • #29491 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/29491.svg"></sub> ([EXPERIMENTAL] Schnorr batch verification for blocks by fjahr)
    • #27260 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/27260.svg"></sub> (Enhanced error messages for invalid network prefix during address parsing. by portlandhodl)

    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. hebasto force-pushed on Nov 8, 2026
  4. DrahtBot added the label CI failed on Nov 8, 2026
  5. DrahtBot commented at 7:17 PM on November 8, 2026: contributor

    <!--85328a0da195eb286784d51f73fa0af9-->

    🚧 At least one of the CI tasks failed. <sub>Task Alpine (musl): https://github.com/bitcoin/bitcoin/actions/runs/42513074263/job/128830134615</sub> <sub>LLM reason (✨ experimental): CI failed during compilation: headerssync.cpp has missing declarations/includes, causing incomplete CBlockIndex and undefined symbols.</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>

  6. hebasto force-pushed on Nov 8, 2026
  7. hebasto force-pushed on Nov 8, 2026
  8. hebasto force-pushed on Nov 8, 2026
  9. hebasto force-pushed on Nov 8, 2026
  10. DrahtBot removed the label CI failed on Nov 8, 2026
  11. in src/protocol.h:316 in f2e0f6149c outdated
     315 | @@ -313,10 +316,6 @@ inline const std::array ALL_NET_MESSAGE_TYPES{std::to_array<std::string>({
     316 |  inline constexpr size_t MAX_FEATUREID_LENGTH{80};
     317 |  inline constexpr size_t MAX_FEATUREDATA_LENGTH{512};
     318 |  
     319 | -namespace NetMsgFeature {
    


    maflcko commented at 9:03 AM on November 10, 2026:

    this should be left as-is. Also, I am unsure how to review the non-fuzz header changes? How do I know they are enforced by iwyu? I think it would be easier if the header changes are addition-only for now?


    hebasto commented at 2:53 PM on November 10, 2026:

    this should be left as-is.

    Thanks! Fixed.

  12. in contrib/devtools/iwyu/bitcoin.core.imp:4 in f2e0f6149c outdated
       0 | @@ -1,3 +1,5 @@
       1 |  # Nothing for now.
       2 |  [
       3 | +  # Standard C library symbols.
       4 | +  { "include": [ "<bits/types/cookie_io_functions_t.h>", "private", "<cstdio>", "public" ] },
    


    fanquake commented at 11:42 AM on November 10, 2026:

    Why is this needed? Has it been upstreamed?


    hebasto commented at 11:44 AM on November 10, 2026:

    Has it been upstreamed?

    Working on this.

  13. hebasto force-pushed on Nov 10, 2026
  14. DrahtBot added the label Needs rebase on Nov 10, 2026
  15. hebasto force-pushed on Nov 10, 2026
  16. hebasto force-pushed on Nov 10, 2026
  17. DrahtBot added the label CI failed on Nov 10, 2026
  18. fanquake referenced this in commit 36be848e92 on Nov 10, 2026
  19. hebasto commented at 3:03 PM on November 10, 2026: member

    Also, I am unsure how to review the non-fuzz header changes? How do I know they are enforced by iwyu?

    The changes in non-fuzz headers are enforced by IWYU because, due to the stem name coincidence, it considers them associated headers of the corresponding fuzz sources. For example, src/test/fuzz/protocol.cpp and src/protocol.h. However, they are not, because the fuzz sources contain no definitions for any declarations from those headers.

    This, in turn, requires adding includes to some non-fuzz sources for headers that were previously included transitively.

    I think it would be easier if the header changes are addition-only for now?

    I'm going to split out the non-fuzz changes so that they can be reviewed separately.

  20. DrahtBot removed the label CI failed on Nov 10, 2026
  21. hebasto force-pushed on Nov 10, 2026
  22. DrahtBot removed the label Needs rebase on Nov 10, 2026
  23. hebasto force-pushed on Nov 11, 2026
  24. sedited referenced this in commit a06515e9fd on Nov 12, 2026
  25. hebasto force-pushed on Nov 12, 2026
  26. hebasto commented at 10:29 AM on November 12, 2026: member

    I think it would be easier if the header changes are addition-only for now?

    I'm going to split out the non-fuzz changes so that they can be reviewed separately.

    See #36844.

  27. DrahtBot added the label Needs rebase on Nov 16, 2026
  28. hebasto force-pushed on Nov 16, 2026
  29. hebasto force-pushed on Nov 16, 2026
  30. DrahtBot added the label CI failed on Nov 16, 2026
  31. DrahtBot removed the label Needs rebase on Nov 16, 2026
  32. DrahtBot removed the label CI failed on Nov 17, 2026
  33. hebasto force-pushed on Nov 20, 2026
  34. DrahtBot added the label Needs rebase on Nov 20, 2026
  35. hebasto force-pushed on Nov 25, 2026
  36. DrahtBot removed the label Needs rebase on Nov 25, 2026
  37. DrahtBot added the label Needs rebase on Nov 26, 2026
  38. ci, refactor: List top-level IWYU-enforced files one per line
    This makes the list easier to read and extend, and keeps diffs
    minimal when files are added.
    3a540e6639
  39. iwyu: Fix warnings in more modules in `src/` and treat them as errors
    Fix IWYU warnings in the following source files and their associated
    headers, and add them to `IWYU_SRC_FILES`, so that any new warnings
    there fail CI:
    - chain.cpp
    - headerssync.cpp
    - key_io.cpp
    - merkleblock.cpp
    - pow.cpp
    
    The changes in other files add includes of headers that were previously
    included transitively.
    9214667bdf
  40. iwyu: Fix warnings in `src/test/fuzz` and treat them as errors 3d224a742c
  41. hebasto force-pushed on Nov 26, 2026
  42. DrahtBot removed the label Needs rebase on Nov 26, 2026

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-11-30 04:51 UTC

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