diff --git a/zcash_primitives/src/merkle_tree.rs b/zcash_primitives/src/merkle_tree.rs index 3b4af3a..2dcc5cc 100644 --- a/zcash_primitives/src/merkle_tree.rs +++ b/zcash_primitives/src/merkle_tree.rs @@ -1,7 +1,6 @@ //! Implementation of a Merkle tree of commitments used to prove the existence of notes. use byteorder::{LittleEndian, ReadBytesExt}; -use sapling_crypto::circuit::sapling::TREE_DEPTH; use std::collections::VecDeque; use std::io::{self, Read, Write}; use std::iter; @@ -435,10 +434,10 @@ impl CommitmentTreeWitness { /// Reads a witness from its serialized form. pub fn from_slice(witness: &[u8]) -> Result { - Self::from_slice_with_depth(witness, TREE_DEPTH) + Self::from_slice_with_depth(witness, SAPLING_COMMITMENT_TREE_DEPTH) } - pub fn from_slice_with_depth(mut witness: &[u8], depth: usize) -> Result { + fn from_slice_with_depth(mut witness: &[u8], depth: usize) -> Result { // Skip the first byte, which should be "depth" to signify the length of // the following vector of Pedersen hashes. if witness[0] != depth as u8 { diff --git a/zcash_primitives/src/sapling.rs b/zcash_primitives/src/sapling.rs index 517d9fd..0ee808c 100644 --- a/zcash_primitives/src/sapling.rs +++ b/zcash_primitives/src/sapling.rs @@ -14,7 +14,8 @@ use std::io::{self, Read, Write}; use crate::merkle_tree::Hashable; use JUBJUB; -pub(crate) const SAPLING_COMMITMENT_TREE_DEPTH: usize = 32; +pub(crate) const SAPLING_COMMITMENT_TREE_DEPTH: usize = + sapling_crypto::circuit::sapling::TREE_DEPTH; /// Compute a parent node in the Sapling commitment tree given its two children. pub fn merkle_hash(depth: usize, lhs: &FrRepr, rhs: &FrRepr) -> FrRepr {