Merge bitcoin/bitcoin#31282: refactor: Make node_id a const& in RemoveBlockRequest

fa21f83d29 ci: Use G++ in valgrind tasks (MarcoFalke)
fabd05bf65 refactor: Fix net_processing iwyu includes (MarcoFalke)
fa1622db20 refactor: Make node_id a const& in RemoveBlockRequest (MarcoFalke)

Pull request description:

  Currently, `valgrind` is not usable on a default build with GCC. Specifically, `p2p_compactblocks.py --valgrind` gives a false-positive in `RemoveBlockRequest` when comparing `node_id` with `from_peer`. According to the upstream bug report, this happens because both symbols are on the stack and the compiler can more aggressively optimize the compare (order). See https://bugs.kde.org/show_bug.cgi?id=472329#c7

  It is possible to work around this bug by pulling at least one value from the stack. For example, by making `from_peer` a `const` reference. Alternatively, by replacing `auto [node_id, list_it]` with `const auto& [node_id, list_it]`, which is done here.

  I think this workaround is acceptable, because it does not look like valgrind can trivially fix this. The alternative would be to add a (temporary?) suppression.

  Fixes https://github.com/bitcoin/bitcoin/issues/27741

  Also, fix iwyu includes, while touching this module.

  Also, switch the CI valgrind scripts to use G++.

ACKs for top commit:
  achow101:
    ACK fa21f83d29
  TheCharlatan:
    ACK fa21f83d29
  darosior:
    utACK fa21f83d29
  ryanofsky:
    Code review ACK fa21f83d29. Code changes all look good but I'm a little confused about purpose of the third commit, so left a question about that

Tree-SHA512: 7b92cdafd525a5ac53ae2c1a7a92e599bc9b5fd5d315a694b493cd5079ac323d884393b57aa18581b7789247a588c9a27d47698de25b340bc76fc9f1dd1850b4
This commit is contained in:
Ava Chow
2025-04-14 14:22:56 -07:00
5 changed files with 54 additions and 18 deletions

View File

@ -12,9 +12,8 @@
# --error-limit=no build/bin/test_bitcoin
#
# Note that suppressions may depend on OS and/or library versions.
# Tested on:
# * aarch64 (Ubuntu Noble system libs, clang, without gui)
# * x86_64 (Ubuntu Noble system libs, clang, without gui)
# Tested on aarch64 and x86_64 with Ubuntu Noble system libs, using clang-16
# and GCC, without gui.
{
Suppress libdb warning - https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=662917
Memcheck:Cond