From faf2d512c529db9ec7edd14bb2cd3e75f037489c Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Mon, 7 Apr 2025 14:02:01 +0200 Subject: [PATCH] fuzz: Move global node id counter along with other global state The global m_headers_presync_stats is not reset in ResetAndInitialize. This may lead to non-determinism. Fix it by incrementing the global node id counter instead. Without this patch, the tool would report a diff: cargo run --manifest-path ./contrib/devtools/deterministic-fuzz-coverage/Cargo.toml -- $PWD/bld-cmake/ $PWD/../qa-assets/fuzz_corpora/ p2p_headers_presync 32 ... 2587| 3.73k| if (best_it == m_headers_presync_stats.end()) { ------------------ - | Branch (2587:17): [True: 80, False: 3.65k] + | Branch (2587:17): [True: 73, False: 3.66k] ------------------ ... --- src/test/fuzz/p2p_headers_presync.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/fuzz/p2p_headers_presync.cpp b/src/test/fuzz/p2p_headers_presync.cpp index 40e57254b1c..43e6493ae35 100644 --- a/src/test/fuzz/p2p_headers_presync.cpp +++ b/src/test/fuzz/p2p_headers_presync.cpp @@ -54,7 +54,7 @@ void HeadersSyncSetup::ResetAndInitialize() auto& connman = static_cast(*m_node.connman); connman.StopNodes(); - NodeId id{0}; + static NodeId id{0}; std::vector conn_types = { ConnectionType::OUTBOUND_FULL_RELAY, ConnectionType::BLOCK_RELAY,