fuzz: Remove unused `DeserializeFromFuzzingInput` params overload #35679

pull hebasto wants to merge 2 commits into bitcoin:master from hebasto:260707-fuzz-unused changing 1 files +1 −20
  1. hebasto commented at 3:56 PM on July 7, 2026: member

    Clang recently enabled -Wunused-template under -Wall (see https://github.com/llvm/llvm-project/pull/206123, https://github.com/llvm/llvm-project/pull/207848, https://github.com/llvm/llvm-project/pull/208001). Our codebase triggers some of these warnings.

    This PR handles the simplest case, where the unused template function can simply be removed. Other cases need different approaches, as their usage depends on the actual TU they are compiled in. Those are left for follow-ups.

    While cleaning up src/test/fuzz/deserialize.cpp, another suggestion has been addressed.

  2. DrahtBot added the label Fuzzing on Jul 7, 2026
  3. DrahtBot commented at 3:56 PM on July 7, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

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

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process.

    Type Reviewers
    ACK maflcko, brunoerg, frankomosh
    Stale ACK pablomartin4btc, l0rinc

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  4. pablomartin4btc commented at 6:10 PM on July 7, 2026: member

    ACK 8c0c5a0e23314d5918447e43a80c12f7f0720392

    It was originally added in https://github.com/bitcoin/bitcoin/commit/fac81affb527132945773a5315bd27fec61ec52f but I couldn't find it ever being called.

  5. l0rinc approved
  6. l0rinc commented at 6:11 PM on July 7, 2026: contributor

    ACK 8c0c5a0e23314d5918447e43a80c12f7f0720392

    It seems only the two-param DeserializeFromFuzzingInput overload is ever used.

  7. maflcko commented at 6:28 PM on July 7, 2026: member

    Hmm, looks like this is unused since I added it in commit fac81affb52?

    In any case, removing makes sense, because ser-params should just be embedded into the object itself, not passed as a separate param.

    This works here, because only Serialize is called and that doesn't need to construct a new object. If you want, you can remove Serialize with separate ser-param param completely:

    diff --git a/src/test/fuzz/deserialize.cpp b/src/test/fuzz/deserialize.cpp
    index 8e8ab53e38..152b0156d6 100644
    --- a/src/test/fuzz/deserialize.cpp
    +++ b/src/test/fuzz/deserialize.cpp
    @@ -59,10 +59,2 @@ struct invalid_fuzzing_input_exception : public std::exception {
     
    -template <typename T, typename P>
    -DataStream Serialize(const T& obj, const P& params)
    -{
    -    DataStream ds{};
    -    ds << params(obj);
    -    return ds;
    -}
    -
     template <typename T, typename P>
    @@ -129,3 +121,3 @@ void AssertEqualAfterSerializeDeserialize(const T& obj, const P& params)
     {
    -    assert(Deserialize<T>(Serialize(obj, params), params) == obj);
    +    assert(Deserialize<T>(Serialize(params(obj)), params) == obj);
     }
    
  8. brunoerg approved
  9. brunoerg commented at 1:26 PM on July 8, 2026: contributor

    code review ACK 8c0c5a0e23314d5918447e43a80c12f7f0720392

  10. maflcko commented at 7:24 AM on July 9, 2026: member

    I think it is tedious to off-load the context fetching to reviewers. The trigger and larger context seems to from a new clang warning:

    [16:43] <hebasto> new `-Wunused-template` in clang snapshot builds -- https://my.cdash.org/index.php?project=bitcoin-core&date=2026-07-07
    

    https://my.cdash.org/index.php?project=bitcoin-core&date=2026-07-07

    The pull description is completely empty on this. Also, there are no replies to review comments, so I am not sure what the goal here is:

    • Try to fix the new clang warning? If so, then changes are missing here and this is incomplete?
    • Try to clean up the fuzz target code? If so, then the changes are also incomplete, because I think if you remove this call to Serialize(obj, params), then the other one should be removed as well: #35679 (comment)

    No objection, and this is obviously fine to merge, but it would be better to think about review before opening a pull (or at least putting it in draft).

    Also, it would be good to add a short pull description.

  11. hebasto marked this as a draft on Jul 9, 2026
  12. fuzz: Remove unused `DeserializeFromFuzzingInput` params overload
    This overload has been unused since it was added in fac81affb527132945773a5315bd27fec61ec52f.
    efa7f8c143
  13. fuzz, refactor: Remove `Serialize` overload
    Serialization parameters should be embedded into the object being
    serialized rather than passed as a separate argument. This works here
    because only serialization is performed and no new object needs to be
    constructed.
    afab8d4225
  14. hebasto force-pushed on Jul 16, 2026
  15. hebasto marked this as ready for review on Jul 16, 2026
  16. hebasto added the label Refactoring on Jul 16, 2026
  17. hebasto commented at 2:24 PM on July 16, 2026: member
    1. The PR description has been updated.
    2. Feedback from @maflcko has been addressed; his suggestion has been incorporated.
    3. Rebased.
    4. Undrafted.
  18. maflcko commented at 2:56 PM on July 16, 2026: member

    lgtm ACK afab8d4225c720f8d8658d4ea134505b3d9531f9

  19. DrahtBot requested review from pablomartin4btc on Jul 16, 2026
  20. DrahtBot requested review from l0rinc on Jul 16, 2026
  21. DrahtBot requested review from brunoerg on Jul 16, 2026
  22. brunoerg commented at 8:43 PM on July 16, 2026: contributor

    reACK afab8d4225c720f8d8658d4ea134505b3d9531f9

  23. frankomosh commented at 11:48 AM on July 17, 2026: contributor

    Review ACK afab8d4225c720f8d8658d4ea134505b3d9531f9

  24. fanquake merged this on Jul 17, 2026
  25. fanquake closed this on Jul 17, 2026

  26. hebasto deleted the branch on Jul 17, 2026
  27. Kino1994 referenced this in commit cc292590f2 on Jul 19, 2026
  28. fanquake referenced this in commit 504ded6b0e on Jul 20, 2026
  29. fanquake referenced this in commit 444f2d7965 on Jul 20, 2026
  30. fanquake commented at 8:22 AM on July 20, 2026: member

    Backported to 31.x in #35699.


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-07-22 07:50 UTC

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