Orchard: update merkle_crh_orchard correctly

This commit is contained in:
Deirdre Connolly 2021-03-15 03:16:49 -04:00 committed by Deirdre Connolly
parent 218bb9b7c2
commit c892b93f61
3 changed files with 8 additions and 5 deletions

View File

@ -1,7 +1,8 @@
//! Orchard key types.
//!
//! [orchardkeycomponents]: https://zips.z.cash/protocol/nu5.pdf#orchardkeycomponents
//! https://zips.z.cash/protocol/nu5.pdf#orchardkeycomponents
#![allow(clippy::unit_arg)]
#![allow(dead_code)]
// #[cfg(test)]
// mod test_vectors;
@ -9,7 +10,7 @@
mod tests;
use std::{
convert::{From, Into, TryFrom},
convert::{From, Into, TryFrom, TryInto},
fmt,
io::{self, Write},
str::FromStr,

View File

@ -11,11 +11,12 @@
//! A root of a note commitment tree is associated with each treestate.
#![allow(clippy::unit_arg)]
#![allow(dead_code)]
use std::{collections::VecDeque, fmt};
use bitvec::prelude::*;
use group::GroupEncoding;
use halo2::arithmetic::FieldExt;
use lazy_static::lazy_static;
#[cfg(any(test, feature = "proptest-impl"))]
use proptest_derive::Arbitrary;
@ -42,7 +43,7 @@ fn merkle_crh_orchard(layer: u8, left: [u8; 32], right: [u8; 32]) -> [u8; 32] {
s.extend_from_slice(&left.bits::<Lsb0>()[0..255]);
s.extend_from_slice(&right.bits::<Lsb0>()[0..255]);
sinsemilla_hash_to_point(b"Zcash_PH", &s).to_bytes()
sinsemilla_hash(b"z.cash:Orchard-MerkleCRH", &s).to_bytes()
}
lazy_static! {
@ -147,7 +148,7 @@ impl From<Vec<jubjub::Fq>> for NoteCommitmentTree {
}
impl NoteCommitmentTree {
/// Get the Jubjub-based Pedersen hash of root node of this merkle tree of
/// Get the Pallas-based Pedersen hash of root node of this merkle tree of
/// commitment notes.
pub fn hash(&self) -> [u8; 32] {
self.root.0

View File

@ -8,6 +8,7 @@
//! [ps]: https://zips.z.cash/protocol/protocol.pdf#saplingkeycomponents
//! [3.1]: https://zips.z.cash/protocol/protocol.pdf#addressesandkeys
#![allow(clippy::unit_arg)]
#![allow(dead_code)]
#[cfg(test)]
mod test_vectors;