Optimize verifier eq (#102)

* wip we need to be able to do batch opening for different poly sizes or pad poly with zeros

* fix small public inputs. Only works for pow2 pubinput

Co-authored-by: Charles Chen <chancharles92@gmail.com>
This commit is contained in:
Benedikt Bünz
2022-11-20 09:26:35 -08:00
committed by GitHub
parent cf49741b7e
commit 768db4eb04
8 changed files with 56 additions and 22 deletions

View File

@@ -178,6 +178,8 @@ impl<F: PrimeField> SumCheckVerifier<F> for IOPVerifierState<F> {
/// This implementation is linear in number of inputs in terms of field
/// operations. It also has a quadratic term in primitive operations which is
/// negligible compared to field operations.
/// TODO: The quadratic term can be removed by precomputing the lagrange
/// coefficients.
fn interpolate_uni_poly<F: PrimeField>(p_i: &[F], eval_at: F) -> Result<F, PolyIOPErrors> {
let start = start_timer!(|| "sum check interpolate uni poly opt");

View File

@@ -3,9 +3,8 @@
use std::fmt::Debug;
use crate::poly_iop::{errors::PolyIOPErrors, sum_check::SumCheck, PolyIOP};
use arithmetic::build_eq_x_r;
use arithmetic::eq_eval;
use ark_ff::PrimeField;
use ark_poly::MultilinearExtension;
use ark_std::{end_timer, start_timer};
use transcript::IOPTranscript;
@@ -103,11 +102,8 @@ impl<F: PrimeField> ZeroCheck<F> for PolyIOP<F> {
// expected_eval = sumcheck.expect_eval/eq(v, r)
// where v = sum_check_sub_claim.point
let eq_x_r = build_eq_x_r(&r)?;
let expected_evaluation = sum_subclaim.expected_evaluation
/ eq_x_r.evaluate(&sum_subclaim.point).ok_or_else(|| {
PolyIOPErrors::InvalidParameters("evaluation dimension does not match".to_string())
})?;
let eq_x_r_eval = eq_eval(&sum_subclaim.point, &r)?;
let expected_evaluation = sum_subclaim.expected_evaluation / eq_x_r_eval;
end_timer!(start);
Ok(ZeroCheckSubClaim {