mirror of
https://github.com/arnaucube/sonobe.git
synced 2026-01-12 00:41:28 +01:00
BN254 and Grumpkin Poseidon configurations (#106)
* Add BN254 and Grumpkin Poseidon configurations * Remove unncecessary comment * Fix BN254 Poseidon config test * Correction * Update folding-schemes/src/transcript/poseidon/grumpkin.rs Co-authored-by: Pierre <pdaixmoreux@gmail.com> --------- Co-authored-by: Pierre <pdaixmoreux@gmail.com>
This commit is contained in:
@@ -173,7 +173,7 @@ mod tests {
|
||||
use crate::{
|
||||
folding::circuits::sum_check::{IOPProofVar, VPAuxInfoVar},
|
||||
transcript::{
|
||||
poseidon::{poseidon_test_config, PoseidonTranscript, PoseidonTranscriptVar},
|
||||
poseidon::{poseidon_canonical_config, PoseidonTranscript, PoseidonTranscriptVar},
|
||||
Transcript, TranscriptVar,
|
||||
},
|
||||
utils::{
|
||||
@@ -207,7 +207,7 @@ mod tests {
|
||||
{
|
||||
let mut rng = ark_std::test_rng();
|
||||
let poseidon_config: PoseidonConfig<C::ScalarField> =
|
||||
poseidon_test_config::<C::ScalarField>();
|
||||
poseidon_canonical_config::<C::ScalarField>();
|
||||
let mut poseidon_transcript_prove = PoseidonTranscript::<C>::new(&poseidon_config);
|
||||
let poly_mle = DenseMultilinearExtension::rand(num_vars, &mut rng);
|
||||
let virtual_poly =
|
||||
|
||||
@@ -374,7 +374,7 @@ where
|
||||
pub mod tests {
|
||||
use super::*;
|
||||
use crate::ccs::tests::{get_test_ccs, get_test_z};
|
||||
use crate::transcript::poseidon::poseidon_test_config;
|
||||
use crate::transcript::poseidon::poseidon_canonical_config;
|
||||
use crate::transcript::poseidon::PoseidonTranscript;
|
||||
use ark_std::test_rng;
|
||||
use ark_std::UniformRand;
|
||||
@@ -446,7 +446,7 @@ pub mod tests {
|
||||
let (new_instance, w2) = ccs.to_cccs(&mut rng, &pedersen_params, &z_2).unwrap();
|
||||
|
||||
// Prover's transcript
|
||||
let poseidon_config = poseidon_test_config::<Fr>();
|
||||
let poseidon_config = poseidon_canonical_config::<Fr>();
|
||||
let mut transcript_p: PoseidonTranscript<Projective> =
|
||||
PoseidonTranscript::<Projective>::new(&poseidon_config);
|
||||
transcript_p.absorb(&Fr::from_le_bytes_mod_order(b"init init"));
|
||||
@@ -500,7 +500,7 @@ pub mod tests {
|
||||
let (mut running_instance, mut w1) =
|
||||
ccs.to_lcccs(&mut rng, &pedersen_params, &z_1).unwrap();
|
||||
|
||||
let poseidon_config = poseidon_test_config::<Fr>();
|
||||
let poseidon_config = poseidon_canonical_config::<Fr>();
|
||||
|
||||
let mut transcript_p: PoseidonTranscript<Projective> =
|
||||
PoseidonTranscript::<Projective>::new(&poseidon_config);
|
||||
@@ -597,7 +597,7 @@ pub mod tests {
|
||||
}
|
||||
|
||||
// Prover's transcript
|
||||
let poseidon_config = poseidon_test_config::<Fr>();
|
||||
let poseidon_config = poseidon_canonical_config::<Fr>();
|
||||
let mut transcript_p: PoseidonTranscript<Projective> =
|
||||
PoseidonTranscript::<Projective>::new(&poseidon_config);
|
||||
transcript_p.absorb(&Fr::from_le_bytes_mod_order(b"init init"));
|
||||
@@ -647,7 +647,7 @@ pub mod tests {
|
||||
let (pedersen_params, _) =
|
||||
Pedersen::<Projective>::setup(&mut rng, ccs.n - ccs.l - 1).unwrap();
|
||||
|
||||
let poseidon_config = poseidon_test_config::<Fr>();
|
||||
let poseidon_config = poseidon_canonical_config::<Fr>();
|
||||
// Prover's transcript
|
||||
let mut transcript_p: PoseidonTranscript<Projective> =
|
||||
PoseidonTranscript::<Projective>::new(&poseidon_config);
|
||||
|
||||
@@ -559,7 +559,7 @@ pub mod tests {
|
||||
use crate::commitment::pedersen::Pedersen;
|
||||
use crate::folding::nova::nifs::tests::prepare_simple_fold_inputs;
|
||||
use crate::folding::nova::nifs::NIFS;
|
||||
use crate::transcript::poseidon::poseidon_test_config;
|
||||
use crate::transcript::poseidon::poseidon_canonical_config;
|
||||
|
||||
#[test]
|
||||
fn test_committed_instance_var() {
|
||||
@@ -615,7 +615,7 @@ pub mod tests {
|
||||
#[test]
|
||||
fn test_committed_instance_hash() {
|
||||
let mut rng = ark_std::test_rng();
|
||||
let poseidon_config = poseidon_test_config::<Fr>();
|
||||
let poseidon_config = poseidon_canonical_config::<Fr>();
|
||||
|
||||
let i = Fr::from(3_u32);
|
||||
let z_0 = vec![Fr::from(3_u32)];
|
||||
@@ -654,7 +654,7 @@ pub mod tests {
|
||||
#[test]
|
||||
fn test_challenge_gadget() {
|
||||
let mut rng = ark_std::test_rng();
|
||||
let poseidon_config = poseidon_test_config::<Fr>();
|
||||
let poseidon_config = poseidon_canonical_config::<Fr>();
|
||||
|
||||
let u_i = CommittedInstance::<Projective> {
|
||||
cmE: Projective::rand(&mut rng),
|
||||
|
||||
@@ -377,7 +377,7 @@ pub mod tests {
|
||||
|
||||
use crate::folding::nova::get_cm_coordinates;
|
||||
use crate::folding::nova::nifs::tests::prepare_simple_fold_inputs;
|
||||
use crate::transcript::poseidon::poseidon_test_config;
|
||||
use crate::transcript::poseidon::poseidon_canonical_config;
|
||||
|
||||
#[test]
|
||||
fn test_committed_instance_cyclefold_var() {
|
||||
@@ -488,7 +488,7 @@ pub mod tests {
|
||||
#[test]
|
||||
fn test_cyclefold_challenge_gadget() {
|
||||
let mut rng = ark_std::test_rng();
|
||||
let poseidon_config = poseidon_test_config::<Fq>();
|
||||
let poseidon_config = poseidon_canonical_config::<Fq>();
|
||||
|
||||
let u_i = CommittedInstance::<Projective> {
|
||||
cmE: Projective::zero(), // zero on purpose, so we test also the zero point case
|
||||
@@ -550,7 +550,7 @@ pub mod tests {
|
||||
#[test]
|
||||
fn test_cyclefold_hash_gadget() {
|
||||
let mut rng = ark_std::test_rng();
|
||||
let poseidon_config = poseidon_test_config::<Fq>();
|
||||
let poseidon_config = poseidon_canonical_config::<Fq>();
|
||||
|
||||
let U_i = CommittedInstance::<Projective> {
|
||||
cmE: Projective::rand(&mut rng),
|
||||
|
||||
@@ -292,7 +292,7 @@ pub mod tests {
|
||||
use crate::commitment::pedersen::Pedersen;
|
||||
use crate::folding::nova::{get_cs_params_len, ProverParams};
|
||||
use crate::frontend::tests::CubicFCircuit;
|
||||
use crate::transcript::poseidon::poseidon_test_config;
|
||||
use crate::transcript::poseidon::poseidon_canonical_config;
|
||||
|
||||
#[test]
|
||||
fn test_decider() {
|
||||
@@ -319,7 +319,7 @@ pub mod tests {
|
||||
>;
|
||||
|
||||
let mut rng = ark_std::test_rng();
|
||||
let poseidon_config = poseidon_test_config::<Fr>();
|
||||
let poseidon_config = poseidon_canonical_config::<Fr>();
|
||||
|
||||
let F_circuit = CubicFCircuit::<Fr>::new(()).unwrap();
|
||||
let z_0 = vec![Fr::from(3_u32)];
|
||||
|
||||
@@ -614,7 +614,7 @@ pub mod tests {
|
||||
use crate::commitment::pedersen::Pedersen;
|
||||
use crate::folding::nova::{get_cs_params_len, ProverParams, VerifierParams};
|
||||
use crate::frontend::tests::{CubicFCircuit, CustomFCircuit, WrapperCircuit};
|
||||
use crate::transcript::poseidon::poseidon_test_config;
|
||||
use crate::transcript::poseidon::poseidon_canonical_config;
|
||||
use crate::FoldingScheme;
|
||||
|
||||
use crate::ccs::r1cs::tests::{get_test_r1cs, get_test_z};
|
||||
@@ -768,7 +768,7 @@ pub mod tests {
|
||||
#[test]
|
||||
fn test_decider_circuit() {
|
||||
let mut rng = ark_std::test_rng();
|
||||
let poseidon_config = poseidon_test_config::<Fr>();
|
||||
let poseidon_config = poseidon_canonical_config::<Fr>();
|
||||
|
||||
let F_circuit = CubicFCircuit::<Fr>::new(()).unwrap();
|
||||
let z_0 = vec![Fr::from(3_u32)];
|
||||
@@ -843,7 +843,7 @@ pub mod tests {
|
||||
#[test]
|
||||
fn test_kzg_challenge_gadget() {
|
||||
let mut rng = ark_std::test_rng();
|
||||
let poseidon_config = poseidon_test_config::<Fr>();
|
||||
let poseidon_config = poseidon_canonical_config::<Fr>();
|
||||
|
||||
let U_i = CommittedInstance::<Projective> {
|
||||
cmE: Projective::rand(&mut rng),
|
||||
|
||||
@@ -815,14 +815,14 @@ pub mod tests {
|
||||
|
||||
use crate::commitment::pedersen::Pedersen;
|
||||
use crate::frontend::tests::CubicFCircuit;
|
||||
use crate::transcript::poseidon::poseidon_test_config;
|
||||
use crate::transcript::poseidon::poseidon_canonical_config;
|
||||
|
||||
/// This test tests the Nova+CycleFold IVC, and by consequence it is also testing the
|
||||
/// AugmentedFCircuit
|
||||
#[test]
|
||||
fn test_ivc() {
|
||||
let mut rng = ark_std::test_rng();
|
||||
let poseidon_config = poseidon_test_config::<Fr>();
|
||||
let poseidon_config = poseidon_canonical_config::<Fr>();
|
||||
|
||||
let F_circuit = CubicFCircuit::<Fr>::new(()).unwrap();
|
||||
|
||||
|
||||
@@ -209,7 +209,7 @@ pub mod tests {
|
||||
use crate::commitment::pedersen::{Params as PedersenParams, Pedersen};
|
||||
use crate::folding::nova::circuits::ChallengeGadget;
|
||||
use crate::folding::nova::traits::NovaR1CS;
|
||||
use crate::transcript::poseidon::{poseidon_test_config, PoseidonTranscript};
|
||||
use crate::transcript::poseidon::{poseidon_canonical_config, PoseidonTranscript};
|
||||
|
||||
#[allow(clippy::type_complexity)]
|
||||
pub(crate) fn prepare_simple_fold_inputs<C>() -> (
|
||||
@@ -257,7 +257,7 @@ pub mod tests {
|
||||
NIFS::<C, Pedersen<C>>::compute_cmT(&pedersen_params, &r1cs, &w1, &ci1, &w2, &ci2)
|
||||
.unwrap();
|
||||
|
||||
let poseidon_config = poseidon_test_config::<C::ScalarField>();
|
||||
let poseidon_config = poseidon_canonical_config::<C::ScalarField>();
|
||||
|
||||
let r_bits = ChallengeGadget::<C>::get_challenge_native(
|
||||
&poseidon_config,
|
||||
|
||||
@@ -385,7 +385,7 @@ mod tests {
|
||||
|
||||
use crate::ccs::r1cs::tests::{get_test_r1cs, get_test_z};
|
||||
use crate::commitment::{pedersen::Pedersen, CommitmentScheme};
|
||||
use crate::transcript::poseidon::{poseidon_test_config, PoseidonTranscript};
|
||||
use crate::transcript::poseidon::{poseidon_canonical_config, PoseidonTranscript};
|
||||
|
||||
pub(crate) fn check_instance<C: CurveGroup>(
|
||||
r1cs: &R1CS<C::ScalarField>,
|
||||
@@ -512,7 +512,7 @@ mod tests {
|
||||
let r1cs = get_test_r1cs::<Fr>();
|
||||
|
||||
// init Prover & Verifier's transcript
|
||||
let poseidon_config = poseidon_test_config::<Fr>();
|
||||
let poseidon_config = poseidon_canonical_config::<Fr>();
|
||||
let mut transcript_p = PoseidonTranscript::<Projective>::new(&poseidon_config);
|
||||
let mut transcript_v = PoseidonTranscript::<Projective>::new(&poseidon_config);
|
||||
|
||||
@@ -552,7 +552,7 @@ mod tests {
|
||||
let r1cs = get_test_r1cs::<Fr>();
|
||||
|
||||
// init Prover & Verifier's transcript
|
||||
let poseidon_config = poseidon_test_config::<Fr>();
|
||||
let poseidon_config = poseidon_canonical_config::<Fr>();
|
||||
let mut transcript_p = PoseidonTranscript::<Projective>::new(&poseidon_config);
|
||||
let mut transcript_v = PoseidonTranscript::<Projective>::new(&poseidon_config);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user