mirror of
https://github.com/arnaucube/Nova.git
synced 2026-01-11 16:41:28 +01:00
reorganize traits into a module; cut boilerplate code (#91)
use a default implementation for step circuit
This commit is contained in:
@@ -12,11 +12,13 @@ use neptune::{
|
||||
Strength,
|
||||
};
|
||||
use nova_snark::{
|
||||
traits::{Group, StepCircuit},
|
||||
traits::{
|
||||
circuit::{StepCircuit, TrivialTestCircuit},
|
||||
Group,
|
||||
},
|
||||
CompressedSNARK, PublicParams, RecursiveSNARK,
|
||||
};
|
||||
use num_bigint::BigUint;
|
||||
use std::marker::PhantomData;
|
||||
use std::time::Instant;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
@@ -183,9 +185,7 @@ fn main() {
|
||||
pc: pc.clone(),
|
||||
};
|
||||
|
||||
let circuit_secondary = TrivialTestCircuit {
|
||||
_p: Default::default(),
|
||||
};
|
||||
let circuit_secondary = TrivialTestCircuit::default();
|
||||
|
||||
println!("Nova-based VDF with MinRoot delay function");
|
||||
println!("==========================================");
|
||||
@@ -299,26 +299,3 @@ fn main() {
|
||||
);
|
||||
assert!(res.is_ok());
|
||||
}
|
||||
|
||||
// A trivial test circuit that we use on the secondary curve
|
||||
#[derive(Clone, Debug)]
|
||||
struct TrivialTestCircuit<F: PrimeField> {
|
||||
_p: PhantomData<F>,
|
||||
}
|
||||
|
||||
impl<F> StepCircuit<F> for TrivialTestCircuit<F>
|
||||
where
|
||||
F: PrimeField,
|
||||
{
|
||||
fn synthesize<CS: ConstraintSystem<F>>(
|
||||
&self,
|
||||
_cs: &mut CS,
|
||||
z: AllocatedNum<F>,
|
||||
) -> Result<AllocatedNum<F>, SynthesisError> {
|
||||
Ok(z)
|
||||
}
|
||||
|
||||
fn compute(&self, z: &F) -> F {
|
||||
*z
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user