diff --git a/zebra-chain/src/note_encryption.rs b/zebra-chain/src/note_encryption.rs index bdf3125e..76027533 100644 --- a/zebra-chain/src/note_encryption.rs +++ b/zebra-chain/src/note_encryption.rs @@ -3,8 +3,6 @@ mod memo; mod sapling; mod sprout; -#[derive(Copy, Clone, Debug, PartialEq)] -pub struct Diversifier(pub [u8; 11]); - +/// The randomness used in the Pedersen Hash for note commitment. #[derive(Copy, Clone, Debug, PartialEq)] pub struct NoteCommitmentRandomness(pub [u8; 32]); diff --git a/zebra-chain/src/note_encryption/sapling.rs b/zebra-chain/src/note_encryption/sapling.rs index b78ab3d0..45ae8755 100644 --- a/zebra-chain/src/note_encryption/sapling.rs +++ b/zebra-chain/src/note_encryption/sapling.rs @@ -5,19 +5,28 @@ use proptest::{arbitrary::Arbitrary, collection::vec, prelude::*}; use crate::serialization::{SerializationError, ZcashDeserialize, ZcashSerialize}; -use super::{Diversifier, Memo, NoteCommitmentRandomness}; +use super::*; + +/// A _Diversifier_, an 11 byte value used to randomize the +/// recipient's final public shielded payment address to create a +/// _diversified payment address_. +/// +/// When used, this value is mapped to an affine JubJub group element. +#[derive(Copy, Clone, Debug, PartialEq)] +pub struct Diversifier(pub [u8; 11]); pub struct Note { value: u64, diversifier: Diversifier, } +/// The decrypted form of encrypted Sapling notes on the blockchain. pub struct NotePlaintext { diversifier: Diversifier, value: u64, // TODO: refine as jub-jub appropriate in the base field. note_committment_randomness: NoteCommitmentRandomness, - memo: Memo, + memo: memo::Memo, } /// A ciphertext component for encrypted output notes. diff --git a/zebra-chain/src/note_encryption/sprout.rs b/zebra-chain/src/note_encryption/sprout.rs index ff5005e8..b248dfd5 100644 --- a/zebra-chain/src/note_encryption/sprout.rs +++ b/zebra-chain/src/note_encryption/sprout.rs @@ -8,15 +8,18 @@ use proptest::{collection::vec, prelude::*}; use crate::serialization::{SerializationError, ZcashDeserialize, ZcashSerialize}; +use super::*; + pub struct Note {} +/// The decrypted form of encrypted Sprout notes on the blockchain. pub struct NotePlaintext { value: u64, // TODO: refine type rho: [u8; 32], // TODO: refine as jub-jub appropriate in the base field. note_committment_randomness: NoteCommitmentRandomness, - memo: Memo, + memo: memo::Memo, } /// A ciphertext component for encrypted output notes.