Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions src/bundle/commitments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
2 changes: 2 additions & 0 deletions src/note_encryption.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down
9 changes: 5 additions & 4 deletions src/note_encryption/compact_action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ impl<A, D: OrchardDomainCommon> ShieldedOutput<OrchardDomain<D>> for Action<A, D
self.cmx().to_bytes()
}

fn enc_ciphertext(&self) -> Option<D::NoteCiphertextBytes> {
Some(self.encrypted_note().enc_ciphertext)
fn enc_ciphertext(&self) -> Option<&D::NoteCiphertextBytes> {
Some(&self.encrypted_note().enc_ciphertext)
}

fn enc_ciphertext_compact(&self) -> D::CompactNoteCiphertextBytes {
Expand Down Expand Up @@ -69,7 +69,7 @@ impl<D: OrchardDomainCommon> ShieldedOutput<OrchardDomain<D>> for CompactAction<
self.cmx.to_bytes()
}

fn enc_ciphertext(&self) -> Option<D::NoteCiphertextBytes> {
fn enc_ciphertext(&self) -> Option<&D::NoteCiphertextBytes> {
None
}

Expand Down Expand Up @@ -115,12 +115,13 @@ impl<D: OrchardDomainCommon> CompactAction<D> {
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,
keys::OutgoingViewingKey,
note::{AssetBase, ExtractedNoteCommitment, Note, Nullifier, RandomSeed, Rho},
note_encryption::MEMO_SIZE,
value::NoteValue,
};

Expand Down
5 changes: 4 additions & 1 deletion src/note_encryption/domain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down Expand Up @@ -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].
Expand Down
7 changes: 5 additions & 2 deletions src/note_encryption/orchard_domain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@

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,
note::{AssetBase, Rho},
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 {
Expand Down