use correct 32-byte witness reserved value
What changed, and why it matters
This is a tiny fix inside a fuzz test (automated random-input test) for the rust-bitcoin library. It changes the placeholder value used when computing a Bitcoin witness commitment from an empty byte slice to the correct 32-byte all-zero value required by the Bitcoin protocol (BIP-141). The change only affects test code, not the library that real users run, so it does not create a security vulnerability in the shipped software. It is a correctness improvement to make the fuzz test exercise the real code path more faithfully.
No security action required. Treat as a normal test-quality fix. If reviewing, consider whether other fuzz targets use similarly incorrect placeholder values for consensus-critical parameters.
Security signals we found
BIP-141 consensus parameter corrected in test code
No change to library implementation or public API
No memory safety, panic, or cryptographic weakness introduced
No vendor security disclosure or CVE references present
Evidence from the diff
The commit modifies fuzz/fuzz_targets/bitcoin/arbitrary_block.rs. The fuzz target manually calls block::compute_witness_commitment with a reserved value. Previously it passed an empty slice (&[]) with a TODO questioning whether that was acceptable. The patch passes &[0u8; 32], matching BIP-141’s 32-byte witness reserved value. This is a test-only change; compute_witness_commitment itself is unchanged. The empty slice would likely have caused the commitment computation to deviate from consensus behavior, potentially reducing fuzzing coverage or causing false assumptions, but it did not expose a runtime vulnerability in the library.
Changed components
fuzz/fuzz_targets/bitcoin/arbitrary_block.rsInspect captured patch +2 / −1
diff --git a/fuzz/fuzz_targets/bitcoin/arbitrary_block.rs b/fuzz/fuzz_targets/bitcoin/arbitrary_block.rs
index 79bd2ada..f8f38478 100644
--- a/fuzz/fuzz_targets/bitcoin/arbitrary_block.rs
+++ b/fuzz/fuzz_targets/bitcoin/arbitrary_block.rs
@@ -13,7 +13,8 @@ fn do_test(data: &[u8]) {
// Manually call all compute functions with unchecked block data.
let (header, transactions) = block.clone().into_parts();
block::compute_merkle_root(&transactions);
- block::compute_witness_commitment(&transactions, &[]); // TODO: Is empty slice ok?
+ // Use 32-byte zero array as witness_reserved_value per BIP-0141 requirement.
+ block::compute_witness_commitment(&transactions, &[0u8; 32]);
block::compute_witness_root(&transactions);
if let Ok(block) = Block::new_checked(header, transactions) {
Why this scored 17/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.