From 4f894a4b7871dd7108373deaadd04a6bd35be4ff Mon Sep 17 00:00:00 2001 From: Dmitry Demin Date: Wed, 24 Jan 2024 10:15:02 +0100 Subject: [PATCH] Rename V2 name suffixes to Vanilla, and V3 - to ZSA --- benches/circuit.rs | 4 +-- benches/note_decryption.rs | 12 +++---- src/action.rs | 10 +++--- src/builder.rs | 16 ++++----- src/bundle.rs | 10 +++--- src/lib.rs | 4 +-- src/note_encryption.rs | 14 ++++---- ...ption_v2.rs => note_encryption_vanilla.rs} | 31 ++++++++--------- ...ncryption_v3.rs => note_encryption_zsa.rs} | 33 ++++++++++--------- src/test_vectors.rs | 4 +-- ...ption_v2.rs => note_encryption_vanilla.rs} | 0 ...ncryption_v3.rs => note_encryption_zsa.rs} | 0 tests/builder.rs | 12 +++---- tests/zsa.rs | 14 ++++---- 14 files changed, 83 insertions(+), 81 deletions(-) rename src/{note_encryption_v2.rs => note_encryption_vanilla.rs} (86%) rename src/{note_encryption_v3.rs => note_encryption_zsa.rs} (85%) rename src/test_vectors/{note_encryption_v2.rs => note_encryption_vanilla.rs} (100%) rename src/test_vectors/{note_encryption_v3.rs => note_encryption_zsa.rs} (100%) diff --git a/benches/circuit.rs b/benches/circuit.rs index 042b921be..c6c1a8cda 100644 --- a/benches/circuit.rs +++ b/benches/circuit.rs @@ -12,7 +12,7 @@ use orchard::{ bundle::Flags, circuit::{ProvingKey, VerifyingKey}, keys::{FullViewingKey, Scope, SpendingKey}, - note_encryption_v3::OrchardDomainV3, + note_encryption_zsa::OrchardDomainZSA, value::NoteValue, Anchor, Bundle, }; @@ -43,7 +43,7 @@ fn criterion_benchmark(c: &mut Criterion) { ) .unwrap(); } - let bundle: Bundle<_, i64, OrchardDomainV3> = builder.build(rng).unwrap(); + let bundle: Bundle<_, i64, OrchardDomainZSA> = builder.build(rng).unwrap(); let instances: Vec<_> = bundle .actions() diff --git a/benches/note_decryption.rs b/benches/note_decryption.rs index 71122fe2c..9b681e4d1 100644 --- a/benches/note_decryption.rs +++ b/benches/note_decryption.rs @@ -6,7 +6,7 @@ use orchard::{ keys::{FullViewingKey, PreparedIncomingViewingKey, Scope, SpendingKey}, note::AssetBase, note_encryption::{CompactAction, OrchardType}, - note_encryption_v3::OrchardDomainV3, + note_encryption_zsa::OrchardDomainZSA, value::NoteValue, Anchor, Bundle, }; @@ -16,7 +16,7 @@ use zcash_note_encryption_zsa::{batch, try_compact_note_decryption, try_note_dec #[cfg(unix)] use pprof::criterion::{Output, PProfProfiler}; -type OrchardV3 = OrchardType; +type OrchardZSA = OrchardType; fn bench_note_decryption(c: &mut Criterion) { let rng = OsRng; @@ -73,7 +73,7 @@ fn bench_note_decryption(c: &mut Criterion) { None, ) .unwrap(); - let bundle: Bundle<_, i64, OrchardDomainV3> = builder.build(rng).unwrap(); + let bundle: Bundle<_, i64, OrchardDomainZSA> = builder.build(rng).unwrap(); bundle .create_proof(&pk, rng) .unwrap() @@ -82,7 +82,7 @@ fn bench_note_decryption(c: &mut Criterion) { }; let action = bundle.actions().first(); - let domain = OrchardV3::for_action(action); + let domain = OrchardZSA::for_action(action); let compact = { let mut group = c.benchmark_group("note-decryption"); @@ -123,10 +123,10 @@ fn bench_note_decryption(c: &mut Criterion) { let ivks = 2; let valid_ivks = vec![valid_ivk; ivks]; let actions: Vec<_> = (0..100) - .map(|_| (OrchardV3::for_action(action), action.clone())) + .map(|_| (OrchardZSA::for_action(action), action.clone())) .collect(); let compact: Vec<_> = (0..100) - .map(|_| (OrchardV3::for_action(action), CompactAction::from(action))) + .map(|_| (OrchardZSA::for_action(action), CompactAction::from(action))) .collect(); let mut group = c.benchmark_group("batch-note-decryption"); diff --git a/src/action.rs b/src/action.rs index 750aad8f7..7a387eb5e 100644 --- a/src/action.rs +++ b/src/action.rs @@ -133,7 +133,7 @@ pub(crate) mod testing { commitment::ExtractedNoteCommitment, nullifier::testing::arb_nullifier, testing::arb_note, TransmittedNoteCiphertext, }, - note_encryption_v3::{NoteCiphertextBytes, OrchardDomainV3}, + note_encryption_zsa::{NoteCiphertextBytes, OrchardDomainZSA}, primitives::redpallas::{ self, testing::{arb_spendauth_signing_key, arb_spendauth_verification_key}, @@ -150,7 +150,7 @@ pub(crate) mod testing { rk in arb_spendauth_verification_key(), note in arb_note(output_value), asset in arb_asset_base() - ) -> Action<(), OrchardDomainV3> { + ) -> Action<(), OrchardDomainZSA> { let cmx = ExtractedNoteCommitment::from(note.commitment()); let cv_net = ValueCommitment::derive( spend_value - output_value, @@ -158,7 +158,7 @@ pub(crate) mod testing { asset ); // FIXME: make a real one from the note. - let encrypted_note = TransmittedNoteCiphertext:: { + let encrypted_note = TransmittedNoteCiphertext:: { epk_bytes: [0u8; 32], enc_ciphertext: NoteCiphertextBytes([0u8; 612]), out_ciphertext: [0u8; 80] @@ -183,7 +183,7 @@ pub(crate) mod testing { rng_seed in prop::array::uniform32(prop::num::u8::ANY), fake_sighash in prop::array::uniform32(prop::num::u8::ANY), asset in arb_asset_base() - ) -> Action, OrchardDomainV3> { + ) -> Action, OrchardDomainZSA> { let cmx = ExtractedNoteCommitment::from(note.commitment()); let cv_net = ValueCommitment::derive( spend_value - output_value, @@ -192,7 +192,7 @@ pub(crate) mod testing { ); // FIXME: make a real one from the note. - let encrypted_note = TransmittedNoteCiphertext:: { + let encrypted_note = TransmittedNoteCiphertext:: { epk_bytes: [0u8; 32], enc_ciphertext: NoteCiphertextBytes([0u8; 612]), out_ciphertext: [0u8; 80] diff --git a/src/builder.rs b/src/builder.rs index 66adeaf0f..1a67afead 100644 --- a/src/builder.rs +++ b/src/builder.rs @@ -339,7 +339,7 @@ impl Builder { } // FIXME: fix the doc, this line was removed from the doc: - // [`OrchardDomain`]: crate::note_encryption_v3::OrchardZSADomain + // [`OrchardDomain`]: crate::note_encryption_zsa::OrchardZSADomain /// Adds a note to be spent in this transaction. /// @@ -928,7 +928,7 @@ pub mod testing { keys::{testing::arb_spending_key, FullViewingKey, SpendAuthorizingKey, SpendingKey}, note::testing::arb_note, note_encryption::OrchardDomain, - note_encryption_v3::OrchardDomainV3, + note_encryption_zsa::OrchardDomainZSA, tree::{Anchor, MerkleHashOrchard, MerklePath}, value::{testing::arb_positive_note_value, NoteValue, MAX_NOTE_VALUE}, Address, Note, @@ -1041,17 +1041,17 @@ pub mod testing { /// Produce an arbitrary valid Orchard bundle using a random spending key. pub fn arb_bundle + Debug + Copy + Into>( - ) -> impl Strategy> { + ) -> impl Strategy> { arb_spending_key() .prop_flat_map(arb_bundle_inputs) - .prop_map(|inputs| inputs.into_bundle::()) + .prop_map(|inputs| inputs.into_bundle::()) } /// Produce an arbitrary valid Orchard bundle using a specified spending key. pub fn arb_bundle_with_key + Debug + Copy + Into>( k: SpendingKey, - ) -> impl Strategy> { - arb_bundle_inputs(k).prop_map(|inputs| inputs.into_bundle::()) + ) -> impl Strategy> { + arb_bundle_inputs(k).prop_map(|inputs| inputs.into_bundle::()) } } @@ -1066,7 +1066,7 @@ mod tests { circuit::ProvingKey, constants::MERKLE_DEPTH_ORCHARD, keys::{FullViewingKey, Scope, SpendingKey}, - note_encryption_v3::OrchardDomainV3, + note_encryption_zsa::OrchardDomainZSA, tree::EMPTY_ROOTS, value::NoteValue, }; @@ -1097,7 +1097,7 @@ mod tests { let balance: i64 = builder.value_balance().unwrap(); assert_eq!(balance, -5000); - let bundle: Bundle = builder + let bundle: Bundle = builder .build(&mut rng) .unwrap() .create_proof(&pk, &mut rng) diff --git a/src/bundle.rs b/src/bundle.rs index 348800744..b620dd7fe 100644 --- a/src/bundle.rs +++ b/src/bundle.rs @@ -558,7 +558,7 @@ pub mod testing { pub use crate::action::testing::{arb_action, arb_unauthorized_action}; use crate::note::asset_base::testing::arb_zsa_asset_base; use crate::note::AssetBase; - use crate::note_encryption_v3::OrchardDomainV3; + use crate::note_encryption_zsa::OrchardDomainZSA; use crate::value::testing::arb_value_sum; /// Marker for an unauthorized bundle with no proofs or signatures. @@ -573,7 +573,7 @@ pub mod testing { pub fn arb_unauthorized_action_n( n_actions: usize, flags: Flags, - ) -> impl Strategy)> { + ) -> impl Strategy)> { let spend_value_gen = if flags.spends_enabled { Strategy::boxed(arb_note_value_bounded(MAX_NOTE_VALUE / n_actions as u64)) } else { @@ -601,7 +601,7 @@ pub mod testing { ) -> impl Strategy< Value = ( ValueSum, - Action, OrchardDomainV3>, + Action, OrchardDomainZSA>, ), > { let spend_value_gen = if flags.spends_enabled { @@ -664,7 +664,7 @@ pub mod testing { anchor in arb_base().prop_map(Anchor::from), flags in Just(flags), burn in vec(arb_asset_to_burn(), 1usize..10) - ) -> Bundle { + ) -> Bundle { let (balances, actions): (Vec, Vec>) = acts.into_iter().unzip(); Bundle::from_parts( @@ -695,7 +695,7 @@ pub mod testing { fake_sighash in prop::array::uniform32(prop::num::u8::ANY), flags in Just(flags), burn in vec(arb_asset_to_burn(), 1usize..10) - ) -> Bundle { + ) -> Bundle { let (balances, actions): (Vec, Vec, >) = acts.into_iter().unzip(); let rng = StdRng::from_seed(rng_seed); diff --git a/src/lib.rs b/src/lib.rs index c142b7f30..e5279ee4e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -28,8 +28,8 @@ pub mod note; pub mod supply_info; pub mod note_encryption; -pub mod note_encryption_v2; -pub mod note_encryption_v3; +pub mod note_encryption_vanilla; +pub mod note_encryption_zsa; pub mod primitives; mod spec; diff --git a/src/note_encryption.rs b/src/note_encryption.rs index b9c4b0ffe..be1dac5bf 100644 --- a/src/note_encryption.rs +++ b/src/note_encryption.rs @@ -32,15 +32,15 @@ const NOTE_DIVERSIFIER_OFFSET: usize = NOTE_VERSION_OFFSET + NOTE_VERSION_SIZE; const NOTE_VALUE_OFFSET: usize = NOTE_DIVERSIFIER_OFFSET + NOTE_DIVERSIFIER_SIZE; const NOTE_RSEED_OFFSET: usize = NOTE_VALUE_OFFSET + NOTE_VALUE_SIZE; -/// The size of a v2 compact note. -pub const COMPACT_NOTE_SIZE_V2: usize = +/// The size of a Vanilla compact note. +pub const COMPACT_NOTE_SIZE_VANILLA: usize = NOTE_VERSION_SIZE + NOTE_DIVERSIFIER_SIZE + NOTE_VALUE_SIZE + NOTE_RSEED_SIZE; /// The size of the encoding of a ZSA asset id. const ZSA_ASSET_SIZE: usize = 32; -/// The size of a v3 compact note. -pub const COMPACT_NOTE_SIZE_V3: usize = COMPACT_NOTE_SIZE_V2 + ZSA_ASSET_SIZE; +/// The size of a ZSA compact note. +pub const COMPACT_NOTE_SIZE_ZSA: usize = COMPACT_NOTE_SIZE_VANILLA + ZSA_ASSET_SIZE; pub(crate) type Memo = [u8; MEMO_SIZE]; @@ -189,7 +189,7 @@ pub(crate) fn build_base_note_plaintext_bytes( np[NOTE_DIVERSIFIER_OFFSET..NOTE_VALUE_OFFSET] .copy_from_slice(note.recipient().diversifier().as_array()); np[NOTE_VALUE_OFFSET..NOTE_RSEED_OFFSET].copy_from_slice(¬e.value().to_bytes()); - np[NOTE_RSEED_OFFSET..COMPACT_NOTE_SIZE_V2].copy_from_slice(note.rseed().as_bytes()); + np[NOTE_RSEED_OFFSET..COMPACT_NOTE_SIZE_VANILLA].copy_from_slice(note.rseed().as_bytes()); np } @@ -244,7 +244,7 @@ impl OrchardType { ); let rseed = Option::from(RandomSeed::from_bytes( - plaintext.as_ref()[NOTE_RSEED_OFFSET..COMPACT_NOTE_SIZE_V2] + plaintext.as_ref()[NOTE_RSEED_OFFSET..COMPACT_NOTE_SIZE_VANILLA] .try_into() .unwrap(), &domain.rho, @@ -256,7 +256,7 @@ impl OrchardType { let asset = match note_version(plaintext.as_ref())? { 0x02 => AssetBase::native(), 0x03 => { - let bytes = plaintext.as_ref()[COMPACT_NOTE_SIZE_V2..COMPACT_NOTE_SIZE_V3] + let bytes = plaintext.as_ref()[COMPACT_NOTE_SIZE_VANILLA..COMPACT_NOTE_SIZE_ZSA] .try_into() .unwrap(); AssetBase::from_bytes(bytes).unwrap() diff --git a/src/note_encryption_v2.rs b/src/note_encryption_vanilla.rs similarity index 86% rename from src/note_encryption_v2.rs rename to src/note_encryption_vanilla.rs index fd03e5c3a..c80020a5b 100644 --- a/src/note_encryption_v2.rs +++ b/src/note_encryption_vanilla.rs @@ -5,18 +5,18 @@ use zcash_note_encryption_zsa::{AEAD_TAG_SIZE, MEMO_SIZE}; use crate::{ note_encryption::{ build_base_note_plaintext_bytes, define_note_byte_types, Memo, OrchardDomain, - COMPACT_NOTE_SIZE_V2, + COMPACT_NOTE_SIZE_VANILLA, }, Note, }; -define_note_byte_types!(COMPACT_NOTE_SIZE_V2); +define_note_byte_types!(COMPACT_NOTE_SIZE_VANILLA); /// FIXME: add doc #[derive(Debug, Clone)] -pub struct OrchardDomainV2; +pub struct OrchardDomainVanilla; -impl OrchardDomain for OrchardDomainV2 { +impl OrchardDomain for OrchardDomainVanilla { const COMPACT_NOTE_SIZE: usize = COMPACT_NOTE_SIZE; type NotePlaintextBytes = NotePlaintextBytes; @@ -27,7 +27,7 @@ impl OrchardDomain for OrchardDomainV2 { fn build_note_plaintext_bytes(note: &Note, memo: &Memo) -> Self::NotePlaintextBytes { let mut np = build_base_note_plaintext_bytes(0x02, note); - np[COMPACT_NOTE_SIZE_V2..].copy_from_slice(memo); + np[COMPACT_NOTE_SIZE_VANILLA..].copy_from_slice(memo); NotePlaintextBytes(np) } @@ -42,7 +42,7 @@ mod tests { EphemeralKeyBytes, }; - use super::{NoteCiphertextBytes, OrchardDomainV2}; + use super::{NoteCiphertextBytes, OrchardDomainVanilla}; use crate::{ action::Action, keys::{ @@ -59,27 +59,28 @@ mod tests { Address, Note, }; - type OrchardV2 = OrchardType; + type OrchardVanilla = OrchardType; /// Implementation of in-band secret distribution for Orchard bundles. - pub type OrchardNoteEncryptionV2 = zcash_note_encryption_zsa::NoteEncryption; + pub type OrchardNoteEncryptionVanilla = + zcash_note_encryption_zsa::NoteEncryption; proptest! { #[test] fn test_encoding_roundtrip( note in arb_native_note(), ) { - let memo = &crate::test_vectors::note_encryption_v2::test_vectors()[0].memo; + let memo = &crate::test_vectors::note_encryption_vanilla::test_vectors()[0].memo; // Encode. - let mut plaintext = OrchardV2::note_plaintext_bytes(¬e, memo); + let mut plaintext = OrchardVanilla::note_plaintext_bytes(¬e, memo); // Decode. - let domain = OrchardV2::for_nullifier(note.rho()); + let domain = OrchardVanilla::for_nullifier(note.rho()); let parsed_version = note_version(plaintext.as_mut()).unwrap(); let (compact,parsed_memo) = domain.extract_memo(&plaintext); - let (parsed_note, parsed_recipient) = OrchardV2::orchard_parse_note_plaintext_without_memo(&domain, &compact, + let (parsed_note, parsed_recipient) = OrchardVanilla::orchard_parse_note_plaintext_without_memo(&domain, &compact, |diversifier| { assert_eq!(diversifier, ¬e.recipient().diversifier()); Some(*note.recipient().pk_d()) @@ -96,7 +97,7 @@ mod tests { #[test] fn test_vectors() { - let test_vectors = crate::test_vectors::note_encryption_v2::test_vectors(); + let test_vectors = crate::test_vectors::note_encryption_vanilla::test_vectors(); for tv in test_vectors { // @@ -163,7 +164,7 @@ mod tests { // (Tested first because it only requires immutable references.) // - let domain = OrchardV2::for_nullifier(rho); + let domain = OrchardVanilla::for_nullifier(rho); match try_note_decryption(&domain, &ivk, &action) { Some((decrypted_note, decrypted_to, decrypted_memo)) => { @@ -195,7 +196,7 @@ mod tests { // Test encryption // - let ne = OrchardNoteEncryptionV2::new_with_esk(esk, Some(ovk), note, tv.memo); + let ne = OrchardNoteEncryptionVanilla::new_with_esk(esk, Some(ovk), note, tv.memo); assert_eq!(ne.encrypt_note_plaintext().as_ref(), &tv.c_enc[..]); assert_eq!( diff --git a/src/note_encryption_v3.rs b/src/note_encryption_zsa.rs similarity index 85% rename from src/note_encryption_v3.rs rename to src/note_encryption_zsa.rs index 8d9259b5d..de0404d7f 100644 --- a/src/note_encryption_v3.rs +++ b/src/note_encryption_zsa.rs @@ -5,18 +5,18 @@ use zcash_note_encryption_zsa::{AEAD_TAG_SIZE, MEMO_SIZE}; use crate::{ note_encryption::{ build_base_note_plaintext_bytes, define_note_byte_types, Memo, OrchardDomain, - COMPACT_NOTE_SIZE_V2, COMPACT_NOTE_SIZE_V3, + COMPACT_NOTE_SIZE_VANILLA, COMPACT_NOTE_SIZE_ZSA, }, Note, }; -define_note_byte_types!(COMPACT_NOTE_SIZE_V3); +define_note_byte_types!(COMPACT_NOTE_SIZE_ZSA); /// FIXME: add doc #[derive(Debug, Clone)] -pub struct OrchardDomainV3; +pub struct OrchardDomainZSA; -impl OrchardDomain for OrchardDomainV3 { +impl OrchardDomain for OrchardDomainZSA { const COMPACT_NOTE_SIZE: usize = COMPACT_NOTE_SIZE; type NotePlaintextBytes = NotePlaintextBytes; @@ -27,8 +27,9 @@ impl OrchardDomain for OrchardDomainV3 { fn build_note_plaintext_bytes(note: &Note, memo: &Memo) -> Self::NotePlaintextBytes { let mut np = build_base_note_plaintext_bytes(0x03, note); - np[COMPACT_NOTE_SIZE_V2..COMPACT_NOTE_SIZE_V3].copy_from_slice(¬e.asset().to_bytes()); - np[COMPACT_NOTE_SIZE_V3..].copy_from_slice(memo); + np[COMPACT_NOTE_SIZE_VANILLA..COMPACT_NOTE_SIZE_ZSA] + .copy_from_slice(¬e.asset().to_bytes()); + np[COMPACT_NOTE_SIZE_ZSA..].copy_from_slice(memo); NotePlaintextBytes(np) } @@ -43,7 +44,7 @@ mod tests { EphemeralKeyBytes, }; - use super::{NoteCiphertextBytes, OrchardDomainV3}; + use super::{NoteCiphertextBytes, OrchardDomainZSA}; use crate::{ action::Action, keys::{ @@ -60,27 +61,27 @@ mod tests { Address, Note, }; - type OrchardV3 = OrchardType; + type OrchardZSA = OrchardType; /// Implementation of in-band secret distribution for Orchard bundles. - pub type OrchardNoteEncryptionV3 = zcash_note_encryption_zsa::NoteEncryption; + pub type OrchardNoteEncryptionZSA = zcash_note_encryption_zsa::NoteEncryption; proptest! { #[test] fn test_encoding_roundtrip( note in arb_note(NoteValue::from_raw(100)), ) { - let memo = &crate::test_vectors::note_encryption_v3::test_vectors()[0].memo; + let memo = &crate::test_vectors::note_encryption_zsa::test_vectors()[0].memo; // Encode. - let mut plaintext = OrchardV3::note_plaintext_bytes(¬e, memo); + let mut plaintext = OrchardZSA::note_plaintext_bytes(¬e, memo); // Decode. - let domain = OrchardV3::for_nullifier(note.rho()); + let domain = OrchardZSA::for_nullifier(note.rho()); let parsed_version = note_version(plaintext.as_mut()).unwrap(); let (compact,parsed_memo) = domain.extract_memo(&plaintext); - let (parsed_note, parsed_recipient) = OrchardV3::orchard_parse_note_plaintext_without_memo(&domain, &compact, + let (parsed_note, parsed_recipient) = OrchardZSA::orchard_parse_note_plaintext_without_memo(&domain, &compact, |diversifier| { assert_eq!(diversifier, ¬e.recipient().diversifier()); Some(*note.recipient().pk_d()) @@ -97,7 +98,7 @@ mod tests { #[test] fn test_vectors() { - let test_vectors = crate::test_vectors::note_encryption_v3::test_vectors(); + let test_vectors = crate::test_vectors::note_encryption_zsa::test_vectors(); for tv in test_vectors { // @@ -164,7 +165,7 @@ mod tests { // (Tested first because it only requires immutable references.) // - let domain = OrchardV3::for_nullifier(rho); + let domain = OrchardZSA::for_nullifier(rho); match try_note_decryption(&domain, &ivk, &action) { Some((decrypted_note, decrypted_to, decrypted_memo)) => { @@ -196,7 +197,7 @@ mod tests { // Test encryption // - let ne = OrchardNoteEncryptionV3::new_with_esk(esk, Some(ovk), note, tv.memo); + let ne = OrchardNoteEncryptionZSA::new_with_esk(esk, Some(ovk), note, tv.memo); assert_eq!(ne.encrypt_note_plaintext().as_ref(), &tv.c_enc[..]); assert_eq!( diff --git a/src/test_vectors.rs b/src/test_vectors.rs index c235efb14..ead6f2236 100644 --- a/src/test_vectors.rs +++ b/src/test_vectors.rs @@ -2,5 +2,5 @@ pub(crate) mod asset_base; pub(crate) mod commitment_tree; pub(crate) mod keys; pub(crate) mod merkle_path; -pub(crate) mod note_encryption_v2; -pub(crate) mod note_encryption_v3; +pub(crate) mod note_encryption_vanilla; +pub(crate) mod note_encryption_zsa; diff --git a/src/test_vectors/note_encryption_v2.rs b/src/test_vectors/note_encryption_vanilla.rs similarity index 100% rename from src/test_vectors/note_encryption_v2.rs rename to src/test_vectors/note_encryption_vanilla.rs diff --git a/src/test_vectors/note_encryption_v3.rs b/src/test_vectors/note_encryption_zsa.rs similarity index 100% rename from src/test_vectors/note_encryption_v3.rs rename to src/test_vectors/note_encryption_zsa.rs diff --git a/tests/builder.rs b/tests/builder.rs index eecb11090..62be04ba1 100644 --- a/tests/builder.rs +++ b/tests/builder.rs @@ -7,7 +7,7 @@ use orchard::{ keys::{FullViewingKey, PreparedIncomingViewingKey, Scope, SpendAuthorizingKey, SpendingKey}, note::{AssetBase, ExtractedNoteCommitment}, note_encryption::OrchardType, - note_encryption_v3::OrchardDomainV3, + note_encryption_zsa::OrchardDomainZSA, tree::{MerkleHashOrchard, MerklePath}, value::NoteValue, Anchor, Bundle, Note, @@ -15,10 +15,10 @@ use orchard::{ use rand::rngs::OsRng; use zcash_note_encryption_zsa::try_note_decryption; -type OrchardV3 = OrchardType; +type OrchardZSA = OrchardType; pub fn verify_bundle( - bundle: &Bundle, + bundle: &Bundle, vk: &VerifyingKey, verify_proof: bool, ) { @@ -65,7 +65,7 @@ fn bundle_chain() { let recipient = fvk.address_at(0u32, Scope::External); // Create a shielding bundle. - let shielding_bundle: Bundle<_, i64, OrchardDomainV3> = { + let shielding_bundle: Bundle<_, i64, OrchardDomainZSA> = { // Use the empty tree. let anchor = MerkleHashOrchard::empty_root(32.into()).into(); @@ -90,13 +90,13 @@ fn bundle_chain() { verify_bundle(&shielding_bundle, &vk, true); // Create a shielded bundle spending the previous output. - let shielded_bundle: Bundle<_, i64, OrchardDomainV3> = { + let shielded_bundle: Bundle<_, i64, OrchardDomainZSA> = { let ivk = PreparedIncomingViewingKey::new(&fvk.to_ivk(Scope::External)); let (note, _, _) = shielding_bundle .actions() .iter() .find_map(|action| { - let domain = OrchardV3::for_action(action); + let domain = OrchardZSA::for_action(action); try_note_decryption(&domain, &ivk, action) }) .unwrap(); diff --git a/tests/zsa.rs b/tests/zsa.rs index 929a0e97a..569c51c3a 100644 --- a/tests/zsa.rs +++ b/tests/zsa.rs @@ -15,7 +15,7 @@ use orchard::{ circuit::{ProvingKey, VerifyingKey}, keys::{FullViewingKey, PreparedIncomingViewingKey, Scope, SpendAuthorizingKey, SpendingKey}, note_encryption::OrchardType, - note_encryption_v3::OrchardDomainV3, + note_encryption_zsa::OrchardDomainZSA, value::NoteValue, Address, Anchor, Bundle, Note, }; @@ -23,7 +23,7 @@ use rand::rngs::OsRng; use std::collections::HashSet; use zcash_note_encryption_zsa::try_note_decryption; -type OrchardV3 = OrchardType; +type OrchardZSA = OrchardType; #[derive(Debug)] struct Keychain { @@ -89,7 +89,7 @@ fn build_and_sign_bundle( mut rng: OsRng, pk: &ProvingKey, sk: &SpendingKey, -) -> Bundle { +) -> Bundle { let unauthorized = builder.build(&mut rng).unwrap(); let sighash = unauthorized.commitment().into(); let proven = unauthorized.create_proof(pk, &mut rng).unwrap(); @@ -184,7 +184,7 @@ fn issue_zsa_notes(asset_descr: &str, keys: &Keychain) -> (Note, Note) { fn create_native_note(keys: &Keychain) -> Note { let mut rng = OsRng; - let shielding_bundle: Bundle<_, i64, OrchardDomainV3> = { + let shielding_bundle: Bundle<_, i64, OrchardDomainZSA> = { // Use the empty tree. let anchor = MerkleHashOrchard::empty_root(32.into()).into(); @@ -209,7 +209,7 @@ fn create_native_note(keys: &Keychain) -> Note { .actions() .iter() .find_map(|action| { - let domain = OrchardV3::for_action(action); + let domain = OrchardZSA::for_action(action); try_note_decryption(&domain, &PreparedIncomingViewingKey::new(&ivk), action) }) .unwrap(); @@ -242,7 +242,7 @@ fn build_and_verify_bundle( keys: &Keychain, ) -> Result<(), String> { let rng = OsRng; - let shielded_bundle: Bundle<_, i64, OrchardDomainV3> = { + let shielded_bundle: Bundle<_, i64, OrchardDomainZSA> = { let mut builder = Builder::new(Flags::from_parts(true, true, true), anchor); spends @@ -270,7 +270,7 @@ fn build_and_verify_bundle( Ok(()) } -fn verify_unique_spent_nullifiers(bundle: &Bundle) -> bool { +fn verify_unique_spent_nullifiers(bundle: &Bundle) -> bool { let mut unique_nulifiers = Vec::new(); let spent_nullifiers = bundle .actions()