test(zcash): restore transparent-output PCZT coverage
What changed, and why it matters
This commit only adds a new automated test for the Zcash cryptocurrency code. It restores test coverage to make sure that an Orchard (privacy-focused) transaction with a regular transparent output is still accepted by the validation logic. There are no changes to production code, user-facing behavior, or security-sensitive logic.
No security action needed. This is a test-only change and can be treated as routine quality assurance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff adds a single unit test under #[cfg(all(test, feature = “cypherpunk”))] in rust/apps/zcash/src/pczt/check.rs. The test constructs a PCZT (Partially Created Zcash Transaction) by combining an Orchard sample with a transparent-output bundle, then calls check_pczt_orchard to verify it passes validation. No production functions are modified; only test code is added.
Changed components
rust/apps/zcash/src/pczt/check.rs (test code only)Inspect captured patch +44 / −0
diff --git a/rust/apps/zcash/src/pczt/check.rs b/rust/apps/zcash/src/pczt/check.rs
index ca9d8f7..b67aa4d 100644
--- a/rust/apps/zcash/src/pczt/check.rs
+++ b/rust/apps/zcash/src/pczt/check.rs
@@ -662,3 +662,47 @@ fn check_restricted_zero_value_output(
Ok(())
}
+
+#[cfg(all(test, feature = "cypherpunk"))]
+mod tests {
+ use serde::{Deserialize, Serialize};
+
+ use super::*;
+
+ #[derive(Serialize, Deserialize)]
+ struct PcztWirePrefix {
+ global: ::pczt::common::Global,
+ transparent: Option<::pczt::transparent::Bundle>,
+ sapling: Option<::pczt::sapling::Bundle>,
+ }
+
+ #[test]
+ fn check_orchard_accepts_pczt_with_transparent_output() {
+ let orchard_sample = crate::pczt::test_support::sample_orchard_change_pczt();
+ let transparent_sample = crate::pczt::legacy_test_support::legacy_transparent_v6_sample();
+ let (mut prefix, orchard_bundles) =
+ postcard::take_from_bytes::<PcztWirePrefix>(&orchard_sample.bytes[8..]).unwrap();
+ let (transparent_prefix, _) =
+ postcard::take_from_bytes::<PcztWirePrefix>(&transparent_sample.bytes[8..]).unwrap();
+ prefix.transparent = transparent_prefix.transparent;
+
+ let mut bytes = orchard_sample.bytes[..8].to_vec();
+ bytes = postcard::to_extend(&prefix, bytes).unwrap();
+ bytes.extend_from_slice(orchard_bundles);
+ let pczt = Pczt::parse(&bytes).unwrap();
+ let ufvk = UnifiedFullViewingKey::decode(
+ &crate::pczt::test_support::Nu6_3Network,
+ &orchard_sample.ufvk_text,
+ )
+ .unwrap();
+
+ check_pczt_orchard(
+ &crate::pczt::test_support::Nu6_3Network,
+ &orchard_sample.seed_fingerprint,
+ zip32::AccountId::ZERO,
+ &ufvk,
+ &pczt,
+ )
+ .expect("valid Orchard spend with a transparent output should pass checking");
+ }
+}
Why this scored 13/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.