mirror of
https://github.com/arnaucube/sonobe.git
synced 2026-01-28 06:53:48 +01:00
Implement HyperNova's IVC into the FoldingScheme trait (#116)
- implement the IVC `FoldingScheme` trait for HyperNova
- refactor Nova's preprocess logic to make it simplier to use
- add to Decider trait (& Nova's DeciderEth) a preprocess method
- get rid of the `init_nova_ivc_params` and `init_ivc_and_decider_params` methods in `examples` since this is achieved with the `FS::preprocess` & `Decider::preprocess` methods
- (update the examples code to the simplified interface using
FS::preprocess & Decider::preprocess)
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
#![allow(non_snake_case)]
|
||||
#![allow(non_upper_case_globals)]
|
||||
#![allow(non_camel_case_types)]
|
||||
#![allow(clippy::upper_case_acronyms)]
|
||||
|
||||
use ark_ec::{pairing::Pairing, CurveGroup};
|
||||
use ark_ff::PrimeField;
|
||||
@@ -110,13 +109,15 @@ where
|
||||
C2::BaseField: PrimeField,
|
||||
FC: FCircuit<C1::ScalarField>,
|
||||
{
|
||||
type PreprocessorParam: Debug;
|
||||
type ProverParam: Debug;
|
||||
type VerifierParam: Debug;
|
||||
type CommittedInstanceWithWitness: Debug;
|
||||
type CFCommittedInstanceWithWitness: Debug; // CycleFold CommittedInstance & Witness
|
||||
type PreprocessorParam: Debug + Clone;
|
||||
type ProverParam: Debug + Clone;
|
||||
type VerifierParam: Debug + Clone;
|
||||
type RunningInstance: Debug; // contains the CommittedInstance + Witness
|
||||
type IncomingInstance: Debug; // contains the CommittedInstance + Witness
|
||||
type CFInstance: Debug; // CycleFold CommittedInstance & Witness
|
||||
|
||||
fn preprocess(
|
||||
rng: impl RngCore,
|
||||
prep_param: &Self::PreprocessorParam,
|
||||
) -> Result<(Self::ProverParam, Self::VerifierParam), Error>;
|
||||
|
||||
@@ -126,7 +127,11 @@ where
|
||||
z_0: Vec<C1::ScalarField>, // initial state
|
||||
) -> Result<Self, Error>;
|
||||
|
||||
fn prove_step(&mut self, external_inputs: Vec<C1::ScalarField>) -> Result<(), Error>;
|
||||
fn prove_step(
|
||||
&mut self,
|
||||
rng: impl RngCore,
|
||||
external_inputs: Vec<C1::ScalarField>,
|
||||
) -> Result<(), Error>;
|
||||
|
||||
// returns the state at the current step
|
||||
fn state(&self) -> Vec<C1::ScalarField>;
|
||||
@@ -136,9 +141,9 @@ where
|
||||
fn instances(
|
||||
&self,
|
||||
) -> (
|
||||
Self::CommittedInstanceWithWitness,
|
||||
Self::CommittedInstanceWithWitness,
|
||||
Self::CFCommittedInstanceWithWitness,
|
||||
Self::RunningInstance,
|
||||
Self::IncomingInstance,
|
||||
Self::CFInstance,
|
||||
);
|
||||
|
||||
fn verify(
|
||||
@@ -147,9 +152,9 @@ where
|
||||
z_i: Vec<C1::ScalarField>, // last state
|
||||
// number of steps between the initial state and the last state
|
||||
num_steps: C1::ScalarField,
|
||||
running_instance: Self::CommittedInstanceWithWitness,
|
||||
incoming_instance: Self::CommittedInstanceWithWitness,
|
||||
cyclefold_instance: Self::CFCommittedInstanceWithWitness,
|
||||
running_instance: Self::RunningInstance,
|
||||
incoming_instance: Self::IncomingInstance,
|
||||
cyclefold_instance: Self::CFInstance,
|
||||
) -> Result<(), Error>;
|
||||
}
|
||||
|
||||
@@ -162,16 +167,22 @@ pub trait Decider<
|
||||
C1: CurveGroup<BaseField = C2::ScalarField, ScalarField = C2::BaseField>,
|
||||
C2::BaseField: PrimeField,
|
||||
{
|
||||
type PreprocessorParam: Debug;
|
||||
type ProverParam: Clone;
|
||||
type Proof;
|
||||
type VerifierParam;
|
||||
type PublicInput: Debug;
|
||||
type CommittedInstanceWithWitness: Debug;
|
||||
type CommittedInstance: Clone + Debug;
|
||||
|
||||
fn prove(
|
||||
pp: Self::ProverParam,
|
||||
fn preprocess(
|
||||
rng: impl RngCore + CryptoRng,
|
||||
prep_param: &Self::PreprocessorParam,
|
||||
fs: FS,
|
||||
) -> Result<(Self::ProverParam, Self::VerifierParam), Error>;
|
||||
|
||||
fn prove(
|
||||
rng: impl RngCore + CryptoRng,
|
||||
pp: Self::ProverParam,
|
||||
folding_scheme: FS,
|
||||
) -> Result<Self::Proof, Error>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user