What changed, and why it matters
This commit only adds the serde library as a dependency to a Rust Bitcoin sub-crate and wires up feature flags. It does not change any logic, parsing, serialization, or security-sensitive code. There is no indication of a vulnerability or security fix.
No security action required. Treat as routine dependency/feature plumbing.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit adds serde as an optional dependency to the consensus_encoding crate, updates Cargo.toml feature flags to propagate serde features, and re-exports serde in lib.rs behind a feature gate. It also updates lock files. No executable code paths are modified.
Changed components
consensus_encoding/Cargo.tomlconsensus_encoding/src/lib.rsbitcoin/Cargo.tomlprimitives/Cargo.tomlCargo-minimal.lockCargo-recent.lockInspect captured patch +9 / −4
diff --git a/Cargo-minimal.lock b/Cargo-minimal.lock
index d4ceae3a..9dfa6bc7 100644
--- a/Cargo-minimal.lock
+++ b/Cargo-minimal.lock
@@ -113,6 +113,7 @@ version = "1.0.0"
dependencies = [
"bitcoin-internals 0.5.0",
"hex-conservative 1.1.0",
+ "serde",
]
[[package]]
diff --git a/Cargo-recent.lock b/Cargo-recent.lock
index 3da5568e..56e8021d 100644
--- a/Cargo-recent.lock
+++ b/Cargo-recent.lock
@@ -112,6 +112,7 @@ version = "1.0.0"
dependencies = [
"bitcoin-internals 0.5.0",
"hex-conservative 1.1.0",
+ "serde",
]
[[package]]
diff --git a/bitcoin/Cargo.toml b/bitcoin/Cargo.toml
index 9b44eb55..436dd136 100644
--- a/bitcoin/Cargo.toml
+++ b/bitcoin/Cargo.toml
@@ -19,7 +19,7 @@ exclude = ["tests", "contrib"]
default = [ "std", "secp-recovery" ]
std = ["base58/std", "bech32/std", "crypto/std", "key-expression/std", "encoding/std", "hashes/std", "hex/std", "internals/std", "io/std", "network/std", "primitives/std", "secp256k1/std", "taproot-primitives/std", "units/std", "base64?/std", "bitcoinconsensus?/std"]
rand = ["secp256k1/rand", "crypto/rand"]
-serde = ["base64", "crypto/serde", "dep:serde", "hashes/serde", "internals/serde", "key-expression/serde", "network/serde", "primitives/serde", "secp256k1/serde", "taproot-primitives/serde", "units/serde"]
+serde = ["base64", "crypto/serde", "dep:serde", "encoding/serde", "hashes/serde", "internals/serde", "key-expression/serde", "network/serde", "primitives/serde", "secp256k1/serde", "taproot-primitives/serde", "units/serde"]
secp-global-context = ["secp256k1/global-context"]
secp-lowmemory = ["secp256k1/lowmemory"]
secp-recovery = ["secp256k1/recovery"]
diff --git a/consensus_encoding/Cargo.toml b/consensus_encoding/Cargo.toml
index c9a99d08..eeabedcf 100644
--- a/consensus_encoding/Cargo.toml
+++ b/consensus_encoding/Cargo.toml
@@ -16,13 +16,14 @@ exclude = ["api", "tests", "contrib"]
[features]
default = ["std"]
-std = ["alloc", "internals/std", "hex?/std"]
-alloc = ["internals/alloc", "hex?/alloc"]
+std = ["alloc", "internals/std", "hex?/std", "serde?/std"]
+alloc = ["internals/alloc", "hex?/alloc", "serde?/alloc"]
[dependencies]
internals = { package = "bitcoin-internals", path = "../internals", version = "0.5.0" }
hex = { package = "hex-conservative", version = "1.1.0", default-features = false, features = [], optional = true }
+serde = { version = "1.0.195", default-features = false, features = ["derive"], optional = true }
[dev-dependencies]
hex = { package = "hex-conservative", version = "1.1.0" }
diff --git a/consensus_encoding/src/lib.rs b/consensus_encoding/src/lib.rs
index a5c5e95b..8ee7e83e 100644
--- a/consensus_encoding/src/lib.rs
+++ b/consensus_encoding/src/lib.rs
@@ -78,6 +78,8 @@ extern crate std;
#[cfg(feature = "hex")]
pub extern crate hex;
+#[cfg(feature = "serde")]
+pub extern crate serde;
mod compact_size;
mod decode;
diff --git a/primitives/Cargo.toml b/primitives/Cargo.toml
index 02f48cad..20848fa4 100644
--- a/primitives/Cargo.toml
+++ b/primitives/Cargo.toml
@@ -17,7 +17,7 @@ exclude = ["api", "tests", "contrib"]
default = ["std", "hex"]
std = ["alloc", "hashes/std", "hex?/std", "internals/std", "units/std"]
alloc = ["hashes/alloc", "hex?/alloc", "internals/alloc", "units/alloc"]
-serde = ["dep:serde", "hashes/serde", "internals/serde", "units/serde", "alloc", "hex"]
+serde = ["dep:serde", "encoding/serde", "hashes/serde", "internals/serde", "units/serde", "alloc", "hex"]
arbitrary = ["dep:arbitrary", "units/arbitrary"]
hex = ["dep:hex", "hashes/hex", "internals/hex", "encoding/hex"]
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.