mirror of
https://github.com/arnaucube/hyperplonk.git
synced 2026-01-11 16:41:28 +01:00
impl KZG based multilinear pcs (#22)
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
use std::time::Instant;
|
||||
|
||||
use ark_bls12_381::Fr;
|
||||
use ark_std::test_rng;
|
||||
use poly_iop::{PolyIOP, PolyIOPErrors, SumCheck, VirtualPolynomial, ZeroCheck};
|
||||
use std::time::Instant;
|
||||
|
||||
fn main() -> Result<(), PolyIOPErrors> {
|
||||
bench_sum_check()?;
|
||||
@@ -27,8 +26,10 @@ fn bench_sum_check() -> Result<(), PolyIOPErrors> {
|
||||
let poly_info = poly.domain_info.clone();
|
||||
let proof = {
|
||||
let start = Instant::now();
|
||||
let mut transcript = <PolyIOP<Fr> as SumCheck<Fr>>::init_transcript();
|
||||
let proof = <PolyIOP<Fr> as SumCheck<Fr>>::prove(&poly, &mut transcript)?;
|
||||
for _ in 0..repetition {
|
||||
let mut transcript = <PolyIOP<Fr> as SumCheck<Fr>>::init_transcript();
|
||||
let _proof = <PolyIOP<Fr> as SumCheck<Fr>>::prove(&poly, &mut transcript)?;
|
||||
}
|
||||
|
||||
println!(
|
||||
"sum check proving time for {} variables and {} degree: {} ns",
|
||||
@@ -36,26 +37,30 @@ fn bench_sum_check() -> Result<(), PolyIOPErrors> {
|
||||
degree,
|
||||
start.elapsed().as_nanos() / repetition as u128
|
||||
);
|
||||
proof
|
||||
let mut transcript = <PolyIOP<Fr> as SumCheck<Fr>>::init_transcript();
|
||||
<PolyIOP<Fr> as SumCheck<Fr>>::prove(&poly, &mut transcript)?
|
||||
};
|
||||
|
||||
{
|
||||
let start = Instant::now();
|
||||
let mut transcript = <PolyIOP<Fr> as SumCheck<Fr>>::init_transcript();
|
||||
let subclaim = <PolyIOP<Fr> as SumCheck<Fr>>::verify(
|
||||
asserted_sum,
|
||||
&proof,
|
||||
&poly_info,
|
||||
&mut transcript,
|
||||
)?;
|
||||
assert!(
|
||||
poly.evaluate(&subclaim.point).unwrap() == subclaim.expected_evaluation,
|
||||
"wrong subclaim"
|
||||
);
|
||||
|
||||
for _ in 0..repetition {
|
||||
let mut transcript = <PolyIOP<Fr> as SumCheck<Fr>>::init_transcript();
|
||||
let subclaim = <PolyIOP<Fr> as SumCheck<Fr>>::verify(
|
||||
asserted_sum,
|
||||
&proof,
|
||||
&poly_info,
|
||||
&mut transcript,
|
||||
)?;
|
||||
assert!(
|
||||
poly.evaluate(&subclaim.point).unwrap() == subclaim.expected_evaluation,
|
||||
"wrong subclaim"
|
||||
);
|
||||
}
|
||||
println!(
|
||||
"sum check verification time for {} variables: {} ns",
|
||||
"sum check verification time for {} variables and {} degree: {} ns",
|
||||
nv,
|
||||
degree,
|
||||
start.elapsed().as_nanos() / repetition as u128
|
||||
);
|
||||
}
|
||||
@@ -106,8 +111,9 @@ fn bench_zero_check() -> Result<(), PolyIOPErrors> {
|
||||
"wrong subclaim"
|
||||
);
|
||||
println!(
|
||||
"zero check verification time for {} variables: {} ns",
|
||||
"zero check verification time for {} variables and {} degree:: {} ns",
|
||||
nv,
|
||||
degree,
|
||||
start.elapsed().as_nanos() / repetition as u128
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user