Start treestate module

This commit is contained in:
Deirdre Connolly 2020-07-10 16:27:47 -04:00 committed by Deirdre Connolly
parent 28a7420079
commit 0d618a3abf
10 changed files with 13 additions and 9 deletions

View File

@ -1,8 +1,11 @@
use super::{difficulty::CompactDifficulty, BlockHeaderHash, Error}; use chrono::{DateTime, Duration, Utc};
use crate::equihash_solution::EquihashSolution; use crate::equihash_solution::EquihashSolution;
use crate::merkle_tree::MerkleTreeRootHash; use crate::merkle_tree::MerkleTreeRootHash;
use crate::serialization::ZcashSerialize; use crate::serialization::ZcashSerialize;
use chrono::{DateTime, Duration, Utc}; use crate::treestate::note_commitment_tree::SaplingNoteTreeRootHash;
use super::{difficulty::CompactDifficulty, BlockHeaderHash, Error};
/// Block header. /// Block header.
/// ///

View File

@ -7,6 +7,7 @@ use crate::equihash_solution::EquihashSolution;
use crate::merkle_tree::MerkleTreeRootHash; use crate::merkle_tree::MerkleTreeRootHash;
use crate::serialization::ZcashDeserializeInto; use crate::serialization::ZcashDeserializeInto;
use crate::serialization::{ReadZcashExt, SerializationError, ZcashDeserialize, ZcashSerialize}; use crate::serialization::{ReadZcashExt, SerializationError, ZcashDeserialize, ZcashSerialize};
use crate::treestate::note_commitment_tree::SaplingNoteTreeRootHash;
use super::Block; use super::Block;
use super::BlockHeader; use super::BlockHeader;

View File

@ -6,7 +6,7 @@ use crate::merkle_tree::MerkleTreeRootHash;
use crate::serialization::{ use crate::serialization::{
SerializationError, ZcashDeserialize, ZcashDeserializeInto, ZcashSerialize, SerializationError, ZcashDeserialize, ZcashDeserializeInto, ZcashSerialize,
}; };
use crate::types::BlockHeight; use crate::treestate::note_commitment_tree::SaplingNoteTreeRootHash;
use crate::types::LockTime; use crate::types::LockTime;
use crate::Network; use crate::Network;
use crate::{sha256d_writer::Sha256dWriter, test::generate}; use crate::{sha256d_writer::Sha256dWriter, test::generate};

View File

@ -19,12 +19,12 @@ pub mod addresses;
pub mod block; pub mod block;
pub mod equihash_solution; pub mod equihash_solution;
pub mod keys; pub mod keys;
pub mod note_commitment_tree;
pub mod notes; pub mod notes;
pub mod parameters; pub mod parameters;
pub mod proofs; pub mod proofs;
pub mod serialization; pub mod serialization;
pub mod transaction; pub mod transaction;
pub mod treestate;
pub mod types; pub mod types;
pub mod utils; pub mod utils;

View File

@ -95,7 +95,6 @@ pub struct NotePlaintext {
value: Amount<NonNegative>, value: Amount<NonNegative>,
// TODO: refine type // TODO: refine type
rho: [u8; 32], rho: [u8; 32],
// TODO: refine as jub-jub appropriate in the base field.
note_commitment_randomness: NoteCommitmentRandomness, note_commitment_randomness: NoteCommitmentRandomness,
memo: Memo, memo: Memo,
} }

View File

@ -331,7 +331,7 @@ impl ZcashSerialize for Spend {
impl ZcashDeserialize for Spend { impl ZcashDeserialize for Spend {
fn zcash_deserialize<R: io::Read>(mut reader: R) -> Result<Self, SerializationError> { fn zcash_deserialize<R: io::Read>(mut reader: R) -> Result<Self, SerializationError> {
use crate::note_commitment_tree::SaplingNoteTreeRootHash; use crate::treestate::note_commitment_tree::SaplingNoteTreeRootHash;
Ok(Spend { Ok(Spend {
cv: reader.read_32_bytes()?, cv: reader.read_32_bytes()?,
anchor: SaplingNoteTreeRootHash(reader.read_32_bytes()?), anchor: SaplingNoteTreeRootHash(reader.read_32_bytes()?),

View File

@ -1,9 +1,8 @@
// XXX this name seems too long?
use crate::note_commitment_tree::SaplingNoteTreeRootHash;
use crate::notes::sapling; use crate::notes::sapling;
use crate::proofs::Groth16Proof; use crate::proofs::Groth16Proof;
use crate::redjubjub::{self, Binding, SpendAuth}; use crate::redjubjub::{self, Binding, SpendAuth};
use crate::serde_helpers; use crate::serde_helpers;
use crate::treestate::note_commitment_tree::SaplingNoteTreeRootHash;
use futures::future::Either; use futures::future::Either;
/// A _Spend Description_, as described in [protocol specification §7.3][ps]. /// A _Spend Description_, as described in [protocol specification §7.3][ps].

View File

@ -1,11 +1,11 @@
use crate::{ use crate::{
note_commitment_tree::SaplingNoteTreeRootHash,
notes::{sapling, sprout}, notes::{sapling, sprout},
proofs::{Groth16Proof, ZkSnarkProof}, proofs::{Groth16Proof, ZkSnarkProof},
transaction::{ transaction::{
CoinbaseData, JoinSplit, JoinSplitData, OutPoint, Output, ShieldedData, Spend, Transaction, CoinbaseData, JoinSplit, JoinSplitData, OutPoint, Output, ShieldedData, Spend, Transaction,
TransparentInput, TransparentInput,
}, },
treestate::note_commitment_tree::SaplingNoteTreeRootHash,
types::{ types::{
amount::{Amount, NonNegative}, amount::{Amount, NonNegative},
BlockHeight, Script, BlockHeight, Script,

View File

@ -0,0 +1,2 @@
pub mod note_commitment_tree;
// mod nullifier_set;