mirror of
https://github.com/logos-storage/proof-aggregation.git
synced 2026-01-07 08:13:07 +00:00
switch H to Hasher
This commit is contained in:
parent
91213b3d44
commit
ef058ac6f0
@ -6,7 +6,7 @@ use std::marker::PhantomData;
|
|||||||
use anyhow::{ensure, Result};
|
use anyhow::{ensure, Result};
|
||||||
use plonky2::hash::hash_types::{HashOut, RichField};
|
use plonky2::hash::hash_types::{HashOut, RichField};
|
||||||
use std::ops::Shr;
|
use std::ops::Shr;
|
||||||
use plonky2::plonk::config::AlgebraicHasher;
|
use plonky2::plonk::config::Hasher;
|
||||||
use plonky2_field::extension::Extendable;
|
use plonky2_field::extension::Extendable;
|
||||||
use plonky2_poseidon2::poseidon2_hash::poseidon2::Poseidon2;
|
use plonky2_poseidon2::poseidon2_hash::poseidon2::Poseidon2;
|
||||||
use crate::hash::key_compress::key_compress;
|
use crate::hash::key_compress::key_compress;
|
||||||
@ -22,7 +22,7 @@ pub const KEY_ODD_AND_BOTTOM_LAYER: u64 = 0x3;
|
|||||||
pub struct MerkleTree<
|
pub struct MerkleTree<
|
||||||
F: RichField + Extendable<D> + Poseidon2,
|
F: RichField + Extendable<D> + Poseidon2,
|
||||||
const D: usize,
|
const D: usize,
|
||||||
H: AlgebraicHasher<F>,
|
H: Hasher<F>,
|
||||||
> {
|
> {
|
||||||
pub layers: Vec<Vec<HashOut<F>>>,
|
pub layers: Vec<Vec<HashOut<F>>>,
|
||||||
phantom_data: PhantomData<H>
|
phantom_data: PhantomData<H>
|
||||||
@ -31,7 +31,7 @@ pub struct MerkleTree<
|
|||||||
impl<
|
impl<
|
||||||
F: RichField + Extendable<D> + Poseidon2,
|
F: RichField + Extendable<D> + Poseidon2,
|
||||||
const D: usize,
|
const D: usize,
|
||||||
H: AlgebraicHasher<F>,
|
H: Hasher<F>,
|
||||||
> MerkleTree<F, D, H> {
|
> MerkleTree<F, D, H> {
|
||||||
/// Constructs a new Merkle tree from the given leaves.
|
/// Constructs a new Merkle tree from the given leaves.
|
||||||
pub fn new(
|
pub fn new(
|
||||||
@ -96,7 +96,7 @@ impl<
|
|||||||
fn merkle_tree_worker<
|
fn merkle_tree_worker<
|
||||||
F: RichField + Extendable<D> + Poseidon2,
|
F: RichField + Extendable<D> + Poseidon2,
|
||||||
const D: usize,
|
const D: usize,
|
||||||
H: AlgebraicHasher<F>,
|
H: Hasher<F>,
|
||||||
>(
|
>(
|
||||||
xs: &[HashOut<F>],
|
xs: &[HashOut<F>],
|
||||||
is_bottom_layer: bool,
|
is_bottom_layer: bool,
|
||||||
@ -140,7 +140,7 @@ fn merkle_tree_worker<
|
|||||||
pub struct MerkleProof<
|
pub struct MerkleProof<
|
||||||
F: RichField + Extendable<D> + Poseidon2,
|
F: RichField + Extendable<D> + Poseidon2,
|
||||||
const D: usize,
|
const D: usize,
|
||||||
H: AlgebraicHasher<F>,
|
H: Hasher<F>,
|
||||||
> {
|
> {
|
||||||
pub index: usize, // Index of the leaf
|
pub index: usize, // Index of the leaf
|
||||||
pub path: Vec<HashOut<F>>, // Sibling hashes from the leaf to the root
|
pub path: Vec<HashOut<F>>, // Sibling hashes from the leaf to the root
|
||||||
@ -151,7 +151,7 @@ pub struct MerkleProof<
|
|||||||
impl<
|
impl<
|
||||||
F: RichField + Extendable<D> + Poseidon2,
|
F: RichField + Extendable<D> + Poseidon2,
|
||||||
const D: usize,
|
const D: usize,
|
||||||
H: AlgebraicHasher<F>,
|
H: Hasher<F>,
|
||||||
> MerkleProof<F, D, H> {
|
> MerkleProof<F, D, H> {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
index: usize,
|
index: usize,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user