deserialization of poseidon proof

This commit is contained in:
psippl 2022-02-26 21:39:09 +01:00
parent 01dd3ff785
commit 718cbf6fe0
2 changed files with 4 additions and 4 deletions

View File

@ -10,7 +10,7 @@ use std::{
};
use num_bigint::BigInt;
use serde::Serialize;
use serde::{Serialize, Deserialize};
/// Hash types, values and algorithms for a Merkle tree
pub trait Hasher {
@ -35,7 +35,7 @@ pub struct MerkleTree<H: Hasher> {
}
/// Element of a Merkle proof
#[derive(Clone, Copy, PartialEq, Eq, Serialize)]
#[derive(Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub enum Branch<H: Hasher> {
/// Left branch taken, value is the right sibling hash.
Left(H::Hash),

View File

@ -5,7 +5,7 @@ use crate::{
use ff::{PrimeField, PrimeFieldRepr};
use once_cell::sync::Lazy;
use poseidon_rs::{Fr, FrRepr, Poseidon};
use serde::Serialize;
use serde::{Serialize, Deserialize};
static POSEIDON: Lazy<Poseidon> = Lazy::new(Poseidon::new);
@ -16,7 +16,7 @@ pub type Branch = merkle_tree::Branch<PoseidonHash>;
#[allow(dead_code)]
pub type Proof = merkle_tree::Proof<PoseidonHash>;
#[derive(Clone, Copy, PartialEq, Eq, Serialize)]
#[derive(Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub struct PoseidonHash;
#[allow(clippy::fallible_impl_from)] // TODO