Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/backends/plonky2/circuits/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1477,7 +1477,7 @@ pub(crate) mod tests {
let params = Params::default();
let config = CircuitConfig::standard_recursion_config();

let custom_predicate_batch = eth_dos_batch(&params, false)?;
let custom_predicate_batch = eth_dos_batch(&params)?;

for (i, cp) in custom_predicate_batch.predicates().iter().enumerate() {
let mut builder = CircuitBuilder::<F, D>::new(config.clone());
Expand Down Expand Up @@ -1540,7 +1540,7 @@ pub(crate) mod tests {
helper_custom_predicate_batch_target_id(&params, &custom_predicate_batch).unwrap();

// Some cases from the examples
let custom_predicate_batch = eth_dos_batch(&params, false)?;
let custom_predicate_batch = eth_dos_batch(&params)?;
helper_custom_predicate_batch_target_id(&params, &custom_predicate_batch).unwrap();

let custom_predicate_batch =
Expand Down
9 changes: 2 additions & 7 deletions src/backends/plonky2/mainpod/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use crate::{
deserialize_proof,
emptypod::EmptyPod,
error::{Error, Result},
mock::{emptypod::MockEmptyPod, signedpod::MockSignedPod},
mock::emptypod::MockEmptyPod,
primitives::merkletree::MerkleClaimAndProof,
recursion::{hash_verifier_data, RecursiveCircuit, RecursiveParams},
serialize_proof,
Expand Down Expand Up @@ -267,12 +267,7 @@ pub(crate) fn layout_statements(
statements.push(middleware::Statement::None.into());

// Input signed pods region
let dummy_signed_pod_box: Box<dyn Pod> =
if mock || inputs.signed_pods.len() == params.max_input_signed_pods {
Box::new(MockSignedPod::dummy())
} else {
Box::new(SignedPod::dummy())
};
let dummy_signed_pod_box: Box<dyn Pod> = Box::new(SignedPod::dummy());
let dummy_signed_pod = dummy_signed_pod_box.as_ref();
assert!(inputs.signed_pods.len() <= params.max_input_signed_pods);
for i in 0..params.max_input_signed_pods {
Expand Down
19 changes: 7 additions & 12 deletions src/backends/plonky2/mock/mainpod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ use crate::{
process_private_statements_operations, process_public_statements_operations, Operation,
Statement,
},
mock::{emptypod::MockEmptyPod, signedpod::MockSignedPod},
mock::emptypod::MockEmptyPod,
primitives::merkletree::MerkleClaimAndProof,
recursion::hash_verifier_data,
signedpod::SignedPod,
},
middleware::{
self, deserialize_pod, deserialize_signed_pod, hash_str, AnchoredKey, Hash, MainPodInputs,
Expand Down Expand Up @@ -187,7 +188,7 @@ impl MockMainPod {
// get the id out of the public statements
let id: PodId = PodId(calculate_id(&public_statements, params));

let pad_signed_pod: Box<dyn Pod> = Box::new(MockSignedPod::dummy());
let pad_signed_pod: Box<dyn Pod> = Box::new(SignedPod::dummy());
let input_signed_pods: Vec<Box<dyn Pod>> = inputs
.signed_pods
.iter()
Expand Down Expand Up @@ -425,7 +426,7 @@ pub mod tests {

use super::*;
use crate::{
backends::plonky2::mock::signedpod::MockSigner,
backends::plonky2::{primitives::ec::schnorr::SecretKey, signedpod::Signer},
examples::{
great_boy_pod_full_flow, tickets_pod_full_flow, zu_kyc_pod_builder,
zu_kyc_sign_pod_builders, MOCK_VD_SET,
Expand All @@ -440,17 +441,11 @@ pub mod tests {
let vd_set = &*MOCK_VD_SET;
let (gov_id_builder, pay_stub_builder, sanction_list_builder) =
zu_kyc_sign_pod_builders(&params);
let mut signer = MockSigner {
pk: "ZooGov".into(),
};
let mut signer = Signer(SecretKey(1u32.into()));
let gov_id_pod = gov_id_builder.sign(&mut signer)?;
let mut signer = MockSigner {
pk: "ZooDeel".into(),
};
let mut signer = Signer(SecretKey(2u32.into()));
let pay_stub_pod = pay_stub_builder.sign(&mut signer)?;
let mut signer = MockSigner {
pk: "ZooOFAC".into(),
};
let mut signer = Signer(SecretKey(3u32.into()));
let sanction_list_pod = sanction_list_builder.sign(&mut signer)?;
let kyc_builder = zu_kyc_pod_builder(
&params,
Expand Down
1 change: 0 additions & 1 deletion src/backends/plonky2/mock/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
pub mod emptypod;
pub mod mainpod;
pub mod signedpod;
233 changes: 0 additions & 233 deletions src/backends/plonky2/mock/signedpod.rs

This file was deleted.

4 changes: 2 additions & 2 deletions src/backends/plonky2/signedpod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ impl Signer {
self.sign_with_nonce(params, nonce, kvs)
}

pub fn public_key(&self) -> Point {
self.0.public_key()
pub fn public_key(&self) -> Value {
Value::from(self.0.public_key())
}
}

Expand Down
11 changes: 3 additions & 8 deletions src/examples/custom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,7 @@ macro_rules! render {
}

/// Instantiates an ETHDos batch
pub fn eth_dos_batch(params: &Params, mock: bool) -> Result<Arc<CustomPredicateBatch>> {
let pod_type = Value::from(if mock {
PodType::MockSigned
} else {
PodType::Signed
});
pub fn eth_dos_batch(params: &Params) -> Result<Arc<CustomPredicateBatch>> {
let input = render!(
r#"
eth_friend(src, dst, private: attestation_pod) = AND(
Expand All @@ -48,7 +43,7 @@ pub fn eth_dos_batch(params: &Params, mock: bool) -> Result<Arc<CustomPredicateB
eth_dos_ind(?src, ?dst, ?distance)
)
"#,
pod_type = pod_type,
pod_type = Value::from(PodType::Signed),
);
let batch = parse(&input, params, &[]).expect("lang parse").custom_batch;
println!("a.0. {}", batch.predicates[0]);
Expand All @@ -65,6 +60,6 @@ mod tests {
#[test]
fn test_eth_friend_batch() {
let params = Params::default();
eth_dos_batch(&params, true).unwrap();
eth_dos_batch(&params).unwrap();
}
}
Loading
Loading