From af455f9896f682411ee5ac3d37b54b0cb18da6c0 Mon Sep 17 00:00:00 2001 From: Deirdre Connolly Date: Sat, 22 Feb 2020 21:40:48 -0500 Subject: [PATCH] Refine Note types a little more --- zebra-chain/src/note_encryption/sapling.rs | 9 +++++++-- zebra-chain/src/note_encryption/sprout.rs | 11 +++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/zebra-chain/src/note_encryption/sapling.rs b/zebra-chain/src/note_encryption/sapling.rs index 45ae8755..550697f2 100644 --- a/zebra-chain/src/note_encryption/sapling.rs +++ b/zebra-chain/src/note_encryption/sapling.rs @@ -16,8 +16,13 @@ use super::*; pub struct Diversifier(pub [u8; 11]); pub struct Note { - value: u64, diversifier: Diversifier, + // TODO: refine as a type, derived from a scalar mult of the + // diversifier as a jubjub group element and the incoming view key + // scalar. + transmission_key: [u8; 32], + value: u64, + note_commitment_randomness: NoteCommitmentRandomness, } /// The decrypted form of encrypted Sapling notes on the blockchain. @@ -25,7 +30,7 @@ pub struct NotePlaintext { diversifier: Diversifier, value: u64, // TODO: refine as jub-jub appropriate in the base field. - note_committment_randomness: NoteCommitmentRandomness, + note_commitment_randomness: NoteCommitmentRandomness, memo: memo::Memo, } diff --git a/zebra-chain/src/note_encryption/sprout.rs b/zebra-chain/src/note_encryption/sprout.rs index b248dfd5..d80cdc15 100644 --- a/zebra-chain/src/note_encryption/sprout.rs +++ b/zebra-chain/src/note_encryption/sprout.rs @@ -10,7 +10,14 @@ use crate::serialization::{SerializationError, ZcashDeserialize, ZcashSerialize} use super::*; -pub struct Note {} +pub struct Note { + // TODO: refine type as a SHA-256d output derived from a spending key. + paying_key: [u8; 32], + value: u64, + // TODO: refine type as the input to the PRF that results in a nullifier. + nullifier_seed: [u8; 32], + note_commitment_randomness: NoteCommitmentRandomness, +} /// The decrypted form of encrypted Sprout notes on the blockchain. pub struct NotePlaintext { @@ -18,7 +25,7 @@ pub struct NotePlaintext { // TODO: refine type rho: [u8; 32], // TODO: refine as jub-jub appropriate in the base field. - note_committment_randomness: NoteCommitmentRandomness, + note_commitment_randomness: NoteCommitmentRandomness, memo: memo::Memo, }