sinsemilla::merkle: Remove MERKLE_DEPTH constant.

This commit is contained in:
therealyingtong 2022-01-27 08:13:49 +08:00
parent 31259d089c
commit 85b481af35
3 changed files with 6 additions and 7 deletions

View File

@ -392,7 +392,7 @@ impl plonk::Circuit<pallas::Base> for Circuit {
// Merkle path validity check.
let anchor = {
let path = self.path.map(|typed_path| {
let path: Option<[pallas::Base; MERKLE_DEPTH_ORCHARD]> = self.path.map(|typed_path| {
// TODO: Replace with array::map once MSRV is 1.55.0.
gen_const_array(|i| typed_path[i].inner())
});

View File

@ -16,9 +16,6 @@ pub(in crate::circuit) mod chip;
/// SWU hash-to-curve personalization for the Merkle CRH generator
pub const MERKLE_CRH_PERSONALIZATION: &str = "z.cash:Orchard-MerkleCRH";
/// Depth of Merkle tree
pub(crate) const MERKLE_DEPTH: usize = 32;
/// Instructions to check the validity of a Merkle path of a given `PATH_LENGTH`.
/// The hash function used is a Sinsemilla instance with `K`-bit words.
/// The hash function can process `MAX_WORDS` words.
@ -136,7 +133,7 @@ where
pub mod tests {
use super::{
chip::{MerkleChip, MerkleConfig},
MerklePath, MERKLE_DEPTH,
MerklePath,
};
use crate::{
@ -160,6 +157,8 @@ pub mod tests {
use rand::{rngs::OsRng, RngCore};
use std::convert::TryInto;
const MERKLE_DEPTH: usize = 32;
#[derive(Default)]
struct MyCircuit {
leaf: Option<pallas::Base>,

View File

@ -5,7 +5,7 @@ use halo2::{
};
use pasta_curves::{arithmetic::FieldExt, pallas};
use super::{MerkleInstructions, MERKLE_DEPTH};
use super::MerkleInstructions;
use crate::{
circuit::gadget::{
@ -180,7 +180,7 @@ where
}
}
impl<Hash, Commit, F>
impl<Hash, Commit, F, const MERKLE_DEPTH: usize>
MerkleInstructions<pallas::Affine, MERKLE_DEPTH, { sinsemilla::K }, { sinsemilla::C }>
for MerkleChip<Hash, Commit, F>
where