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: 1 addition & 3 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,4 @@ jobs:
with:
components: clippy
- name: Check lints with clippy
run: cargo clippy
- name: Check lints with clippy (examples)
run: cargo clippy --examples
run: cargo clippy --tests --examples
18 changes: 9 additions & 9 deletions src/backends/plonky2/mainpod/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ pub mod tests {
self, literal, CustomPredicateBatchBuilder, MainPodBuilder, StatementTmplBuilder as STB,
},
middleware::{
self, containers::Set, CustomPredicateRef, NativePredicate as NP, Value, DEFAULT_VD_SET,
self, containers::Set, CustomPredicateRef, NativePredicate as NP, DEFAULT_VD_SET,
},
op,
};
Expand Down Expand Up @@ -747,7 +747,7 @@ pub mod tests {
let sanction_list_pod = sanction_list_builder.sign(&signer)?;
let kyc_builder = zu_kyc_pod_builder(
&params,
&vd_set,
vd_set,
&gov_id_pod,
&pay_stub_pod,
&sanction_list_pod,
Expand Down Expand Up @@ -781,7 +781,7 @@ pub mod tests {
let signer = Signer(SecretKey(42u64.into()));
let gov_id = gov_id_builder.sign(&signer).unwrap();
let now_minus_18y: i64 = 1169909388;
let mut kyc_builder = frontend::MainPodBuilder::new(&params, &vd_set);
let mut kyc_builder = frontend::MainPodBuilder::new(&params, vd_set);
kyc_builder.add_signed_pod(&gov_id);
kyc_builder
.pub_op(op!(lt, (&gov_id, "dateOfBirth"), now_minus_18y))
Expand Down Expand Up @@ -829,7 +829,7 @@ pub mod tests {
};
let vd_set = &*DEFAULT_VD_SET;

let pod_builder = frontend::MainPodBuilder::new(&params, &vd_set);
let pod_builder = frontend::MainPodBuilder::new(&params, vd_set);

// Mock
let prover = MockProver {};
Expand Down Expand Up @@ -859,10 +859,10 @@ pub mod tests {

// Alice attests that she is ETH friends with Bob and Bob
// attests that he is ETH friends with Charlie.
let alice_attestation = attest_eth_friend(&params, &alice, Value::from(bob.public_key()));
let bob_attestation = attest_eth_friend(&params, &bob, Value::from(charlie.public_key()));
let alice_attestation = attest_eth_friend(&params, &alice, bob.public_key());
let bob_attestation = attest_eth_friend(&params, &bob, charlie.public_key());

let helper = EthDosHelper::new(&params, vd_set, false, Value::from(alice.public_key()))?;
let helper = EthDosHelper::new(&params, vd_set, false, alice.public_key())?;
let prover = Prover {};
let dist_1 = helper.dist_1(&alice_attestation)?.prove(&prover, &params)?;
crate::measure_gates_print!();
Expand Down Expand Up @@ -908,7 +908,7 @@ pub mod tests {
let cpb_and = CustomPredicateRef::new(cpb.clone(), 0);
let _cpb_or = CustomPredicateRef::new(cpb.clone(), 1);

let mut pod_builder = MainPodBuilder::new(&params, &vd_set);
let mut pod_builder = MainPodBuilder::new(&params, vd_set);

let st0 = pod_builder.priv_op(op!(new_entry, "score", 42))?;
let st1 = pod_builder.priv_op(op!(new_entry, "key", 42))?;
Expand All @@ -932,7 +932,7 @@ pub mod tests {
#[test]
fn test_set_contains() -> frontend::Result<()> {
let params = Params::default();
let mut builder = MainPodBuilder::new(&params, &*DEFAULT_VD_SET);
let mut builder = MainPodBuilder::new(&params, &DEFAULT_VD_SET);
let set = [1, 2, 3].into_iter().map(|n| n.into()).collect();
let st = builder
.pub_op(op!(
Expand Down
2 changes: 1 addition & 1 deletion src/backends/plonky2/mock/mainpod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ pub mod tests {
let sanction_list_pod = sanction_list_builder.sign(&signer)?;
let kyc_builder = zu_kyc_pod_builder(
&params,
&vd_set,
vd_set,
&gov_id_pod,
&pay_stub_pod,
&sanction_list_pod,
Expand Down
4 changes: 2 additions & 2 deletions src/backends/plonky2/recursion/circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -832,15 +832,15 @@ mod tests {
let common_data = &circuit_data_3.common;

let (_, circuit_data_1) =
RC::<Circuit1>::target_and_circuit_data_padded(arity, &common_data, &inner_params)?;
RC::<Circuit1>::target_and_circuit_data_padded(arity, common_data, &inner_params)?;
let params_1 = RecursiveParams {
arity,
common_data: circuit_data_1.common.clone(),
verifier_data: circuit_data_1.verifier_data(),
};

let (_, circuit_data_2) =
RC::<Circuit2>::target_and_circuit_data_padded(arity, &common_data, &inner_params)?;
RC::<Circuit2>::target_and_circuit_data_padded(arity, common_data, &inner_params)?;
let params_2 = RecursiveParams {
arity,
common_data: circuit_data_2.common.clone(),
Expand Down
12 changes: 6 additions & 6 deletions src/examples/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::{collections::HashSet, sync::LazyLock};

use custom::eth_dos_batch;

pub const MOCK_VD_SET: LazyLock<VDSet> = LazyLock::new(|| VDSet::new(6, &[]).unwrap());
pub static MOCK_VD_SET: LazyLock<VDSet> = LazyLock::new(|| VDSet::new(6, &[]).unwrap());

use crate::{
backends::plonky2::{primitives::ec::schnorr::SecretKey, signedpod::Signer},
Expand Down Expand Up @@ -266,11 +266,11 @@ pub fn great_boy_pod_builder(
// good boy 1 -> friend_pods[1] => receiver

let mut great_boy = MainPodBuilder::new(params, vd_set);
for i in 0..4 {
great_boy.add_signed_pod(good_boy_pods[i]);
for good_boy_pod in good_boy_pods {
great_boy.add_signed_pod(good_boy_pod);
}
for i in 0..2 {
great_boy.add_signed_pod(friend_pods[i]);
for friend_pod in friend_pods {
great_boy.add_signed_pod(friend_pod);
}

for good_boy_idx in 0..2 {
Expand Down Expand Up @@ -376,7 +376,7 @@ pub fn great_boy_pod_full_flow() -> Result<(Params, MainPodBuilder)> {

let builder = great_boy_pod_builder(
&params,
&vd_set,
vd_set,
[
&bob_good_boys[0],
&bob_good_boys[1],
Expand Down
4 changes: 2 additions & 2 deletions src/frontend/custom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ mod tests {
let batch_clone = batch.clone();
let gt_custom_pred = CustomPredicateRef::new(batch, 0);

let mut mp_builder = MainPodBuilder::new(&params, &vd_set);
let mut mp_builder = MainPodBuilder::new(&params, vd_set);

// 2 > 1
let s1 = mp_builder.priv_op(op!(new_entry, "s1_key", Value::from(2)))?;
Expand Down Expand Up @@ -337,7 +337,7 @@ mod tests {
let batch = builder.finish();
let batch_clone = batch.clone();

let mut mp_builder = MainPodBuilder::new(&params, &vd_set);
let mut mp_builder = MainPodBuilder::new(&params, vd_set);

let set_values: HashSet<Value> = [1, 2, 3].iter().map(|i| Value::from(*i)).collect();
let s1 = mp_builder.priv_op(op!(
Expand Down
12 changes: 6 additions & 6 deletions src/frontend/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,7 @@ pub mod tests {
check_kvs(&sanction_list)?;
println!("{}", sanction_list);

let kyc_builder = zu_kyc_pod_builder(&params, &vd_set, &gov_id, &pay_stub, &sanction_list)?;
let kyc_builder = zu_kyc_pod_builder(&params, vd_set, &gov_id, &pay_stub, &sanction_list)?;
println!("{}", kyc_builder);

// prove kyc with MockProver and print it
Expand Down Expand Up @@ -973,7 +973,7 @@ pub mod tests {
let signer = Signer(SecretKey(1u32.into()));
let signed_pod = signed_builder.sign(&signer).unwrap();

let mut builder = MainPodBuilder::new(&params, &vd_set);
let mut builder = MainPodBuilder::new(&params, vd_set);
builder.add_signed_pod(&signed_pod);

//let op_val1 = Operation{
Expand Down Expand Up @@ -1026,7 +1026,7 @@ pub mod tests {

println!("{}", pod);

let mut builder = MainPodBuilder::new(&params, &vd_set);
let mut builder = MainPodBuilder::new(&params, vd_set);
builder.add_signed_pod(&pod);
builder.pub_op(op!(gt, (&pod, "num"), 5)).unwrap();

Expand Down Expand Up @@ -1056,7 +1056,7 @@ pub mod tests {
let signer = Signer(SecretKey(1u32.into()));
let pod = builder.sign(&signer).unwrap();

let mut builder = MainPodBuilder::new(&params, &vd_set);
let mut builder = MainPodBuilder::new(&params, vd_set);
builder.add_signed_pod(&pod);
let st0 = pod.get_statement("dict").unwrap();
let st1 = builder.op(true, op!(new_entry, "key", "a")).unwrap();
Expand Down Expand Up @@ -1093,7 +1093,7 @@ pub mod tests {

let params = Params::default();
let vd_set = &*MOCK_VD_SET;
let mut builder = MainPodBuilder::new(&params, &vd_set);
let mut builder = MainPodBuilder::new(&params, vd_set);
let st = Statement::equal(AnchoredKey::from((SELF, "a")), Value::from(3));
let op_new_entry = Operation(
OperationType::Native(NativeOperation::NewEntry),
Expand All @@ -1117,7 +1117,7 @@ pub mod tests {
// right now the mock prover catches this when it calls compile()
let params = Params::default();
let vd_set = &*MOCK_VD_SET;
let mut builder = MainPodBuilder::new(&params, &vd_set);
let mut builder = MainPodBuilder::new(&params, vd_set);
let self_a = AnchoredKey::from((SELF, "a"));
let self_b = AnchoredKey::from((SELF, "b"));
let value_of_a = Statement::equal(self_a.clone(), Value::from(3));
Expand Down
4 changes: 2 additions & 2 deletions src/frontend/serialization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ mod tests {
let sanction_list_pod = sanction_list_builder.sign(&signer).unwrap();
let kyc_builder = zu_kyc_pod_builder(
&params,
&vd_set,
vd_set,
&gov_id_pod,
&pay_stub_pod,
&sanction_list_pod,
Expand Down Expand Up @@ -300,7 +300,7 @@ mod tests {
let sanction_list_pod = sanction_list_builder.sign(&signer)?;
let kyc_builder = zu_kyc_pod_builder(
&params,
&vd_set,
vd_set,
&gov_id_pod,
&pay_stub_pod,
&sanction_list_pod,
Expand Down
1 change: 1 addition & 0 deletions src/middleware/custom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,7 @@ mod tests {
names.iter().map(|s| s.to_string()).collect()
}

#[allow(clippy::upper_case_acronyms)]
type STA = StatementTmplArg;
type P = Predicate;
type NP = NativePredicate;
Expand Down
Loading