Remove Secp256k1 variant from taproot SigFromSliceError
What changed, and why it matters
This commit removes an unused error category from a Bitcoin cryptography library. It is a cleanup change because the underlying signature-parsing code can no longer fail in the way that error category described. There is no direct evidence this fixes an active security bug, but it does slightly reduce the library's public error surface, which can help downstream code handle errors more reliably.
Treat as a routine cleanup/API-shrinking commit. Review downstream callers that pattern-match on `SigFromSliceError::Secp256k1` because they will fail to compile after this change. No immediate security response is indicated by the diff or commit message.
Security signals we found
Public error enum variant removed (API surface reduction)
Removal of `From<secp256k1::Error>` conversion
No new input validation, bounds checks, or cryptographic operations added
Evidence from the diff
The patch deletes the Secp256k1 variant from taproot::SigFromSliceError in crypto/src/taproot.rs, along with its Display and std::error::Error::source arms and the From<secp256k1::Error> conversion. The commit message states that secp256k1 signature parsing is now infallible, so this variant is dead code. This is an API-shrinking refactor; it does not change parsing logic or add bounds checks.
Changed components
crypto/src/taproot.rstaproot::SigFromSliceErrorFrom<secp256k1::Error> for SigFromSliceErrorInspect captured patch +0 / −8
diff --git a/crypto/src/taproot.rs b/crypto/src/taproot.rs
index 9f39ecf0..02c6aa63 100644
--- a/crypto/src/taproot.rs
+++ b/crypto/src/taproot.rs
@@ -453,8 +453,6 @@ pub mod error {
pub enum SigFromSliceError {
/// Invalid signature hash type.
SighashType(InvalidSighashTypeError),
- /// A secp256k1 error.
- Secp256k1(secp256k1::Error),
/// Invalid Taproot signature size
InvalidSignatureSize(usize),
}
@@ -467,7 +465,6 @@ pub mod error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
Self::SighashType(ref e) => write_err!(f, "sighash"; e),
- Self::Secp256k1(ref e) => write_err!(f, "secp256k1"; e),
Self::InvalidSignatureSize(sz) =>
write!(f, "invalid Taproot signature size: {}", sz),
}
@@ -478,17 +475,12 @@ pub mod error {
impl std::error::Error for SigFromSliceError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
match self {
- Self::Secp256k1(ref e) => Some(e),
Self::SighashType(ref e) => Some(e),
Self::InvalidSignatureSize(_) => None,
}
}
}
- impl From<secp256k1::Error> for SigFromSliceError {
- fn from(e: secp256k1::Error) -> Self { Self::Secp256k1(e) }
- }
-
impl From<InvalidSighashTypeError> for SigFromSliceError {
fn from(err: InvalidSighashTypeError) -> Self { Self::SighashType(err) }
}
Why this scored 19/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.