What changed, and why it matters
This is a routine code-maintenance change. The developers replaced one way of reading hexadecimal strings with another, because the old helper tool (the `FromHex` trait) is being removed in an upcoming version of a dependency. The function being changed is already marked as deprecated, so it is not the preferred way to do things. There is no indication this fixes a security bug or introduces a vulnerability.
No security action required. Treat as normal dependency-compatibility cleanup. Downstream users relying on the deprecated `from_hex` error type should note the changed return error type.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit updates ScriptBuf::from_hex in bitcoin/src/blockdata/script/owned.rs to stop using hex_unstable::FromHex and instead delegate to Self::from_hex_no_length_prefix(s), returning hex::DecodeVariableLengthBytesError. This is a compatibility refactor ahead of hex v1.1.0 removing the FromHex trait. The deprecated function’s signature changes its error type, which is a minor API change but not a security-relevant one.
Changed components
bitcoin/src/blockdata/script/owned.rsdeprecated `ScriptBuf::from_hex` functionInspect captured patch +2 / −4
diff --git a/bitcoin/src/blockdata/script/owned.rs b/bitcoin/src/blockdata/script/owned.rs
index 32227965..eb0fca18 100644
--- a/bitcoin/src/blockdata/script/owned.rs
+++ b/bitcoin/src/blockdata/script/owned.rs
@@ -3,7 +3,6 @@
#[cfg(doc)]
use core::ops::Deref;
-use hex_unstable::FromHex as _;
use internals::ToU64 as _;
use super::{
@@ -157,11 +156,10 @@ internal_macros::define_extension_trait! {
/// Constructs a new [`ScriptBuf`] from a hex string.
#[deprecated(since = "TBD", note = "use `from_hex_no_length_prefix()` instead")]
- fn from_hex(s: &str) -> Result<Self, hex_unstable::HexToBytesError>
+ fn from_hex(s: &str) -> Result<Self, hex::DecodeVariableLengthBytesError>
where Self: Sized
{
- let v = Vec::from_hex(s)?;
- Ok(Self::from_bytes(v))
+ Self::from_hex_no_length_prefix(s)
}
/// Constructs a new [`ScriptBuf`] from a hex string.
Why this scored 18/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.