Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refine Note types a little more #263

Merged
merged 1 commit into from
Feb 23, 2020
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
9 changes: 7 additions & 2 deletions zebra-chain/src/note_encryption/sapling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,21 @@ 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.
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,
}

Expand Down
11 changes: 9 additions & 2 deletions zebra-chain/src/note_encryption/sprout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,22 @@ 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 {
value: u64,
// 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,
}

Expand Down