mirror of
https://github.com/arnaucube/sonobe.git
synced 2026-02-02 17:26:44 +01:00
Unify the computation of digests and challenges in different folding schemes (#94)
* Remove the trait bound `C::BaseField: PrimeField` for better DX
* Methods in `TranscriptVar` now exactly matches the ones in `Transcript`
* Add `ProtoGalaxyTranscriptVar` and `CommittedInstanceVar` for protogalaxy
* betas are unnecessary in "plain" (incoming) instances
* Absorb the result of `get_challenge_nbits` as well
* `ProtoGalaxyTranscript` now allows absorbing mulitple instances
* Always return `Result<(), SynthesisError>` in `ProtoGalaxyTranscriptVar`
* Impl `Transcript{Var}` for `PoseidonSponge{Var}` directly and remove `PoseidonTranscript{Var}`
* `Transcript::absorb_point` doesn't need to return `Error`
* Add `AbsorbNonNative` trait for hashing non-native values
Note that now `absorb_point` only supports hashing points whose BaseField is equal to the sponge's field
* More efficient `TranscriptVar::absorb_point` by securely removing `is_inf`
* Use `sponge` and `transcript` consistently
* Clarify the usage of `AbsorbNonNative{Gadget}`
* Generic `sponge` and `transcript` params
* Avoid unstable `associated_type_bounds`
* Reuse `sponge` in hypernova
* Clean up redundant imports
* Remove unstable code
* Clarify the usage of `absorb_point` and `absorb_nonnative`
This commit is contained in:
@@ -34,7 +34,7 @@ pub trait CommitmentScheme<C: CurveGroup, const H: bool = false>: Clone + Debug
|
||||
|
||||
fn prove(
|
||||
params: &Self::ProverParams,
|
||||
transcript: &mut impl Transcript<C>,
|
||||
transcript: &mut impl Transcript<C::ScalarField>,
|
||||
cm: &C,
|
||||
v: &[C::ScalarField],
|
||||
blind: &C::ScalarField,
|
||||
@@ -53,7 +53,7 @@ pub trait CommitmentScheme<C: CurveGroup, const H: bool = false>: Clone + Debug
|
||||
|
||||
fn verify(
|
||||
params: &Self::VerifierParams,
|
||||
transcript: &mut impl Transcript<C>,
|
||||
transcript: &mut impl Transcript<C::ScalarField>,
|
||||
cm: &C,
|
||||
proof: &Self::Proof,
|
||||
) -> Result<(), Error>;
|
||||
@@ -72,7 +72,10 @@ pub trait CommitmentScheme<C: CurveGroup, const H: bool = false>: Clone + Debug
|
||||
mod tests {
|
||||
use super::*;
|
||||
use ark_bn254::{Bn254, Fr, G1Projective as G1};
|
||||
use ark_crypto_primitives::sponge::{poseidon::PoseidonConfig, Absorb};
|
||||
use ark_crypto_primitives::sponge::{
|
||||
poseidon::{PoseidonConfig, PoseidonSponge},
|
||||
Absorb, CryptographicSponge,
|
||||
};
|
||||
use ark_poly_commit::kzg10::VerifierKey;
|
||||
use ark_std::Zero;
|
||||
use ark_std::{test_rng, UniformRand};
|
||||
@@ -80,10 +83,7 @@ mod tests {
|
||||
use super::ipa::IPA;
|
||||
use super::kzg::{ProverKey, KZG};
|
||||
use super::pedersen::Pedersen;
|
||||
use crate::transcript::{
|
||||
poseidon::{poseidon_canonical_config, PoseidonTranscript},
|
||||
Transcript,
|
||||
};
|
||||
use crate::transcript::poseidon::poseidon_canonical_config;
|
||||
|
||||
#[test]
|
||||
fn test_homomorphic_property_using_Commitment_trait() {
|
||||
@@ -153,7 +153,7 @@ mod tests {
|
||||
let v_3: Vec<C::ScalarField> = v_1.iter().zip(v_2).map(|(a, b)| *a + (r * b)).collect();
|
||||
|
||||
// compute the proof of the cm_3
|
||||
let transcript_p = &mut PoseidonTranscript::<C>::new(poseidon_config);
|
||||
let transcript_p = &mut PoseidonSponge::<C::ScalarField>::new(poseidon_config);
|
||||
let proof = CS::prove(
|
||||
prover_params,
|
||||
transcript_p,
|
||||
@@ -165,7 +165,7 @@ mod tests {
|
||||
.unwrap();
|
||||
|
||||
// verify the opening proof
|
||||
let transcript_v = &mut PoseidonTranscript::<C>::new(poseidon_config);
|
||||
let transcript_v = &mut PoseidonSponge::<C::ScalarField>::new(poseidon_config);
|
||||
CS::verify(verifier_params, transcript_v, &cm_3, &proof).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user