Skip to content
Snippets Groups Projects

add aPlonK

Merged STEVAN Antoine requested to merge aplonk into main
3 files
+ 12
13
Compare changes
  • Side-by-side
  • Inline
Files
3
+ 10
12
@@ -6,7 +6,7 @@ use ark_ec::{
pairing::{Pairing, PairingOutput},
AffineRepr,
};
use ark_ff::{BigInteger, Field, PrimeField};
use ark_ff::{Field, PrimeField};
use ark_poly::DenseUVPolynomial;
use ark_poly_commit::{
kzg10::{self, Proof, Randomness, UniversalParams, KZG10},
@@ -19,7 +19,7 @@ use rs_merkle::Hasher;
use std::marker::PhantomData;
use std::ops::{Div, Mul};
use crate::{algebra, conversions::u32_to_u8_vec, error::KomodoError, fec::Shard, kzg, zk::trim};
use crate::{algebra, error::KomodoError, fec::Shard, kzg, zk::trim};
mod ipa;
mod polynomial;
@@ -98,7 +98,7 @@ where
})
}
fn commit<E, P>(
pub fn commit<E, P>(
polynomials: Vec<P>,
setup: SetupParams<E>,
) -> Result<(Vec<E::G1>, PairingOutput<E>), KomodoError>
@@ -136,7 +136,7 @@ where
Ok((mu, com_f))
}
fn prove<E, P>(
pub fn prove<E, P>(
commit: (Vec<E::G1>, PairingOutput<E>),
polynomials: Vec<P>,
shards: Vec<Shard<E::ScalarField>>,
@@ -166,7 +166,7 @@ where
for (s, pt) in shards.iter().zip(points.iter()) {
let v_hat_elements = polynomials
.iter()
.map(|p| p.evaluate(&pt))
.map(|p| p.evaluate(pt))
.collect::<Vec<E::ScalarField>>();
// open.3.1.
@@ -263,7 +263,7 @@ where
Ok(proofs)
}
fn verify<E, P>(
pub fn verify<E, P>(
block: &Block<E>,
pt: E::ScalarField,
vk_psi: &kzg10::VerifierKey<E>,
@@ -379,11 +379,10 @@ where
#[cfg(test)]
mod tests {
use super::{commit, prove, setup, Block, Commitment, VerifierKey};
use super::{commit, prove, setup, Block};
use crate::{
algebra,
conversions::u32_to_u8_vec,
fec::{decode, encode, Shard},
fec::{decode, encode},
field,
linalg::Matrix,
zk::trim,
@@ -391,10 +390,9 @@ mod tests {
use ark_bls12_381::Bls12_381;
use ark_ec::{pairing::Pairing, AffineRepr};
use ark_ff::{BigInteger, Field, PrimeField};
use ark_ff::{Field, PrimeField};
use ark_poly::{univariate::DensePolynomial, DenseUVPolynomial};
use ark_poly_commit::kzg10;
use rs_merkle::{algorithms::Sha256, Hasher};
use std::ops::{Div, MulAssign};
type UniPoly381 = DensePolynomial<<Bls12_381 as Pairing>::ScalarField>;
@@ -474,7 +472,7 @@ mod tests {
for (i, block) in blocks.iter().enumerate() {
assert!(super::verify::<E, P>(
&block,
block,
E::ScalarField::from_le_bytes_mod_order(&u32_to_u8_vec(i as u32)),
&vk_psi,
tau_1,
Loading