Re-implement serialization (#201)
* Serialization tests now pass again * Tidy up and test more edge-cases * Use attributes rather than custom serializer for arrays * Add JSON Schema support * Tests for JSON Schema generation and validation * Add comments * Support custom predicates * Clippy fixes * Make deserialization/constructor functions pub(crate)
This commit is contained in:
parent
26a6b2d143
commit
bf6d8aee8b
17 changed files with 554 additions and 255 deletions
|
|
@ -4,8 +4,8 @@ use std::{collections::HashMap, fmt, iter::IntoIterator};
|
|||
|
||||
use anyhow::{anyhow, Result};
|
||||
use plonky2::field::types::Field;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
// use serde::{Deserialize, Serialize};
|
||||
pub use super::merkletree_circuit::*;
|
||||
use crate::middleware::{hash_fields, Hash, RawValue, EMPTY_HASH, EMPTY_VALUE, F};
|
||||
|
||||
|
|
@ -208,7 +208,7 @@ impl fmt::Display for MerkleTree {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct MerkleProof {
|
||||
// note: currently we don't use the `_existence` field, we would use if we merge the methods
|
||||
// `verify` and `verify_nonexistence` into a single one
|
||||
|
|
@ -260,7 +260,7 @@ impl MerkleProof {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct MerkleClaimAndProof {
|
||||
pub root: Hash,
|
||||
pub key: RawValue,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue