fuzz: exercise `ComputeMerkleRoot` without mutated parameter
What changed, and why it matters
This is a one-line change to a fuzz test file. It expands test coverage so that the fuzzer sometimes passes a null pointer to a function that computes Merkle roots, exercising a code path that previously wasn't tested. It does not change any production code, consensus rules, or network behavior.
No security action needed. This is a routine fuzzing coverage improvement.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit modifies src/test/fuzz/merkle.cpp. Previously the fuzz target always called ComputeMerkleRoot(tx_hashes, &mutated). Now it randomly passes nullptr instead of &mutated about half the time. This tests the overload/pointer-handling behavior of ComputeMerkleRoot in the no-mutation-output case. No implementation code is changed.
Changed components
src/test/fuzz/merkle.cppInspect captured patch +1 / −1
diff --git a/src/test/fuzz/merkle.cpp b/src/test/fuzz/merkle.cpp
index 9ba461bb..ad56b3ed 100644
--- a/src/test/fuzz/merkle.cpp
+++ b/src/test/fuzz/merkle.cpp
@@ -52,7 +52,7 @@ FUZZ_TARGET(merkle)
// Test ComputeMerkleRoot
bool mutated = fuzzed_data_provider.ConsumeBool(); // output param, initial value shouldn't matter
- const uint256 merkle_root = ComputeMerkleRoot(tx_hashes, &mutated);
+ const uint256 merkle_root = ComputeMerkleRoot(tx_hashes, fuzzed_data_provider.ConsumeBool() ? &mutated : nullptr);
// Basic sanity checks for ComputeMerkleRoot
if (tx_hashes.size() == 1) {
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.