Skip to content

Commit

Permalink
chore: formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
huitseeker committed May 2, 2024
1 parent 3d73656 commit 2b58942
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 20 deletions.
2 changes: 1 addition & 1 deletion benches/compressed-snark.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#![allow(non_snake_case)]

use bellpepper_core::{num::AllocatedNum, ConstraintSystem, SynthesisError};
use halo2curves::bn256::Bn256;
use core::marker::PhantomData;
use criterion::{measurement::WallTime, *};
use ff::PrimeField;
use halo2curves::bn256::Bn256;
use nova_snark::{
provider::{Bn256EngineKZG, GrumpkinEngine},
traits::{
Expand Down
2 changes: 1 addition & 1 deletion benches/ppsnark.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#![allow(non_snake_case)]

use bellpepper_core::{num::AllocatedNum, ConstraintSystem, SynthesisError};
use halo2curves::bn256::Bn256;
use core::marker::PhantomData;
use criterion::*;
use ff::PrimeField;
use halo2curves::bn256::Bn256;
use nova_snark::{
provider::Bn256EngineKZG,
spartan::direct::DirectSNARK,
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -850,8 +850,8 @@ mod tests {
use super::*;
use crate::{
provider::{
traits::DlogGroup, Bn256EngineIPA, Bn256EngineKZG, Bn256EngineZM,
GrumpkinEngine, PallasEngine, Secp256k1Engine, Secq256k1Engine, VestaEngine, non_hiding_zeromorph::ZMPCS,
non_hiding_zeromorph::ZMPCS, traits::DlogGroup, Bn256EngineIPA, Bn256EngineKZG,
Bn256EngineZM, GrumpkinEngine, PallasEngine, Secp256k1Engine, Secq256k1Engine, VestaEngine,
},
traits::{circuit::TrivialCircuit, evaluation::EvaluationEngineTrait, snark::default_ck_hint},
};
Expand Down
29 changes: 18 additions & 11 deletions src/provider/hyperkzg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,9 +424,10 @@ mod tests {
use super::*;
use crate::provider::test_utils::prove_verify_from_num_vars;
use crate::{
provider::keccak::Keccak256Transcript, CommitmentKey,
provider::keccak::Keccak256Transcript, provider::kzg_commitment::KZGCommitmentEngine,
};
use bincode::Options;
use halo2curves::bn256::Bn256;

type E = halo2curves::bn256::Bn256;
type NE = crate::provider::Bn256EngineKZG;
Expand Down Expand Up @@ -497,23 +498,29 @@ mod tests {
// eval = 28
let eval = Fr::from(28);

let ck: CommitmentKey<NE> =
<KZGCommitmentEngine<E> as CommitmentEngineTrait<NE>>::setup(b"test", n);
let (pk, vk): (KZGProverKey<E>, KZGVerifierKey<E>) = EvaluationEngine::<E, NE>::setup(&ck);
let ck = <KZGCommitmentEngine<Bn256> as CommitmentEngineTrait<NE>>::setup(b"test", n);
let (pk, vk) = EvaluationEngine::<Bn256, NE>::setup(&ck);

// make a commitment
let C = KZGCommitmentEngine::commit(&ck, &poly);
let C = <KZGCommitmentEngine<Bn256> as CommitmentEngineTrait<NE>>::commit(&ck, &poly);

// prove an evaluation
let mut prover_transcript = Keccak256Transcript::new(b"TestEval");
let proof =
EvaluationEngine::<E, NE>::prove(&ck, &pk, &mut prover_transcript, &C, &poly, &point, &eval)
.unwrap();
let proof = EvaluationEngine::<Bn256, NE>::prove(
&ck,
&pk,
&mut prover_transcript,
&C,
&poly,
&point,
&eval,
)
.unwrap();
let post_c_p = prover_transcript.squeeze(b"c").unwrap();

// verify the evaluation
let mut verifier_transcript = Keccak256Transcript::<NE>::new(b"TestEval");
assert!(EvaluationEngine::<E, NE>::verify(
assert!(EvaluationEngine::<Bn256, NE>::verify(
&vk,
&mut verifier_transcript,
&C,
Expand All @@ -536,9 +543,9 @@ mod tests {

// Change the proof and expect verification to fail
let mut bad_proof = proof.clone();
bad_proof.comms[0] = (bad_proof.comms[0] + bad_proof.comms[0] * Fr::from(123)).to_affine();
bad_proof.evals[0] = bad_proof.evals[1].clone();

Check failure on line 546 in src/provider/hyperkzg.rs

View workflow job for this annotation

GitHub Actions / clippy

assigning the result of `Clone::clone()` may be inefficient
let mut verifier_transcript2 = Keccak256Transcript::<NE>::new(b"TestEval");
assert!(EvaluationEngine::<E, NE>::verify(
assert!(EvaluationEngine::<Bn256, NE>::verify(
&vk,
&mut verifier_transcript2,
&C,
Expand Down
7 changes: 3 additions & 4 deletions src/provider/non_hiding_zeromorph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -595,10 +595,9 @@ mod test {
use crate::{
provider::{
non_hiding_zeromorph::UVKZGPoly,
non_hiding_zeromorph::{
batched_lifted_degree_quotient, eval_and_quotient_scalars, ZMPCS,
},
test_utils::prove_verify_from_num_vars, Bn256EngineZM,
non_hiding_zeromorph::{batched_lifted_degree_quotient, eval_and_quotient_scalars, ZMPCS},
test_utils::prove_verify_from_num_vars,
Bn256EngineZM,
},
spartan::polys::multilinear::MultilinearPolynomial,
};
Expand Down
2 changes: 1 addition & 1 deletion src/spartan/direct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,9 @@ mod tests {
use super::*;
use crate::provider::{Bn256EngineKZG, PallasEngine, Secp256k1Engine};
use ::bellpepper_core::{num::AllocatedNum, ConstraintSystem, SynthesisError};
use halo2curves::bn256::Bn256;
use core::marker::PhantomData;
use ff::PrimeField;
use halo2curves::bn256::Bn256;

#[derive(Clone, Debug, Default)]
struct CubicCircuit<F: PrimeField> {
Expand Down

0 comments on commit 2b58942

Please sign in to comment.