diff --git a/src/merkle_tree.rs b/src/merkle_tree.rs index f1fe729..b435a75 100644 --- a/src/merkle_tree.rs +++ b/src/merkle_tree.rs @@ -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 { } /// Element of a Merkle proof -#[derive(Clone, Copy, PartialEq, Eq, Serialize)] +#[derive(Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] pub enum Branch { /// Left branch taken, value is the right sibling hash. Left(H::Hash), diff --git a/src/poseidon_tree.rs b/src/poseidon_tree.rs index 2934bae..c3da2d3 100644 --- a/src/poseidon_tree.rs +++ b/src/poseidon_tree.rs @@ -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 = Lazy::new(Poseidon::new); @@ -16,7 +16,7 @@ pub type Branch = merkle_tree::Branch; #[allow(dead_code)] pub type Proof = merkle_tree::Proof; -#[derive(Clone, Copy, PartialEq, Eq, Serialize)] +#[derive(Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] pub struct PoseidonHash; #[allow(clippy::fallible_impl_from)] // TODO