diff --git a/Cargo.lock b/Cargo.lock index 30a5608ed..ed3c2f7ae 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2552,7 +2552,7 @@ dependencies = [ [[package]] name = "zcash_note_encryption" version = "0.4.0" -source = "git+https://github.com/QED-it/zcash_note_encryption?branch=return-ref-from-enc-ciphertext#3a54c7281bacf59fe8dcffc6d9b82db60ae465f6" +source = "git+https://github.com/QED-it/zcash_note_encryption?branch=zsa1#76745f00551d4442dee11ad64a8400b75132d18f" dependencies = [ "chacha20", "chacha20poly1305", diff --git a/src/bundle/commitments.rs b/src/bundle/commitments.rs index 953c9d474..1572987bd 100644 --- a/src/bundle/commitments.rs +++ b/src/bundle/commitments.rs @@ -2,13 +2,11 @@ use blake2b_simd::{Hash as Blake2bHash, Params, State}; -use zcash_note_encryption_zsa::MEMO_SIZE; - use crate::{ bundle::{Authorization, Authorized, Bundle}, issuance::{IssueAuth, IssueBundle, Signed}, note::AssetBase, - note_encryption::OrchardDomainCommon, + note_encryption::{OrchardDomainCommon, MEMO_SIZE}, orchard_flavor::{OrchardVanilla, OrchardZSA}, value::NoteValue, }; diff --git a/src/note_encryption.rs b/src/note_encryption.rs index 8f2607e89..26d293209 100644 --- a/src/note_encryption.rs +++ b/src/note_encryption.rs @@ -11,6 +11,8 @@ mod orchard_domain; mod orchard_domain_vanilla; mod orchard_domain_zsa; +pub(crate) use domain::MEMO_SIZE; + pub use { compact_action::CompactAction, orchard_domain::{OrchardDomain, OrchardDomainCommon}, diff --git a/src/note_encryption/compact_action.rs b/src/note_encryption/compact_action.rs index 79227001a..36b919995 100644 --- a/src/note_encryption/compact_action.rs +++ b/src/note_encryption/compact_action.rs @@ -115,7 +115,7 @@ impl CompactAction { pub mod testing { use rand::RngCore; - use zcash_note_encryption_zsa::{note_bytes::NoteBytes, Domain, NoteEncryption, MEMO_SIZE}; + use zcash_note_encryption_zsa::{note_bytes::NoteBytes, Domain, NoteEncryption}; use crate::{ address::Address, @@ -124,7 +124,7 @@ pub mod testing { value::NoteValue, }; - use super::{CompactAction, OrchardDomain, OrchardDomainCommon}; + use super::{CompactAction, OrchardDomain, OrchardDomainCommon, MEMO_SIZE}; /// Creates a fake `CompactAction` paying the given recipient the specified value. /// diff --git a/src/note_encryption/domain.rs b/src/note_encryption/domain.rs index ec6dc8ad3..91d4ba4f2 100644 --- a/src/note_encryption/domain.rs +++ b/src/note_encryption/domain.rs @@ -8,7 +8,7 @@ use blake2b_simd::Params; use zcash_note_encryption_zsa::{ note_bytes::NoteBytes, BatchDomain, Domain, EphemeralKeyBytes, OutPlaintextBytes, - OutgoingCipherKey, MEMO_SIZE, OUT_PLAINTEXT_SIZE, + OutgoingCipherKey, OUT_PLAINTEXT_SIZE, }; use crate::{ @@ -51,6 +51,9 @@ pub(super) const NOTE_VERSION_BYTE_V2: u8 = 0x02; /// The version byte for ZSA. pub(super) const NOTE_VERSION_BYTE_V3: u8 = 0x03; +/// The size of the memo. +pub(crate) const MEMO_SIZE: usize = 512; + pub(super) type Memo = [u8; MEMO_SIZE]; /// Defined in [Zcash Protocol Spec ยง 5.4.2: Pseudo Random Functions][concreteprfs]. diff --git a/src/note_encryption/orchard_domain.rs b/src/note_encryption/orchard_domain.rs index 7ee11530a..e56f15cd1 100644 --- a/src/note_encryption/orchard_domain.rs +++ b/src/note_encryption/orchard_domain.rs @@ -3,7 +3,7 @@ use core::fmt; -use zcash_note_encryption_zsa::{note_bytes::NoteBytes, AEAD_TAG_SIZE, MEMO_SIZE}; +use zcash_note_encryption_zsa::{note_bytes::NoteBytes, AEAD_TAG_SIZE}; use crate::{ action::Action, @@ -11,7 +11,10 @@ use crate::{ Note, }; -use super::{compact_action::CompactAction, domain::Memo}; +use super::{ + compact_action::CompactAction, + domain::{Memo, MEMO_SIZE}, +}; /// Represents the Orchard protocol domain specifics required for note encryption and decryption. pub trait OrchardDomainCommon: fmt::Debug + Clone {