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
This commit is contained in:
MarcoFalke 2025-04-09 17:58:20 +02:00
parent faf4c1b6fc
commit faa3ce3199
No known key found for this signature in database

View file

@ -32,6 +32,12 @@ public:
PeerManager::Options peerman_opts; PeerManager::Options peerman_opts;
node::ApplyArgsManOptions(*m_node.args, peerman_opts); node::ApplyArgsManOptions(*m_node.args, peerman_opts);
peerman_opts.max_headers_result = FUZZ_MAX_HEADERS_RESULTS; peerman_opts.max_headers_result = FUZZ_MAX_HEADERS_RESULTS;
// The peerman's rng is a global that is re-used, so it will be re-used
// and may cause non-determinism between runs. This may even influence
// the global RNG, because seeding may be done from the gloabl one. For
// now, avoid it influencing the global RNG, and initialize it with a
// constant instead.
peerman_opts.deterministic_rng = true;
// No txs are relayed. Disable irrelevant and possibly // No txs are relayed. Disable irrelevant and possibly
// non-deterministic code paths. // non-deterministic code paths.
peerman_opts.ignore_incoming_txs = true; peerman_opts.ignore_incoming_txs = true;