Update incrementalmerkletree dependency version.

This commit is contained in:
Kris Nuttycombe 2022-04-26 13:31:46 -06:00
parent 68882c72d2
commit 4e3e469780
4 changed files with 13 additions and 9 deletions

View File

@ -84,3 +84,4 @@ debug = true
[patch.crates-io] [patch.crates-io]
halo2_gadgets = { git = "https://github.com/zcash/halo2.git", rev = "0c33fa4e6e41464884765c8fb4cefebafd300ca2" } halo2_gadgets = { git = "https://github.com/zcash/halo2.git", rev = "0c33fa4e6e41464884765c8fb4cefebafd300ca2" }
halo2_proofs = { git = "https://github.com/zcash/halo2.git", rev = "0c33fa4e6e41464884765c8fb4cefebafd300ca2" } halo2_proofs = { git = "https://github.com/zcash/halo2.git", rev = "0c33fa4e6e41464884765c8fb4cefebafd300ca2" }
incrementalmerkletree = { git = "https://github.com/zcash/incrementalmerkletree.git", rev = "f23e3d89507849a24543121839eea6f40b141aff" }

View File

@ -590,8 +590,7 @@ impl<V> Bundle<InProgress<Proof, PartiallyAuthorized>, V> {
#[cfg_attr(docsrs, doc(cfg(feature = "test-dependencies")))] #[cfg_attr(docsrs, doc(cfg(feature = "test-dependencies")))]
pub mod testing { pub mod testing {
use core::fmt::Debug; use core::fmt::Debug;
use incrementalmerkletree::{bridgetree::BridgeTree, Tree};
use incrementalmerkletree::{bridgetree::BridgeTree, Frontier, Tree};
use rand::{rngs::StdRng, CryptoRng, SeedableRng}; use rand::{rngs::StdRng, CryptoRng, SeedableRng};
use proptest::collection::vec; use proptest::collection::vec;
@ -666,6 +665,7 @@ pub mod testing {
( (
n_notes in 1usize..30, n_notes in 1usize..30,
n_recipients in 1..30, n_recipients in 1..30,
) )
( (
// generate note values that we're certain won't exceed MAX_NOTE_VALUE in total // generate note values that we're certain won't exceed MAX_NOTE_VALUE in total
@ -691,14 +691,15 @@ pub mod testing {
tree.append(&leaf); tree.append(&leaf);
let position = tree.witness().expect("tree is not empty"); let position = tree.witness().expect("tree is not empty");
let path = MerklePath::from((position, tree.authentication_path(position).expect("we just witnessed the path"))); let root = tree.root(0).unwrap();
let path = MerklePath::from((position, tree.authentication_path(position, &root).expect("we just witnessed the path")));
notes_and_auth_paths.push((*note, path)); notes_and_auth_paths.push((*note, path));
} }
ArbitraryBundleInputs { ArbitraryBundleInputs {
rng: StdRng::from_seed(rng_seed), rng: StdRng::from_seed(rng_seed),
sk, sk,
anchor: tree.root().into(), anchor: tree.root(0).unwrap().into(),
notes: notes_and_auth_paths, notes: notes_and_auth_paths,
recipient_amounts recipient_amounts
} }

View File

@ -284,14 +284,15 @@ pub mod testing {
let position = tree.witness().expect("tree is not empty"); let position = tree.witness().expect("tree is not empty");
assert_eq!(position, i.into()); assert_eq!(position, i.into());
assert_eq!(tree.root().0, pallas::Base::from_repr(tv.root).unwrap()); let root = tree.root(0).unwrap();
assert_eq!(root.0, pallas::Base::from_repr(tv.root).unwrap());
// Check paths for all leaves up to this point. The test vectors include paths // Check paths for all leaves up to this point. The test vectors include paths
// for not-yet-appended leaves (using UNCOMMITTED_ORCHARD as the leaf value), // for not-yet-appended leaves (using UNCOMMITTED_ORCHARD as the leaf value),
// but BridgeTree doesn't encode these. // but BridgeTree doesn't encode these.
for j in 0..=i { for j in 0..=i {
assert_eq!( assert_eq!(
tree.authentication_path(j.try_into().unwrap()), tree.authentication_path(j.try_into().unwrap(), &root),
Some( Some(
tv.paths[j] tv.paths[j]
.iter() .iter()

View File

@ -1,4 +1,4 @@
use incrementalmerkletree::{bridgetree::BridgeTree, Frontier, Hashable, Tree}; use incrementalmerkletree::{bridgetree::BridgeTree, Hashable, Tree};
use orchard::{ use orchard::{
builder::Builder, builder::Builder,
bundle::{Authorized, Flags}, bundle::{Authorized, Flags},
@ -73,12 +73,13 @@ fn bundle_chain() {
let mut tree = BridgeTree::<MerkleHashOrchard, 32>::new(0); let mut tree = BridgeTree::<MerkleHashOrchard, 32>::new(0);
tree.append(&leaf); tree.append(&leaf);
let position = tree.witness().unwrap(); let position = tree.witness().unwrap();
let auth_path = tree.authentication_path(position).unwrap(); let root = tree.root(0).unwrap();
let auth_path = tree.authentication_path(position, &root).unwrap();
let merkle_path = MerklePath::from_parts( let merkle_path = MerklePath::from_parts(
u64::from(position).try_into().unwrap(), u64::from(position).try_into().unwrap(),
auth_path[..].try_into().unwrap(), auth_path[..].try_into().unwrap(),
); );
let anchor = tree.root().into(); let anchor = root.into();
assert_eq!(anchor, merkle_path.root(cmx)); assert_eq!(anchor, merkle_path.root(cmx));
let mut builder = Builder::new(Flags::from_parts(true, true), anchor); let mut builder = Builder::new(Flags::from_parts(true, true), anchor);