refactor(zcash): simplify unsupported PCZT helpers
What changed, and why it matters
This is a simple code cleanup: three internal helper functions in the Zcash PCZT handling code are renamed to remove the word 'legacy' from their names. The actual behavior and security checks stay exactly the same. There is no functional change and no security fix or vulnerability introduced.
No security action required. Treat as ordinary refactoring.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit renames reject_legacy_check_unsupported_pczt, reject_legacy_parse_unsupported_pczt, and reject_legacy_unsupported_pczt to a uniform reject_unsupported_pczt in lib.rs, pczt/parse.rs, and pczt/sign.rs respectively. The call sites and function bodies are unchanged apart from the identifiers. The guards still reject shielded Sapling/Orchard/Ironwood and V6 PCZTs in the non-cypherpunk / multi_coins build paths. No logic, control flow, or data handling changes.
Changed components
rust/apps/zcash/src/lib.rsrust/apps/zcash/src/pczt/parse.rsrust/apps/zcash/src/pczt/sign.rsInspect captured patch +6 / −6
diff --git a/rust/apps/zcash/src/lib.rs b/rust/apps/zcash/src/lib.rs
index 6e46d2b..a0a97ff 100644
--- a/rust/apps/zcash/src/lib.rs
+++ b/rust/apps/zcash/src/lib.rs
@@ -188,7 +188,7 @@ pub fn check_pczt_multi_coins<P: consensus::Parameters>(
// FUTURE(omitted-field-recompute): recompute-or-check omitted fields here,
// mutating `pczt` so the normalized bytes carry the verified values forward.
// transparent-only build: pczt's orchard feature (and resolve_fields) is not compiled here.
- reject_legacy_check_unsupported_pczt(&pczt)?;
+ reject_unsupported_pczt(&pczt)?;
let account_pubkey = transparent_account_pubkey_from_xpub(xpub)?;
let account_index = zip32::AccountId::try_from(account_index)
.map_err(|_e| ZcashError::InvalidDataError("invalid account index".to_string()))?;
@@ -230,7 +230,7 @@ fn transparent_account_pubkey_from_xpub(
}
#[cfg(feature = "multi_coins")]
-fn reject_legacy_check_unsupported_pczt(pczt: &Pczt) -> Result<()> {
+fn reject_unsupported_pczt(pczt: &Pczt) -> Result<()> {
{
// The legacy multi-coins check path only verifies transparent data. Reject any
// shielded (Sapling/Orchard/Ironwood) or V6 PCZT so check, parse, and sign
diff --git a/rust/apps/zcash/src/pczt/parse.rs b/rust/apps/zcash/src/pczt/parse.rs
index 26d87d0..26a1084 100644
--- a/rust/apps/zcash/src/pczt/parse.rs
+++ b/rust/apps/zcash/src/pczt/parse.rs
@@ -395,7 +395,7 @@ pub fn parse_pczt_multi_coins<P: consensus::Parameters>(
pczt: &Pczt,
) -> Result<ParsedPczt, ZcashError> {
super::validate_supported_pczt(pczt)?;
- reject_legacy_parse_unsupported_pczt(pczt)?;
+ reject_unsupported_pczt(pczt)?;
let mut parsed_transparent = None;
@@ -430,7 +430,7 @@ pub fn parse_pczt_multi_coins<P: consensus::Parameters>(
}
#[cfg(feature = "multi_coins")]
-fn reject_legacy_parse_unsupported_pczt(pczt: &Pczt) -> Result<(), ZcashError> {
+fn reject_unsupported_pczt(pczt: &Pczt) -> Result<(), ZcashError> {
{
// The legacy multi-coins parser only displays transparent data. Reject any
// shielded (Sapling/Orchard/Ironwood) or V6 PCZT instead of showing an
diff --git a/rust/apps/zcash/src/pczt/sign.rs b/rust/apps/zcash/src/pczt/sign.rs
index 023c862..a48190c 100644
--- a/rust/apps/zcash/src/pczt/sign.rs
+++ b/rust/apps/zcash/src/pczt/sign.rs
@@ -83,7 +83,7 @@ impl PcztSigner for SeedSigner<'_> {
#[cfg(not(feature = "cypherpunk"))]
pub fn sign_pczt(pczt: Pczt, seed: &[u8]) -> crate::Result<Vec<u8>> {
super::validate_supported_pczt(&pczt)?;
- reject_legacy_unsupported_pczt(&pczt)?;
+ reject_unsupported_pczt(&pczt)?;
let signer = low_level_signer::Signer::new(pczt);
@@ -97,7 +97,7 @@ pub fn sign_pczt(pczt: Pczt, seed: &[u8]) -> crate::Result<Vec<u8>> {
}
#[cfg(not(feature = "cypherpunk"))]
-fn reject_legacy_unsupported_pczt(pczt: &Pczt) -> Result<(), ZcashError> {
+fn reject_unsupported_pczt(pczt: &Pczt) -> Result<(), ZcashError> {
{
// The legacy helper below carries the pre-NU6.3 transparent sighash implementation.
// It must not be used for shielded (Sapling/Orchard/Ironwood) or V6 PCZTs.
Why this scored 14/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.