diff --git a/zebra-chain/src/block/header.rs b/zebra-chain/src/block/header.rs index c0b749e9a..926103789 100644 --- a/zebra-chain/src/block/header.rs +++ b/zebra-chain/src/block/header.rs @@ -1,8 +1,11 @@ -use super::{difficulty::CompactDifficulty, BlockHeaderHash, Error}; +use chrono::{DateTime, Duration, Utc}; + use crate::equihash_solution::EquihashSolution; use crate::merkle_tree::MerkleTreeRootHash; use crate::serialization::ZcashSerialize; -use chrono::{DateTime, Duration, Utc}; +use crate::treestate::note_commitment_tree::SaplingNoteTreeRootHash; + +use super::{difficulty::CompactDifficulty, BlockHeaderHash, Error}; /// Block header. /// diff --git a/zebra-chain/src/block/serialize.rs b/zebra-chain/src/block/serialize.rs index 1503533a6..5ed3697a2 100644 --- a/zebra-chain/src/block/serialize.rs +++ b/zebra-chain/src/block/serialize.rs @@ -7,6 +7,7 @@ use crate::equihash_solution::EquihashSolution; use crate::merkle_tree::MerkleTreeRootHash; use crate::serialization::ZcashDeserializeInto; use crate::serialization::{ReadZcashExt, SerializationError, ZcashDeserialize, ZcashSerialize}; +use crate::treestate::note_commitment_tree::SaplingNoteTreeRootHash; use super::Block; use super::BlockHeader; diff --git a/zebra-chain/src/block/tests.rs b/zebra-chain/src/block/tests.rs index 584b739e0..d491c7626 100644 --- a/zebra-chain/src/block/tests.rs +++ b/zebra-chain/src/block/tests.rs @@ -6,7 +6,7 @@ use crate::merkle_tree::MerkleTreeRootHash; use crate::serialization::{ SerializationError, ZcashDeserialize, ZcashDeserializeInto, ZcashSerialize, }; -use crate::types::BlockHeight; +use crate::treestate::note_commitment_tree::SaplingNoteTreeRootHash; use crate::types::LockTime; use crate::Network; use crate::{sha256d_writer::Sha256dWriter, test::generate}; diff --git a/zebra-chain/src/lib.rs b/zebra-chain/src/lib.rs index 9b7a4920c..776849d7a 100644 --- a/zebra-chain/src/lib.rs +++ b/zebra-chain/src/lib.rs @@ -19,12 +19,12 @@ pub mod addresses; pub mod block; pub mod equihash_solution; pub mod keys; -pub mod note_commitment_tree; pub mod notes; pub mod parameters; pub mod proofs; pub mod serialization; pub mod transaction; +pub mod treestate; pub mod types; pub mod utils; diff --git a/zebra-chain/src/notes/sprout.rs b/zebra-chain/src/notes/sprout.rs index 529dcc3cb..e24b3d47c 100644 --- a/zebra-chain/src/notes/sprout.rs +++ b/zebra-chain/src/notes/sprout.rs @@ -95,7 +95,6 @@ pub struct NotePlaintext { value: Amount, // TODO: refine type rho: [u8; 32], - // TODO: refine as jub-jub appropriate in the base field. note_commitment_randomness: NoteCommitmentRandomness, memo: Memo, } diff --git a/zebra-chain/src/transaction/serialize.rs b/zebra-chain/src/transaction/serialize.rs index e933270ce..65657a0df 100644 --- a/zebra-chain/src/transaction/serialize.rs +++ b/zebra-chain/src/transaction/serialize.rs @@ -331,7 +331,7 @@ impl ZcashSerialize for Spend { impl ZcashDeserialize for Spend { fn zcash_deserialize(mut reader: R) -> Result { - use crate::note_commitment_tree::SaplingNoteTreeRootHash; + use crate::treestate::note_commitment_tree::SaplingNoteTreeRootHash; Ok(Spend { cv: reader.read_32_bytes()?, anchor: SaplingNoteTreeRootHash(reader.read_32_bytes()?), diff --git a/zebra-chain/src/transaction/shielded_data.rs b/zebra-chain/src/transaction/shielded_data.rs index caf4c517f..38c5a97c6 100644 --- a/zebra-chain/src/transaction/shielded_data.rs +++ b/zebra-chain/src/transaction/shielded_data.rs @@ -1,9 +1,8 @@ -// XXX this name seems too long? -use crate::note_commitment_tree::SaplingNoteTreeRootHash; use crate::notes::sapling; use crate::proofs::Groth16Proof; use crate::redjubjub::{self, Binding, SpendAuth}; use crate::serde_helpers; +use crate::treestate::note_commitment_tree::SaplingNoteTreeRootHash; use futures::future::Either; /// A _Spend Description_, as described in [protocol specification ยง7.3][ps]. diff --git a/zebra-chain/src/transaction/tests/arbitrary.rs b/zebra-chain/src/transaction/tests/arbitrary.rs index 7145b9a5a..858c01d6f 100644 --- a/zebra-chain/src/transaction/tests/arbitrary.rs +++ b/zebra-chain/src/transaction/tests/arbitrary.rs @@ -1,11 +1,11 @@ use crate::{ - note_commitment_tree::SaplingNoteTreeRootHash, notes::{sapling, sprout}, proofs::{Groth16Proof, ZkSnarkProof}, transaction::{ CoinbaseData, JoinSplit, JoinSplitData, OutPoint, Output, ShieldedData, Spend, Transaction, TransparentInput, }, + treestate::note_commitment_tree::SaplingNoteTreeRootHash, types::{ amount::{Amount, NonNegative}, BlockHeight, Script, diff --git a/zebra-chain/src/treestate.rs b/zebra-chain/src/treestate.rs new file mode 100644 index 000000000..32a6131a2 --- /dev/null +++ b/zebra-chain/src/treestate.rs @@ -0,0 +1,2 @@ +pub mod note_commitment_tree; +// mod nullifier_set; diff --git a/zebra-chain/src/note_commitment_tree.rs b/zebra-chain/src/treestate/note_commitment_tree.rs similarity index 100% rename from zebra-chain/src/note_commitment_tree.rs rename to zebra-chain/src/treestate/note_commitment_tree.rs