What changed, and why it matters
This commit changes a single Rust function from a regular function to a constant-evaluable function. It allows the decoder constructor to be used in compile-time contexts, but it does not fix any security bug or change runtime behavior.
No security action needed; treat as a normal API ergonomics improvement.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch marks WitnessMerkleNodeDecoder::new() as const, enabling it to be called in const contexts. The underlying call encoding::ArrayDecoder::new() must already be const for this to compile. No logic, input handling, or safety boundary is altered.
Changed components
primitives/src/hash_types/witness_merkle_node.rsInspect captured patch +1 / −1
diff --git a/primitives/src/hash_types/witness_merkle_node.rs b/primitives/src/hash_types/witness_merkle_node.rs
index 952fba8a..9319520c 100644
--- a/primitives/src/hash_types/witness_merkle_node.rs
+++ b/primitives/src/hash_types/witness_merkle_node.rs
@@ -74,7 +74,7 @@ pub struct WitnessMerkleNodeDecoder(encoding::ArrayDecoder<32>);
impl WitnessMerkleNodeDecoder {
/// Constructs a new [`WitnessMerkleNode`] decoder.
- pub fn new() -> Self { Self(encoding::ArrayDecoder::new()) }
+ pub const fn new() -> Self { Self(encoding::ArrayDecoder::new()) }
}
impl Default for WitnessMerkleNodeDecoder {
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.