chore(backend): implement more circuit op logic (#173)
* Add backend MerkleProof type * Add eval_not_contains * Remove print statement * Handle some edge cases * Add test * Add missing ? * Optimisation and stylistic changes * Code review
This commit is contained in:
parent
adad695ba5
commit
6528914366
10 changed files with 502 additions and 48 deletions
|
|
@ -20,6 +20,8 @@ use std::any::Any;
|
|||
use std::collections::HashMap;
|
||||
use std::fmt;
|
||||
|
||||
use crate::backends::plonky2::primitives::merkletree::MerkleProof;
|
||||
|
||||
pub const SELF: PodId = PodId(SELF_ID_HASH);
|
||||
|
||||
impl fmt::Display for PodId {
|
||||
|
|
@ -105,6 +107,8 @@ pub struct Params {
|
|||
// in a custom predicate
|
||||
pub max_custom_predicate_arity: usize,
|
||||
pub max_custom_batch_size: usize,
|
||||
// maximum number of merkle proofs
|
||||
pub max_merkle_proofs: usize,
|
||||
// maximum depth for merkle tree gadget
|
||||
pub max_depth_mt_gadget: usize,
|
||||
}
|
||||
|
|
@ -121,6 +125,7 @@ impl Default for Params {
|
|||
max_operation_args: 5,
|
||||
max_custom_predicate_arity: 5,
|
||||
max_custom_batch_size: 5,
|
||||
max_merkle_proofs: 5,
|
||||
max_depth_mt_gadget: 32,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,10 @@ use serde::{Deserialize, Serialize};
|
|||
use std::fmt;
|
||||
use std::iter;
|
||||
|
||||
use super::Hash;
|
||||
use super::{CustomPredicateRef, NativePredicate, Statement, StatementArg, ToFields, F};
|
||||
use crate::middleware::EMPTY_HASH;
|
||||
use crate::middleware::EMPTY_VALUE;
|
||||
use crate::{
|
||||
backends::plonky2::primitives::merkletree::{MerkleProof, MerkleTree},
|
||||
middleware::{AnchoredKey, Params, Predicate, Value, SELF},
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ pub const KEY_SIGNER: &str = "_signer";
|
|||
pub const KEY_TYPE: &str = "_type";
|
||||
pub const STATEMENT_ARG_F_LEN: usize = 8;
|
||||
pub const OPERATION_ARG_F_LEN: usize = 1;
|
||||
pub const OPERATION_AUX_F_LEN: usize = 1;
|
||||
|
||||
#[derive(Clone, Copy, Debug, FromRepr, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)]
|
||||
pub enum NativePredicate {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue