|
|
@ -1,12 +1,12 @@ |
|
|
|
use ark_bn254::{Bn254, constraints::GVar, Fr, G1Projective as G1};
|
|
|
|
use ark_bn254::{constraints::GVar, Bn254, Fr, G1Projective as G1};
|
|
|
|
use ark_crypto_primitives::sponge::poseidon::PoseidonConfig;
|
|
|
|
use ark_grumpkin::{constraints::GVar as GVar2, Projective as G2};
|
|
|
|
use sonobe::{
|
|
|
|
commitment::{kzg::KZG, pedersen::Pedersen},
|
|
|
|
folding::{hypernova::HyperNova, nova::Nova},
|
|
|
|
FoldingScheme,
|
|
|
|
frontend::circom::CircomFCircuit,
|
|
|
|
transcript::poseidon::poseidon_canonical_config,
|
|
|
|
FoldingScheme,
|
|
|
|
};
|
|
|
|
|
|
|
|
pub type NovaFolding =
|
|
|
@ -24,11 +24,20 @@ pub type HyperNovaFolding = HyperNova< |
|
|
|
false,
|
|
|
|
>;
|
|
|
|
|
|
|
|
pub struct StepInput<OtherInstances> {
|
|
|
|
pub external_inputs: Vec<Fr>,
|
|
|
|
pub other_instances: Option<OtherInstances>,
|
|
|
|
}
|
|
|
|
|
|
|
|
pub trait FoldingSchemeExt: FoldingScheme<G1, G2, CircomFCircuit<Fr>> {
|
|
|
|
fn prepreprocess(
|
|
|
|
poseidon_config: PoseidonConfig<Fr>,
|
|
|
|
circuit: CircomFCircuit<Fr>,
|
|
|
|
) -> Self::PreprocessorParam;
|
|
|
|
|
|
|
|
fn transform_inputs(
|
|
|
|
full_input: Vec<Vec<Fr>>,
|
|
|
|
) -> impl Iterator<Item = StepInput<Self::MultiCommittedInstanceWithWitness>>;
|
|
|
|
}
|
|
|
|
|
|
|
|
impl FoldingSchemeExt for NovaFolding {
|
|
|
@ -38,6 +47,15 @@ impl FoldingSchemeExt for NovaFolding { |
|
|
|
) -> Self::PreprocessorParam {
|
|
|
|
Self::PreprocessorParam::new(poseidon_config, circuit)
|
|
|
|
}
|
|
|
|
|
|
|
|
fn transform_inputs(
|
|
|
|
full_input: Vec<Vec<Fr>>,
|
|
|
|
) -> impl Iterator<Item = StepInput<Self::MultiCommittedInstanceWithWitness>> {
|
|
|
|
full_input.into_iter().map(|input| StepInput {
|
|
|
|
external_inputs: input,
|
|
|
|
other_instances: None,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl FoldingSchemeExt for HyperNovaFolding {
|
|
|
@ -47,6 +65,15 @@ impl FoldingSchemeExt for HyperNovaFolding { |
|
|
|
) -> Self::PreprocessorParam {
|
|
|
|
Self::PreprocessorParam::new(poseidon_config, circuit)
|
|
|
|
}
|
|
|
|
|
|
|
|
fn transform_inputs(
|
|
|
|
full_input: Vec<Vec<Fr>>,
|
|
|
|
) -> impl Iterator<Item = StepInput<Self::MultiCommittedInstanceWithWitness>> {
|
|
|
|
full_input.into_iter().map(|input| StepInput {
|
|
|
|
external_inputs: input,
|
|
|
|
other_instances: Some((vec![], vec![])),
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn prepare_folding<FS: FoldingSchemeExt>(
|
|
|
|