Orchard: update merkle_crh_orchard correctly
This commit is contained in:
parent
218bb9b7c2
commit
c892b93f61
|
|
@ -1,7 +1,8 @@
|
||||||
//! Orchard key types.
|
//! 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(clippy::unit_arg)]
|
||||||
|
#![allow(dead_code)]
|
||||||
|
|
||||||
// #[cfg(test)]
|
// #[cfg(test)]
|
||||||
// mod test_vectors;
|
// mod test_vectors;
|
||||||
|
|
@ -9,7 +10,7 @@
|
||||||
mod tests;
|
mod tests;
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
convert::{From, Into, TryFrom},
|
convert::{From, Into, TryFrom, TryInto},
|
||||||
fmt,
|
fmt,
|
||||||
io::{self, Write},
|
io::{self, Write},
|
||||||
str::FromStr,
|
str::FromStr,
|
||||||
|
|
|
||||||
|
|
@ -11,11 +11,12 @@
|
||||||
//! A root of a note commitment tree is associated with each treestate.
|
//! A root of a note commitment tree is associated with each treestate.
|
||||||
|
|
||||||
#![allow(clippy::unit_arg)]
|
#![allow(clippy::unit_arg)]
|
||||||
|
#![allow(dead_code)]
|
||||||
|
|
||||||
use std::{collections::VecDeque, fmt};
|
use std::{collections::VecDeque, fmt};
|
||||||
|
|
||||||
use bitvec::prelude::*;
|
use bitvec::prelude::*;
|
||||||
use group::GroupEncoding;
|
use halo2::arithmetic::FieldExt;
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
#[cfg(any(test, feature = "proptest-impl"))]
|
#[cfg(any(test, feature = "proptest-impl"))]
|
||||||
use proptest_derive::Arbitrary;
|
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(&left.bits::<Lsb0>()[0..255]);
|
||||||
s.extend_from_slice(&right.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! {
|
lazy_static! {
|
||||||
|
|
@ -147,7 +148,7 @@ impl From<Vec<jubjub::Fq>> for NoteCommitmentTree {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl 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.
|
/// commitment notes.
|
||||||
pub fn hash(&self) -> [u8; 32] {
|
pub fn hash(&self) -> [u8; 32] {
|
||||||
self.root.0
|
self.root.0
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
//! [ps]: https://zips.z.cash/protocol/protocol.pdf#saplingkeycomponents
|
//! [ps]: https://zips.z.cash/protocol/protocol.pdf#saplingkeycomponents
|
||||||
//! [3.1]: https://zips.z.cash/protocol/protocol.pdf#addressesandkeys
|
//! [3.1]: https://zips.z.cash/protocol/protocol.pdf#addressesandkeys
|
||||||
#![allow(clippy::unit_arg)]
|
#![allow(clippy::unit_arg)]
|
||||||
|
#![allow(dead_code)]
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test_vectors;
|
mod test_vectors;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue