mirror of
https://github.com/arnaucube/hyperplonk.git
synced 2026-01-12 17:01:28 +01:00
PCS crate moved to other repository.
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
use arithmetic::ArithErrors;
|
||||
use ark_std::string::String;
|
||||
use displaydoc::Display;
|
||||
use pcs::prelude::PCSErrors;
|
||||
use jf_primitives::pcs::errors::PCSError;
|
||||
use transcript::TranscriptErrors;
|
||||
|
||||
/// A `enum` specifying the possible failure modes of the PolyIOP.
|
||||
@@ -28,7 +28,7 @@ pub enum PolyIOPErrors {
|
||||
/// Arithmetic Error: {0}
|
||||
ArithmeticErrors(ArithErrors),
|
||||
/// PCS error {0}
|
||||
PCSErrors(PCSErrors),
|
||||
PCSError(PCSError),
|
||||
}
|
||||
|
||||
impl From<ark_serialize::SerializationError> for PolyIOPErrors {
|
||||
@@ -49,8 +49,8 @@ impl From<ArithErrors> for PolyIOPErrors {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<PCSErrors> for PolyIOPErrors {
|
||||
fn from(e: PCSErrors) -> Self {
|
||||
Self::PCSErrors(e)
|
||||
impl From<PCSError> for PolyIOPErrors {
|
||||
fn from(e: PCSError) -> Self {
|
||||
Self::PCSError(e)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ use crate::{errors::PolyIOPErrors, prelude::ProductCheck, PolyIOP};
|
||||
use ark_ec::PairingEngine;
|
||||
use ark_poly::DenseMultilinearExtension;
|
||||
use ark_std::{end_timer, start_timer};
|
||||
use pcs::PolynomialCommitmentScheme;
|
||||
use jf_primitives::pcs::PolynomialCommitmentScheme;
|
||||
use std::rc::Rc;
|
||||
use transcript::IOPTranscript;
|
||||
|
||||
@@ -163,10 +163,10 @@ mod test {
|
||||
use ark_ec::PairingEngine;
|
||||
use ark_poly::{DenseMultilinearExtension, MultilinearExtension};
|
||||
use ark_std::test_rng;
|
||||
use pcs::{prelude::KZGMultilinearPCS, PolynomialCommitmentScheme};
|
||||
use jf_primitives::pcs::{prelude::MultilinearKzgPCS, PolynomialCommitmentScheme};
|
||||
use std::{marker::PhantomData, rc::Rc};
|
||||
|
||||
type KZG = KZGMultilinearPCS<Bls12_381>;
|
||||
type Kzg = MultilinearKzgPCS<Bls12_381>;
|
||||
|
||||
fn test_permutation_check_helper<E, PCS>(
|
||||
pcs_param: &PCS::ProverParam,
|
||||
@@ -220,15 +220,15 @@ mod test {
|
||||
fn test_permutation_check(nv: usize) -> Result<(), PolyIOPErrors> {
|
||||
let mut rng = test_rng();
|
||||
|
||||
let srs = KZGMultilinearPCS::<Bls12_381>::gen_srs_for_testing(&mut rng, nv + 1)?;
|
||||
let (pcs_param, _) = KZGMultilinearPCS::<Bls12_381>::trim(&srs, nv + 1, Some(nv + 1))?;
|
||||
let srs = MultilinearKzgPCS::<Bls12_381>::gen_srs_for_testing(&mut rng, nv + 1)?;
|
||||
let (pcs_param, _) = MultilinearKzgPCS::<Bls12_381>::trim(&srs, nv + 1, Some(nv + 1))?;
|
||||
|
||||
{
|
||||
// good path: w is a permutation of w itself under the identify map
|
||||
let w = Rc::new(DenseMultilinearExtension::rand(nv, &mut rng));
|
||||
// s_perm is the identity map
|
||||
let s_perm = identity_permutation_mle(nv);
|
||||
test_permutation_check_helper::<Bls12_381, KZG>(&pcs_param, &w, &w, &s_perm)?;
|
||||
test_permutation_check_helper::<Bls12_381, Kzg>(&pcs_param, &w, &w, &s_perm)?;
|
||||
}
|
||||
|
||||
{
|
||||
@@ -238,9 +238,9 @@ mod test {
|
||||
let s_perm = random_permutation_mle(nv, &mut rng);
|
||||
|
||||
if nv == 1 {
|
||||
test_permutation_check_helper::<Bls12_381, KZG>(&pcs_param, &w, &w, &s_perm)?;
|
||||
test_permutation_check_helper::<Bls12_381, Kzg>(&pcs_param, &w, &w, &s_perm)?;
|
||||
} else {
|
||||
assert!(test_permutation_check_helper::<Bls12_381, KZG>(
|
||||
assert!(test_permutation_check_helper::<Bls12_381, Kzg>(
|
||||
&pcs_param, &w, &w, &s_perm
|
||||
)
|
||||
.is_err());
|
||||
@@ -255,7 +255,7 @@ mod test {
|
||||
let s_perm = identity_permutation_mle(nv);
|
||||
|
||||
assert!(
|
||||
test_permutation_check_helper::<Bls12_381, KZG>(&pcs_param, &f, &g, &s_perm)
|
||||
test_permutation_check_helper::<Bls12_381, Kzg>(&pcs_param, &f, &g, &s_perm)
|
||||
.is_err()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ use ark_ec::PairingEngine;
|
||||
use ark_ff::{One, PrimeField, Zero};
|
||||
use ark_poly::DenseMultilinearExtension;
|
||||
use ark_std::{end_timer, start_timer};
|
||||
use pcs::prelude::PolynomialCommitmentScheme;
|
||||
use jf_primitives::pcs::prelude::PolynomialCommitmentScheme;
|
||||
use std::rc::Rc;
|
||||
use transcript::IOPTranscript;
|
||||
|
||||
@@ -207,7 +207,7 @@ mod test {
|
||||
use ark_ec::PairingEngine;
|
||||
use ark_poly::{DenseMultilinearExtension, MultilinearExtension};
|
||||
use ark_std::test_rng;
|
||||
use pcs::{prelude::KZGMultilinearPCS, PolynomialCommitmentScheme};
|
||||
use jf_primitives::pcs::{prelude::MultilinearKzgPCS, PolynomialCommitmentScheme};
|
||||
use std::{marker::PhantomData, rc::Rc};
|
||||
|
||||
// f and g are guaranteed to have the same product
|
||||
@@ -254,7 +254,7 @@ mod test {
|
||||
let (bad_proof, prod_x_bad) = <PolyIOP<E::Fr> as ProductCheck<E, PCS>>::prove(
|
||||
pcs_param,
|
||||
&Rc::new(f.clone()),
|
||||
&Rc::new(h.clone()),
|
||||
&Rc::new(h),
|
||||
&mut transcript,
|
||||
)?;
|
||||
|
||||
@@ -281,10 +281,10 @@ mod test {
|
||||
let mut g = f.clone();
|
||||
g.evaluations.reverse();
|
||||
|
||||
let srs = KZGMultilinearPCS::<Bls12_381>::gen_srs_for_testing(&mut rng, nv + 1)?;
|
||||
let (pcs_param, _) = KZGMultilinearPCS::<Bls12_381>::trim(&srs, nv + 1, Some(nv + 1))?;
|
||||
let srs = MultilinearKzgPCS::<Bls12_381>::gen_srs_for_testing(&mut rng, nv + 1)?;
|
||||
let (pcs_param, _) = MultilinearKzgPCS::<Bls12_381>::trim(&srs, nv + 1, Some(nv + 1))?;
|
||||
|
||||
test_product_check_helper::<Bls12_381, KZGMultilinearPCS<Bls12_381>>(&f, &g, &pcs_param)?;
|
||||
test_product_check_helper::<Bls12_381, MultilinearKzgPCS<Bls12_381>>(&f, &g, &pcs_param)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user