diff --git a/zebra-chain/src/notes/sapling.rs b/zebra-chain/src/notes/sapling.rs index f09e7ffc2..9a3195e29 100644 --- a/zebra-chain/src/notes/sapling.rs +++ b/zebra-chain/src/notes/sapling.rs @@ -40,6 +40,10 @@ impl ZcashSerialize for Nullifier { } } +/// The randomness used in the Pedersen Hash for note commitment. +#[derive(Copy, Clone, Debug, PartialEq)] +pub struct NoteCommitmentRandomness(redjubjub::Randomizer); + /// A Note represents that a value is spendable by the recipient who /// holds the spending key corresponding to a given shielded payment /// address. @@ -53,8 +57,7 @@ pub struct Note { /// 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. + value: Amount, note_commitment_randomness: NoteCommitmentRandomness, memo: memo::Memo, } diff --git a/zebra-chain/src/notes/sprout.rs b/zebra-chain/src/notes/sprout.rs index 41e7fe3ff..12ab06a30 100644 --- a/zebra-chain/src/notes/sprout.rs +++ b/zebra-chain/src/notes/sprout.rs @@ -53,6 +53,16 @@ impl ZcashSerialize for Nullifier { } } +/// The randomness used in the Pedersen Hash for note commitment. +#[derive(Copy, Clone, Debug, PartialEq)] +pub struct NoteCommitmentRandomness(pub [u8; 32]); + +impl AsRef<[u8]> for NoteCommitmentRandomness { + fn as_ref(&self) -> &[u8] { + &self.0 + } +} + /// A Note represents that a value is spendable by the recipient who /// holds the spending key corresponding to a given shielded payment /// address.