refactor: split sign functionality
What changed, and why it matters
This commit is a straightforward code cleanup that renames two internal signing functions to avoid a naming conflict. It does not change what the code does, only how it is organized. There is no indication of a security bug being fixed.
No security action required. Treat as routine refactoring. Standard code review is sufficient.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch splits a previously overloaded sign function in rust/zcash_vendor/src/pczt_ext.rs into two feature-gated variants: sign_transparent (for the multi_coins feature) and sign_full (for the cypherpunk feature). The caller in rust/apps/zcash/src/pczt/sign.rs is updated to invoke the appropriate function based on the active feature. The function bodies and behavior are unchanged; this is a pure refactor to resolve a name collision between mutually exclusive feature-gated implementations.
Changed components
rust/apps/zcash/src/pczt/sign.rsrust/zcash_vendor/src/pczt_ext.rsInspect captured patch +7 / −3
diff --git a/rust/apps/zcash/src/pczt/sign.rs b/rust/apps/zcash/src/pczt/sign.rs
index d862030..1865add 100644
--- a/rust/apps/zcash/src/pczt/sign.rs
+++ b/rust/apps/zcash/src/pczt/sign.rs
@@ -105,7 +105,11 @@ impl PcztSigner for SeedSigner<'_> {
pub fn sign_pczt(pczt: Pczt, seed: &[u8]) -> crate::Result<Vec<u8>> {
let signer = low_level_signer::Signer::new(pczt);
- let signer = pczt_ext::sign(signer, &SeedSigner { seed })
+ #[cfg(feature = "multi_coins")]
+ let signer = pczt_ext::sign_transparent(signer, &SeedSigner { seed })
+ .map_err(|e| ZcashError::SigningError(e.to_string()))?;
+ #[cfg(feature = "cypherpunk")]
+ let signer = pczt_ext::sign_full(signer, &SeedSigner { seed })
.map_err(|e| ZcashError::SigningError(e.to_string()))?;
// Now that we've created the signature, remove the other optional fields from the
diff --git a/rust/zcash_vendor/src/pczt_ext.rs b/rust/zcash_vendor/src/pczt_ext.rs
index 4d9e52f..67e15cd 100644
--- a/rust/zcash_vendor/src/pczt_ext.rs
+++ b/rust/zcash_vendor/src/pczt_ext.rs
@@ -390,7 +390,7 @@ fn transparent_sig_digest(pczt: &Pczt, input_info: Option<SignableInput>) -> Has
}
#[cfg(feature = "multi_coins")]
-pub fn sign<T>(llsigner: Signer, signer: &T) -> Result<Signer, T::Error>
+pub fn sign_transparent<T>(llsigner: Signer, signer: &T) -> Result<Signer, T::Error>
where
T: PcztSigner,
T::Error: From<transparent::pczt::ParseError>,
@@ -429,7 +429,7 @@ where
}
#[cfg(feature = "cypherpunk")]
-pub fn sign<T>(llsigner: Signer, signer: &T) -> Result<Signer, T::Error>
+pub fn sign_full<T>(llsigner: Signer, signer: &T) -> Result<Signer, T::Error>
where
T: PcztSigner,
T::Error: From<transparent::pczt::ParseError>,
Why this scored 17/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.