Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions src/lib/crypto/kimchi_bindings/stubs/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use ark_ec::AffineRepr;
use ark_poly::{EvaluationDomain, Radix2EvaluationDomain as D};
use cache::LagrangeCache;
use mina_curves::pasta::{Pallas, Vesta};
use poly_commitment::{commitment::CommitmentCurve, srs::SRS};
use poly_commitment::{commitment::CommitmentCurve, ipa::SRS, SRS as _};
use std::env;

pub trait WithLagrangeBasis<G: AffineRepr> {
Expand Down
5 changes: 4 additions & 1 deletion src/lib/crypto/kimchi_bindings/stubs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,8 @@ pub use {
CamlLookupCommitments, CamlProofWithPublic, CamlProverCommitments, CamlProverProof,
},
mina_poseidon::sponge::caml::CamlScalarChallenge,
poly_commitment::commitment::caml::{CamlOpeningProof, CamlPolyComm},
poly_commitment::{
ipa::caml::CamlOpeningProof,
commitment::caml::CamlPolyComm,
},
};
3 changes: 1 addition & 2 deletions src/lib/crypto/kimchi_bindings/stubs/src/oracles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ use mina_poseidon::{
};
use paste::paste;
use poly_commitment::commitment::{caml::CamlPolyComm, shift_scalar, PolyComm};
use poly_commitment::evaluation_proof::OpeningProof;
use poly_commitment::SRS;
use poly_commitment::{ipa::OpeningProof, SRS};

#[derive(ocaml::IntoValue, ocaml::FromValue, ocaml_gen::Struct)]
pub struct CamlOracles<F> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use kimchi::circuits::{constraints::ConstraintSystem, gate::CircuitGate};
use kimchi::{linearization::expr_linearization, prover_index::ProverIndex};
use mina_curves::pasta::{Fp, Pallas, Vesta, VestaParameters};
use mina_poseidon::{constants::PlonkSpongeConstantsKimchi, sponge::DefaultFqSponge};
use poly_commitment::{evaluation_proof::OpeningProof, SRS as _};
use poly_commitment::{ipa::OpeningProof, SRS as _};
use serde::{Deserialize, Serialize};
use std::{
fs::{File, OpenOptions},
Expand Down Expand Up @@ -85,7 +85,7 @@ pub fn caml_pasta_fp_plonk_index_create(
};

// endo
let (endo_q, _endo_r) = poly_commitment::srs::endos::<Pallas>();
let (endo_q, _endo_r) = poly_commitment::ipa::endos::<Pallas>();

srs.0.with_lagrange_basis(cs.domain.d1);

Expand All @@ -100,7 +100,7 @@ pub fn caml_pasta_fp_plonk_index_create(
#[ocaml_gen::func]
#[ocaml::func]
pub fn caml_pasta_fp_plonk_index_max_degree(index: CamlPastaFpPlonkIndexPtr) -> ocaml::Int {
index.as_ref().0.srs.max_degree() as isize
index.as_ref().0.srs.max_poly_size() as isize
}

#[ocaml_gen::func]
Expand Down
32 changes: 17 additions & 15 deletions src/lib/crypto/kimchi_bindings/stubs/src/pasta_fp_plonk_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use mina_poseidon::{
sponge::{DefaultFqSponge, DefaultFrSponge},
};
use poly_commitment::commitment::{CommitmentCurve, PolyComm};
use poly_commitment::evaluation_proof::OpeningProof;
use poly_commitment::ipa::OpeningProof;
use std::array;
use std::convert::TryInto;

Expand Down Expand Up @@ -66,7 +66,7 @@ pub fn caml_pasta_fp_plonk_proof_create(
.iter()
.map(Into::<Fp>::into)
.collect();
let comm = PolyComm::<Vesta> { elems: vec![sg] };
let comm = PolyComm::<Vesta> { chunks: vec![sg] };
RecursionChallenge { chals, comm }
})
.collect()
Expand Down Expand Up @@ -134,7 +134,7 @@ pub fn caml_pasta_fp_plonk_proof_create_and_verify(
.iter()
.map(Into::<Fp>::into)
.collect();
let comm = PolyComm::<Vesta> { elems: vec![sg] };
let comm = PolyComm::<Vesta> { chunks: vec![sg] };
RecursionChallenge { chals, comm }
})
.collect()
Expand Down Expand Up @@ -204,7 +204,7 @@ pub fn caml_pasta_fp_plonk_proof_example_with_lookup(
polynomial::COLUMNS,
wires::Wire,
};
use poly_commitment::srs::endos;
use poly_commitment::ipa::endos;

let num_gates = 1000;
let num_tables: usize = 5;
Expand Down Expand Up @@ -319,13 +319,13 @@ pub fn caml_pasta_fp_plonk_proof_example_with_foreign_field_mul(
use kimchi::circuits::{
constraints::ConstraintSystem,
gate::{CircuitGate, Connect},
polynomials::foreign_field_mul,
polynomials::{foreign_field_mul, foreign_field_common::BigUintForeignFieldHelpers},
wires::Wire,
};
use num_bigint::BigUint;
use num_bigint::RandBigInt;
use o1_utils::{foreign_field::BigUintForeignFieldHelpers, FieldHelpers};
use poly_commitment::srs::endos;
use o1_utils::FieldHelpers;
use poly_commitment::ipa::endos;
use rand::{rngs::StdRng, SeedableRng};

let foreign_field_modulus = Fq::modulus_biguint();
Expand Down Expand Up @@ -476,12 +476,14 @@ pub fn caml_pasta_fp_plonk_proof_example_with_range_check(
) {
use ark_ff::Zero;
use kimchi::circuits::{
constraints::ConstraintSystem, gate::CircuitGate, polynomials::range_check, wires::Wire,
constraints::ConstraintSystem, gate::CircuitGate,
polynomials::{range_check, foreign_field_common::BigUintForeignFieldHelpers},
wires::Wire,
};
use num_bigint::BigUint;
use num_bigint::RandBigInt;
use o1_utils::{foreign_field::BigUintForeignFieldHelpers, BigUintFieldHelpers};
use poly_commitment::srs::endos;
use o1_utils::{BigUintFieldHelpers};
use poly_commitment::ipa::endos;
use rand::{rngs::StdRng, SeedableRng};

let rng = &mut StdRng::from_seed([255u8; 32]);
Expand Down Expand Up @@ -548,7 +550,7 @@ pub fn caml_pasta_fp_plonk_proof_example_with_range_check0(
polynomials::{generic::GenericGateSpec, range_check},
wires::Wire,
};
use poly_commitment::srs::endos;
use poly_commitment::ipa::endos;

let gates = {
// Public input row with value 0
Expand Down Expand Up @@ -626,7 +628,7 @@ pub fn caml_pasta_fp_plonk_proof_example_with_ffadd(
wires::Wire,
};
use num_bigint::BigUint;
use poly_commitment::srs::endos;
use poly_commitment::ipa::endos;

// Includes a row to store value 1
let num_public_inputs = 1;
Expand Down Expand Up @@ -749,7 +751,7 @@ pub fn caml_pasta_fp_plonk_proof_example_with_xor(
polynomials::{generic::GenericGateSpec, xor},
wires::Wire,
};
use poly_commitment::srs::endos;
use poly_commitment::ipa::endos;

let num_public_inputs = 2;

Expand Down Expand Up @@ -842,7 +844,7 @@ pub fn caml_pasta_fp_plonk_proof_example_with_rot(
},
wires::Wire,
};
use poly_commitment::srs::endos;
use poly_commitment::ipa::endos;

// Includes the actual input of the rotation and a row with the zero value
let num_public_inputs = 2;
Expand Down Expand Up @@ -982,7 +984,7 @@ pub fn caml_pasta_fp_plonk_proof_dummy() -> CamlProofWithPublic<CamlGVesta, Caml
fn comm() -> PolyComm<Vesta> {
let g = Vesta::generator();
PolyComm {
elems: vec![g, g, g],
chunks: vec![g, g, g],
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ use kimchi::circuits::polynomials::permutation::{permutation_vanishing_polynomia
use kimchi::circuits::wires::{COLUMNS, PERMUTS};
use kimchi::{linearization::expr_linearization, verifier_index::VerifierIndex};
use mina_curves::pasta::{Fp, Pallas, Vesta};
use poly_commitment::commitment::caml::CamlPolyComm;
use poly_commitment::evaluation_proof::OpeningProof;
use poly_commitment::{commitment::PolyComm, srs::SRS};
use poly_commitment::{
commitment::{caml::CamlPolyComm, PolyComm},
ipa::{OpeningProof, SRS},
SRS as _,
};
use std::convert::TryInto;
use std::path::Path;
use std::sync::Arc;
Expand Down Expand Up @@ -71,7 +73,7 @@ impl From<CamlPastaFpPlonkVerifierIndex> for VerifierIndex<Vesta, OpeningProof<V
let evals = index.evals;
let shifts = index.shifts;

let (endo_q, _endo_r) = poly_commitment::srs::endos::<Pallas>();
let (endo_q, _endo_r) = poly_commitment::ipa::endos::<Pallas>();
let domain = Domain::<Fp>::new(1 << index.domain.log_size_of_group).expect("wrong size");

let coefficients_comm: Vec<PolyComm<Vesta>> =
Expand Down Expand Up @@ -171,7 +173,7 @@ pub fn read_raw(
path: String,
) -> Result<VerifierIndex<Vesta, OpeningProof<Vesta>>, ocaml::Error> {
let path = Path::new(&path);
let (endo_q, _endo_r) = poly_commitment::srs::endos::<Pallas>();
let (endo_q, _endo_r) = poly_commitment::ipa::endos::<Pallas>();
VerifierIndex::<Vesta, OpeningProof<Vesta>>::from_file(
srs.0,
path,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use kimchi::circuits::{constraints::ConstraintSystem, gate::CircuitGate};
use kimchi::{linearization::expr_linearization, prover_index::ProverIndex};
use mina_curves::pasta::{Fq, Pallas, PallasParameters, Vesta};
use mina_poseidon::{constants::PlonkSpongeConstantsKimchi, sponge::DefaultFqSponge};
use poly_commitment::evaluation_proof::OpeningProof;
use poly_commitment::{ipa::OpeningProof, SRS as _};
use serde::{Deserialize, Serialize};
use std::{
fs::{File, OpenOptions},
Expand Down Expand Up @@ -84,7 +84,7 @@ pub fn caml_pasta_fq_plonk_index_create(
};

// endo
let (endo_q, _endo_r) = poly_commitment::srs::endos::<Vesta>();
let (endo_q, _endo_r) = poly_commitment::ipa::endos::<Vesta>();

srs.0.with_lagrange_basis(cs.domain.d1);

Expand All @@ -99,7 +99,7 @@ pub fn caml_pasta_fq_plonk_index_create(
#[ocaml_gen::func]
#[ocaml::func]
pub fn caml_pasta_fq_plonk_index_max_degree(index: CamlPastaFqPlonkIndexPtr) -> ocaml::Int {
index.as_ref().0.srs.max_degree() as isize
index.as_ref().0.srs.max_poly_size() as isize
}

#[ocaml_gen::func]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use mina_poseidon::{
sponge::{DefaultFqSponge, DefaultFrSponge},
};
use poly_commitment::commitment::{CommitmentCurve, PolyComm};
use poly_commitment::evaluation_proof::OpeningProof;
use poly_commitment::ipa::OpeningProof;
use std::array;
use std::convert::TryInto;

Expand Down Expand Up @@ -60,7 +60,7 @@ pub fn caml_pasta_fq_plonk_proof_create(
.iter()
.map(Into::<Fq>::into)
.collect();
let comm = PolyComm::<Pallas> { elems: vec![sg] };
let comm = PolyComm::<Pallas> { chunks: vec![sg] };
RecursionChallenge { chals, comm }
})
.collect()
Expand Down Expand Up @@ -175,7 +175,7 @@ pub fn caml_pasta_fq_plonk_proof_dummy() -> CamlProofWithPublic<CamlGPallas, Cam
fn comm() -> PolyComm<Pallas> {
let g = Pallas::generator();
PolyComm {
elems: vec![g, g, g],
chunks: vec![g, g, g],
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ use kimchi::circuits::polynomials::permutation::{permutation_vanishing_polynomia
use kimchi::circuits::wires::{COLUMNS, PERMUTS};
use kimchi::{linearization::expr_linearization, verifier_index::VerifierIndex};
use mina_curves::pasta::{Fq, Pallas, Vesta};
use poly_commitment::{commitment::caml::CamlPolyComm, evaluation_proof::OpeningProof};
use poly_commitment::{commitment::PolyComm, srs::SRS};
use poly_commitment::{
commitment::{caml::CamlPolyComm, PolyComm},
ipa::{OpeningProof, SRS},
SRS as _,
};
use std::convert::TryInto;
use std::path::Path;
use std::sync::Arc;
Expand Down Expand Up @@ -70,7 +73,7 @@ impl From<CamlPastaFqPlonkVerifierIndex> for VerifierIndex<Pallas, OpeningProof<
let evals = index.evals;
let shifts = index.shifts;

let (endo_q, _endo_r) = poly_commitment::srs::endos::<Vesta>();
let (endo_q, _endo_r) = poly_commitment::ipa::endos::<Vesta>();
let domain = Domain::<Fq>::new(1 << index.domain.log_size_of_group).expect("wrong size");

let coefficients_comm: Vec<PolyComm<Pallas>> =
Expand Down Expand Up @@ -170,7 +173,7 @@ pub fn read_raw(
path: String,
) -> Result<VerifierIndex<Pallas, OpeningProof<Pallas>>, ocaml::Error> {
let path = Path::new(&path);
let (endo_q, _endo_r) = poly_commitment::srs::endos::<Vesta>();
let (endo_q, _endo_r) = poly_commitment::ipa::endos::<Vesta>();
VerifierIndex::<Pallas, OpeningProof<Pallas>>::from_file(
srs.0,
path,
Expand Down
4 changes: 2 additions & 2 deletions src/lib/crypto/kimchi_bindings/stubs/src/projective.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ macro_rules! impl_projective {
#[ocaml_gen::func]
#[ocaml::func]
pub extern "C" fn [<caml_ $name:snake _endo_base>]() -> $CamlBaseField {
let (endo_q, _endo_r) = poly_commitment::srs::endos::<GAffine>();
let (endo_q, _endo_r) = poly_commitment::ipa::endos::<GAffine>();
endo_q.into()
}

#[ocaml_gen::func]
#[ocaml::func]
pub extern "C" fn [<caml_ $name:snake _endo_scalar>]() -> $CamlScalarField {
let (_endo_q, endo_r) = poly_commitment::srs::endos::<GAffine>();
let (_endo_q, endo_r) = poly_commitment::ipa::endos::<GAffine>();
endo_r.into()
}

Expand Down
Loading