Skip to content

Commit faf2d51

Browse files
author
MarcoFalke
committed
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] ------------------ ...
1 parent fa98455 commit faf2d51

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/test/fuzz/p2p_headers_presync.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ void HeadersSyncSetup::ResetAndInitialize()
5454
auto& connman = static_cast<ConnmanTestMsg&>(*m_node.connman);
5555
connman.StopNodes();
5656

57-
NodeId id{0};
57+
static NodeId id{0};
5858
std::vector<ConnectionType> conn_types = {
5959
ConnectionType::OUTBOUND_FULL_RELAY,
6060
ConnectionType::BLOCK_RELAY,

0 commit comments

Comments
 (0)