mirror of https://github.com/zcash/orchard.git
Use `array::map` now that our MSRV supports it
This commit is contained in:
parent
ae6a50611a
commit
714f2e7159
|
@ -20,8 +20,8 @@ use self::commit_ivk::CommitIvkConfig;
|
|||
use self::note_commit::NoteCommitConfig;
|
||||
use crate::{
|
||||
constants::{
|
||||
util::gen_const_array, NullifierK, OrchardCommitDomains, OrchardFixedBases,
|
||||
OrchardFixedBasesFull, OrchardHashDomains, ValueCommitV, MERKLE_DEPTH_ORCHARD,
|
||||
NullifierK, OrchardCommitDomains, OrchardFixedBases, OrchardFixedBasesFull,
|
||||
OrchardHashDomains, ValueCommitV, MERKLE_DEPTH_ORCHARD,
|
||||
},
|
||||
keys::{
|
||||
CommitIvkRandomness, DiversifiedTransmissionKey, NullifierDerivingKey, SpendValidatingKey,
|
||||
|
@ -396,10 +396,9 @@ impl plonk::Circuit<pallas::Base> for Circuit {
|
|||
|
||||
// Merkle path validity check.
|
||||
let anchor = {
|
||||
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())
|
||||
});
|
||||
let path = self
|
||||
.path
|
||||
.map(|typed_path| typed_path.map(|node| node.inner()));
|
||||
let merkle_inputs = MerklePath::construct(
|
||||
config.merkle_chip_1(),
|
||||
config.merkle_chip_2(),
|
||||
|
|
13
src/tree.rs
13
src/tree.rs
|
@ -5,7 +5,6 @@ use core::iter;
|
|||
use crate::{
|
||||
constants::{
|
||||
sinsemilla::{i2lebsp_k, L_ORCHARD_MERKLE, MERKLE_CRH_PERSONALIZATION},
|
||||
util::gen_const_array_with_default,
|
||||
MERKLE_DEPTH_ORCHARD,
|
||||
},
|
||||
note::commitment::ExtractedNoteCommitment,
|
||||
|
@ -100,20 +99,14 @@ impl MerklePath {
|
|||
pub(crate) fn dummy(mut rng: &mut impl RngCore) -> Self {
|
||||
MerklePath {
|
||||
position: rng.next_u32(),
|
||||
auth_path: gen_const_array_with_default(MerkleHashOrchard::empty_leaf(), |_| {
|
||||
MerkleHashOrchard(pallas::Base::random(&mut rng))
|
||||
}),
|
||||
auth_path: [(); MERKLE_DEPTH_ORCHARD]
|
||||
.map(|_| MerkleHashOrchard(pallas::Base::random(&mut rng))),
|
||||
}
|
||||
}
|
||||
|
||||
/// Instantiates a new Merkle path given a leaf position and authentication path.
|
||||
pub(crate) fn new(position: u32, auth_path: [pallas::Base; MERKLE_DEPTH_ORCHARD]) -> Self {
|
||||
Self::from_parts(
|
||||
position,
|
||||
gen_const_array_with_default(MerkleHashOrchard::empty_leaf(), |i| {
|
||||
MerkleHashOrchard(auth_path[i])
|
||||
}),
|
||||
)
|
||||
Self::from_parts(position, auth_path.map(MerkleHashOrchard))
|
||||
}
|
||||
|
||||
/// Instantiates a new Merkle path given a leaf position and authentication path.
|
||||
|
|
Loading…
Reference in New Issue