Skip to content

Commit faa3ce3

Browse files
author
MarcoFalke
committed
fuzz: Avoid influence on the global RNG from peerman m_rng
This should avoid the remaining non-determistic code coverage paths. Without this patch, the tool would report a diff (only when running without libFuzzer): cargo run --manifest-path ./contrib/devtools/deterministic-fuzz-coverage/Cargo.toml -- $PWD/bld-cmake/ $PWD/../qa-assets/fuzz_corpora/ p2p_headers_presync 32
1 parent faf4c1b commit faa3ce3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/test/fuzz/p2p_headers_presync.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ class HeadersSyncSetup : public TestingSetup
3232
PeerManager::Options peerman_opts;
3333
node::ApplyArgsManOptions(*m_node.args, peerman_opts);
3434
peerman_opts.max_headers_result = FUZZ_MAX_HEADERS_RESULTS;
35+
// The peerman's rng is a global that is re-used, so it will be re-used
36+
// and may cause non-determinism between runs. This may even influence
37+
// the global RNG, because seeding may be done from the gloabl one. For
38+
// now, avoid it influencing the global RNG, and initialize it with a
39+
// constant instead.
40+
peerman_opts.deterministic_rng = true;
3541
// No txs are relayed. Disable irrelevant and possibly
3642
// non-deterministic code paths.
3743
peerman_opts.ignore_incoming_txs = true;

0 commit comments

Comments
 (0)