mirror of
https://github.com/arnaucube/sonobe.git
synced 2026-01-08 15:01:30 +01:00
Onchain decider circuit for Protogalaxy (#145)
* Move r1cs and ccs to standalone folders * Simplify type bounds of SparseMatrixVar * Implement `EquivalenceGadget` trait for `FpVar` and `NonNativeUintVar`. Together with the existing `MatrixGadget` and `VectorGadget`, we can now use the same logic for checking R1CS satisfiability of `R1CSVar` both natively and non-natively. * Simplify trait bounds * Implement `ArithGadget` for `R1CSMatricesVar` and `CCSMatricesVar` * `PedersenGadget::commit` now takes slices as input * Structs for proofs and auxiliary values in protogalaxy * `u` in LCCCS should be `z[0]` * `Inputize` trait * Generic decider circuits * Verifier should check the commitments in committed instances * Update the comments according to the new docs * Fix examples * Add `DeciderEnabledNIFS::fold_group_elements_native` to wrap code for folding commitments * Fix incorrect endian * Format * Get rid of `unwrap` when possible
This commit is contained in:
@@ -19,9 +19,12 @@ use std::time::Instant;
|
||||
|
||||
use folding_schemes::{
|
||||
commitment::{kzg::KZG, pedersen::Pedersen},
|
||||
folding::nova::{
|
||||
decider_eth::{prepare_calldata, Decider as DeciderEth},
|
||||
Nova, PreprocessorParam,
|
||||
folding::{
|
||||
nova::{
|
||||
decider_eth::{prepare_calldata, Decider as DeciderEth},
|
||||
Nova, PreprocessorParam,
|
||||
},
|
||||
traits::CommittedInstanceOps,
|
||||
},
|
||||
frontend::FCircuit,
|
||||
transcript::poseidon::poseidon_canonical_config,
|
||||
@@ -83,7 +86,6 @@ fn main() {
|
||||
// prepare the Nova prover & verifier params
|
||||
let nova_preprocess_params = PreprocessorParam::new(poseidon_config, f_circuit.clone());
|
||||
let nova_params = N::preprocess(&mut rng, &nova_preprocess_params).unwrap();
|
||||
let pp_hash = nova_params.1.pp_hash().unwrap();
|
||||
|
||||
// initialize the folding scheme engine, in our case we use Nova
|
||||
let mut nova = N::init(&nova_params, f_circuit.clone(), z_0).unwrap();
|
||||
@@ -117,8 +119,8 @@ fn main() {
|
||||
nova.i,
|
||||
nova.z_0.clone(),
|
||||
nova.z_i.clone(),
|
||||
&nova.U_i,
|
||||
&nova.u_i,
|
||||
&nova.U_i.get_commitments(),
|
||||
&nova.u_i.get_commitments(),
|
||||
&proof,
|
||||
)
|
||||
.unwrap();
|
||||
@@ -131,7 +133,6 @@ fn main() {
|
||||
|
||||
let calldata: Vec<u8> = prepare_calldata(
|
||||
function_selector,
|
||||
pp_hash,
|
||||
nova.i,
|
||||
nova.z_0,
|
||||
nova.z_i,
|
||||
|
||||
@@ -21,9 +21,12 @@ use std::time::Instant;
|
||||
|
||||
use folding_schemes::{
|
||||
commitment::{kzg::KZG, pedersen::Pedersen},
|
||||
folding::nova::{
|
||||
decider_eth::{prepare_calldata, Decider as DeciderEth},
|
||||
Nova, PreprocessorParam,
|
||||
folding::{
|
||||
nova::{
|
||||
decider_eth::{prepare_calldata, Decider as DeciderEth},
|
||||
Nova, PreprocessorParam,
|
||||
},
|
||||
traits::CommittedInstanceOps,
|
||||
},
|
||||
frontend::FCircuit,
|
||||
transcript::poseidon::poseidon_canonical_config,
|
||||
@@ -101,7 +104,6 @@ fn main() {
|
||||
// prepare the Nova prover & verifier params
|
||||
let nova_preprocess_params = PreprocessorParam::new(poseidon_config.clone(), f_circuit);
|
||||
let nova_params = N::preprocess(&mut rng, &nova_preprocess_params).unwrap();
|
||||
let pp_hash = nova_params.1.pp_hash().unwrap();
|
||||
|
||||
// initialize the folding scheme engine, in our case we use Nova
|
||||
let mut nova = N::init(&nova_params, f_circuit, z_0).unwrap();
|
||||
@@ -125,8 +127,8 @@ fn main() {
|
||||
nova.i,
|
||||
nova.z_0.clone(),
|
||||
nova.z_i.clone(),
|
||||
&nova.U_i,
|
||||
&nova.u_i,
|
||||
&nova.U_i.get_commitments(),
|
||||
&nova.u_i.get_commitments(),
|
||||
&proof,
|
||||
)
|
||||
.unwrap();
|
||||
@@ -139,7 +141,6 @@ fn main() {
|
||||
|
||||
let calldata: Vec<u8> = prepare_calldata(
|
||||
function_selector,
|
||||
pp_hash,
|
||||
nova.i,
|
||||
nova.z_0,
|
||||
nova.z_i,
|
||||
|
||||
@@ -16,9 +16,12 @@ use ark_grumpkin::{constraints::GVar as GVar2, Projective as G2};
|
||||
|
||||
use folding_schemes::{
|
||||
commitment::{kzg::KZG, pedersen::Pedersen},
|
||||
folding::nova::{
|
||||
decider_eth::{prepare_calldata, Decider as DeciderEth},
|
||||
Nova, PreprocessorParam,
|
||||
folding::{
|
||||
nova::{
|
||||
decider_eth::{prepare_calldata, Decider as DeciderEth},
|
||||
Nova, PreprocessorParam,
|
||||
},
|
||||
traits::CommittedInstanceOps,
|
||||
},
|
||||
frontend::FCircuit,
|
||||
transcript::poseidon::poseidon_canonical_config,
|
||||
@@ -46,7 +49,7 @@ fn main() {
|
||||
cur_path.to_str().unwrap()
|
||||
);
|
||||
|
||||
let circuit = load_noir_circuit(circuit_path);
|
||||
let circuit = load_noir_circuit(circuit_path).unwrap();
|
||||
let f_circuit = NoirFCircuit {
|
||||
circuit,
|
||||
state_len: 1,
|
||||
@@ -72,7 +75,6 @@ fn main() {
|
||||
// prepare the Nova prover & verifier params
|
||||
let nova_preprocess_params = PreprocessorParam::new(poseidon_config, f_circuit.clone());
|
||||
let nova_params = N::preprocess(&mut rng, &nova_preprocess_params).unwrap();
|
||||
let pp_hash = nova_params.1.pp_hash().unwrap();
|
||||
|
||||
// initialize the folding scheme engine, in our case we use Nova
|
||||
let mut nova = N::init(&nova_params, f_circuit.clone(), z_0).unwrap();
|
||||
@@ -104,8 +106,8 @@ fn main() {
|
||||
nova.i,
|
||||
nova.z_0.clone(),
|
||||
nova.z_i.clone(),
|
||||
&nova.U_i,
|
||||
&nova.u_i,
|
||||
&nova.U_i.get_commitments(),
|
||||
&nova.u_i.get_commitments(),
|
||||
&proof,
|
||||
)
|
||||
.unwrap();
|
||||
@@ -118,7 +120,6 @@ fn main() {
|
||||
|
||||
let calldata: Vec<u8> = prepare_calldata(
|
||||
function_selector,
|
||||
pp_hash,
|
||||
nova.i,
|
||||
nova.z_0,
|
||||
nova.z_i,
|
||||
|
||||
@@ -17,9 +17,12 @@ use ark_grumpkin::{constraints::GVar as GVar2, Projective as G2};
|
||||
|
||||
use folding_schemes::{
|
||||
commitment::{kzg::KZG, pedersen::Pedersen},
|
||||
folding::nova::{
|
||||
decider_eth::{prepare_calldata, Decider as DeciderEth},
|
||||
Nova, PreprocessorParam,
|
||||
folding::{
|
||||
nova::{
|
||||
decider_eth::{prepare_calldata, Decider as DeciderEth},
|
||||
Nova, PreprocessorParam,
|
||||
},
|
||||
traits::CommittedInstanceOps,
|
||||
},
|
||||
frontend::FCircuit,
|
||||
transcript::poseidon::poseidon_canonical_config,
|
||||
@@ -85,7 +88,6 @@ fn main() {
|
||||
// prepare the Nova prover & verifier params
|
||||
let nova_preprocess_params = PreprocessorParam::new(poseidon_config, f_circuit.clone());
|
||||
let nova_params = N::preprocess(&mut rng, &nova_preprocess_params).unwrap();
|
||||
let pp_hash = nova_params.1.pp_hash().unwrap();
|
||||
|
||||
// initialize the folding scheme engine, in our case we use Nova
|
||||
let mut nova = N::init(&nova_params, f_circuit.clone(), z_0).unwrap();
|
||||
@@ -119,8 +121,8 @@ fn main() {
|
||||
nova.i,
|
||||
nova.z_0.clone(),
|
||||
nova.z_i.clone(),
|
||||
&nova.U_i,
|
||||
&nova.u_i,
|
||||
&nova.U_i.get_commitments(),
|
||||
&nova.u_i.get_commitments(),
|
||||
&proof,
|
||||
)
|
||||
.unwrap();
|
||||
@@ -133,7 +135,6 @@ fn main() {
|
||||
|
||||
let calldata: Vec<u8> = prepare_calldata(
|
||||
function_selector,
|
||||
pp_hash,
|
||||
nova.i,
|
||||
nova.z_0,
|
||||
nova.z_i,
|
||||
|
||||
Reference in New Issue
Block a user