Skip to content
Snippets Groups Projects

add aPlonK

Merged STEVAN Antoine requested to merge aplonk into main
2 files
+ 11
11
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 8
8
@@ -19,7 +19,7 @@ use crate::error::KomodoError;
///
/// [aPlonk]: https://eprint.iacr.org/2022/1352.pdf
#[derive(Debug, Clone, PartialEq)]
pub struct IPAParams<E: Pairing> {
pub struct Params<E: Pairing> {
/// *[\tau]_1* in the paper
pub tau_1: E::G1,
/// *ck_\tau* in the paper
@@ -38,7 +38,7 @@ pub struct IPAParams<E: Pairing> {
///
/// [aPlonk]: https://eprint.iacr.org/2022/1352.pdf
#[derive(Debug, Clone, Default, PartialEq, CanonicalSerialize, CanonicalDeserialize)]
pub(super) struct IpaProof<E: Pairing> {
pub(super) struct Proof<E: Pairing> {
pub l_g: Vec<PairingOutput<E>>,
pub r_g: Vec<PairingOutput<E>>,
pub l_r: Vec<E::G1>,
@@ -84,7 +84,7 @@ pub(super) fn prove<E: Pairing>(
r: E::ScalarField,
p: E::G1,
mu: &[E::G1],
) -> Result<(IpaProof<E>, Vec<E::ScalarField>), KomodoError> {
) -> Result<(Proof<E>, Vec<E::ScalarField>), KomodoError> {
if !is_power_of_two(k) {
return Err(KomodoError::Other(
"PolynomialCountIpaError: not a power of 2".to_string(),
@@ -158,7 +158,7 @@ pub(super) fn prove<E: Pairing>(
// 10.
Ok((
IpaProof {
Proof {
l_g,
r_g,
l_r,
@@ -202,7 +202,7 @@ pub(super) fn verify<E, P>(
c_g: PairingOutput<E>,
r: E::ScalarField,
p: E::G1,
proof: &IpaProof<E>,
proof: &Proof<E>,
) -> Result<bool, KomodoError>
where
E: Pairing,
@@ -309,7 +309,7 @@ mod tests {
use ark_std::{test_rng, UniformRand};
use std::ops::Div;
use super::{is_power_of_two, IpaProof};
use super::{is_power_of_two, Proof};
use crate::algebra::{powers_of, scalar_product_g1, scalar_product_pairing};
use crate::aplonk::setup;
@@ -343,7 +343,7 @@ mod tests {
PairingOutput<E>,
E::ScalarField,
E::G1,
IpaProof<E>,
Proof<E>,
),
Error,
>
@@ -399,7 +399,7 @@ mod tests {
.serialize_with_mode(&mut bytes, Compress::Yes)
.expect("Could not serialize the proof");
bytes[10] += 1;
let proof = IpaProof::deserialize_with_mode(&*bytes, Compress::Yes, Validate::No)
let proof = Proof::deserialize_with_mode(&*bytes, Compress::Yes, Validate::No)
.expect("Could not deserialize the corrupted proof");
assert!(
!super::verify::<E, P>(k, Some(&ck_tau), c_g, r, p, &proof).unwrap(),
Loading