Add test for LeafVersion formatting change
What changed, and why it matters
This commit only adds a new test to verify the text output format of a special internal value called LeafVersion::Future. It does not change any production code, so it cannot introduce or fix a security vulnerability by itself. The test is meant to document that a previous formatting change was a bug fix, but this commit alone does not show what that previous change was or whether it had security implications.
No action needed for this commit. If reviewing the earlier Display patch referenced in the commit message, obtain that patch and assess whether the formatting change affected consensus-critical serialization or user-facing address/script handling.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff adds a unit test in taproot-primitives/src/lib.rs under #[cfg(test)] and feature = “alloc”. The test constructs LeafVersion::Future(FutureLeafVersion(1)) and asserts that formatting it with {:#} produces the string “future_script_0x01”. No runtime code is modified. The commit message references an earlier patch to the Display impl for LeafVersion::Future, but that patch is not included in the supplied materials.
Changed components
taproot-primitives/src/lib.rsInspect captured patch +12 / −0
diff --git a/taproot-primitives/src/lib.rs b/taproot-primitives/src/lib.rs
index 37f9e5f5..eb0b5cb6 100644
--- a/taproot-primitives/src/lib.rs
+++ b/taproot-primitives/src/lib.rs
@@ -339,3 +339,15 @@ impl<'a> Arbitrary<'a> for LeafVersion {
}
}
}
+
+#[cfg(test)]
+#[cfg(feature = "alloc")]
+mod test {
+ use super::*;
+
+ #[test]
+ fn leaf_version_future_fmt() {
+ let v = LeafVersion::Future(FutureLeafVersion(1));
+ assert_eq!(alloc::format!("{:#}", v), "future_script_0x01");
+ }
+}
Why this scored 11/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.