Fix custom predicate circuits and add tests for them (#235)

* add tests, fix custom predicates

* wip

* wip

* fix custom predicates

* modularize code

* fix typos

* remove scratch file

* update

* Update src/backends/plonky2/circuits/mainpod.rs

Co-authored-by: Ahmad Afuni <root@ahmadafuni.com>

---------

Co-authored-by: Ahmad Afuni <root@ahmadafuni.com>
This commit is contained in:
Eduard S. 2025-05-16 13:17:14 +02:00 committed by GitHub
parent f5a1aa7523
commit def0730462
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 629 additions and 153 deletions

View file

@ -69,10 +69,7 @@ pub fn zu_kyc_pod_builder(
// ETHDoS
pub fn eth_friend_signed_pod_builder(
params: &Params,
friend_pubkey: TypedValue,
) -> SignedPodBuilder {
pub fn eth_friend_signed_pod_builder(params: &Params, friend_pubkey: Value) -> SignedPodBuilder {
let mut attestation = SignedPodBuilder::new(params);
attestation.insert("attestation", friend_pubkey);
@ -81,13 +78,14 @@ pub fn eth_friend_signed_pod_builder(
pub fn eth_dos_pod_builder(
params: &Params,
mock: bool,
alice_attestation: &SignedPod,
charlie_attestation: &SignedPod,
bob_pubkey: &TypedValue,
bob_pubkey: Value,
) -> Result<MainPodBuilder> {
// Will need ETH friend and ETH DoS custom predicate batches.
let eth_friend = CustomPredicateRef::new(eth_friend_batch(params)?, 0);
let eth_dos_batch = eth_dos_batch(params)?;
let eth_friend = CustomPredicateRef::new(eth_friend_batch(params, mock)?, 0);
let eth_dos_batch = eth_dos_batch(params, mock)?;
let eth_dos_base = CustomPredicateRef::new(eth_dos_batch.clone(), 0);
let eth_dos_ind = CustomPredicateRef::new(eth_dos_batch.clone(), 1);
let eth_dos = CustomPredicateRef::new(eth_dos_batch.clone(), 2);