mirror of https://github.com/zcash/halo2.git
refactor: rm params from IPA Verifier
This commit is contained in:
parent
f8156129fd
commit
b4d6f4bdca
|
@ -31,8 +31,7 @@ struct BatchStrategy<'params, C: CurveAffine> {
|
|||
msm: MSMIPA<'params, C>,
|
||||
}
|
||||
|
||||
impl<'params, C: CurveAffine>
|
||||
VerificationStrategy<'params, IPACommitmentScheme<C>, VerifierIPA<'params, C>>
|
||||
impl<'params, C: CurveAffine> VerificationStrategy<'params, IPACommitmentScheme<C>, VerifierIPA<C>>
|
||||
for BatchStrategy<'params, C>
|
||||
{
|
||||
type Output = MSMIPA<'params, C>;
|
||||
|
|
|
@ -370,7 +370,7 @@ mod test {
|
|||
let mut commitment_msm = MSMIPA::new(¶ms);
|
||||
commitment_msm.append_term(Fq::one(), p.into());
|
||||
|
||||
let guard = verify_proof(¶ms, commitment_msm, &mut transcript, *x, v).unwrap();
|
||||
let guard = verify_proof(commitment_msm, &mut transcript, *x, v).unwrap();
|
||||
let ch_verifier = transcript.squeeze_challenge();
|
||||
assert_eq!(*ch_prover, *ch_verifier);
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use group::ff::{BatchInvert, Field};
|
||||
|
||||
use super::ParamsIPA;
|
||||
use crate::{arithmetic::CurveAffine, poly::ipa::strategy::GuardIPA};
|
||||
use crate::{
|
||||
poly::{commitment::MSM, ipa::msm::MSMIPA, Error},
|
||||
|
@ -11,13 +10,12 @@ use crate::{
|
|||
/// point `x` that the polynomial commitment `P` opens purportedly to the value
|
||||
/// `v`. The provided `msm` should evaluate to the commitment `P` being opened.
|
||||
pub fn verify_proof<'params, C: CurveAffine, E: EncodedChallenge<C>, T: TranscriptRead<C, E>>(
|
||||
params: &'params ParamsIPA<C>,
|
||||
mut msm: MSMIPA<'params, C>,
|
||||
transcript: &mut T,
|
||||
x: C::Scalar,
|
||||
v: C::Scalar,
|
||||
) -> Result<GuardIPA<'params, C>, Error> {
|
||||
let k = params.k as usize;
|
||||
let k = msm.params.k as usize;
|
||||
|
||||
// P' = P - [v] G_0 + [ξ] S
|
||||
msm.add_constant_term(-v); // add [-v] G_0
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
use std::fmt::Debug;
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use halo2_middleware::ff::Field;
|
||||
|
||||
use super::{construct_intermediate_sets, ChallengeX1, ChallengeX2, ChallengeX3, ChallengeX4};
|
||||
use crate::arithmetic::{eval_polynomial, lagrange_interpolate, CurveAffine};
|
||||
use crate::poly::commitment::{Params, Verifier, MSM};
|
||||
use crate::poly::ipa::commitment::{IPACommitmentScheme, ParamsIPA, ParamsVerifierIPA};
|
||||
use crate::poly::ipa::commitment::{IPACommitmentScheme, ParamsVerifierIPA};
|
||||
use crate::poly::ipa::msm::MSMIPA;
|
||||
use crate::poly::ipa::strategy::GuardIPA;
|
||||
use crate::poly::query::{CommitmentReference, VerifierQuery};
|
||||
|
@ -14,20 +15,20 @@ use crate::transcript::{EncodedChallenge, TranscriptRead};
|
|||
|
||||
/// IPA multi-open verifier
|
||||
#[derive(Debug)]
|
||||
pub struct VerifierIPA<'params, C: CurveAffine> {
|
||||
params: &'params ParamsIPA<C>,
|
||||
pub struct VerifierIPA<C: CurveAffine> {
|
||||
_marker: PhantomData<C>,
|
||||
}
|
||||
|
||||
impl<'params, C: CurveAffine> Verifier<'params, IPACommitmentScheme<C>>
|
||||
for VerifierIPA<'params, C>
|
||||
{
|
||||
impl<'params, C: CurveAffine> Verifier<'params, IPACommitmentScheme<C>> for VerifierIPA<C> {
|
||||
type Guard = GuardIPA<'params, C>;
|
||||
type MSMAccumulator = MSMIPA<'params, C>;
|
||||
|
||||
const QUERY_INSTANCE: bool = true;
|
||||
|
||||
fn new(params: &'params ParamsVerifierIPA<C>) -> Self {
|
||||
Self { params }
|
||||
fn new(_params: &'params ParamsVerifierIPA<C>) -> Self {
|
||||
Self {
|
||||
_marker: PhantomData,
|
||||
}
|
||||
}
|
||||
|
||||
fn verify_proof<'com, E: EncodedChallenge<C>, T: TranscriptRead<C, E>, I>(
|
||||
|
@ -52,7 +53,7 @@ impl<'params, C: CurveAffine> Verifier<'params, IPACommitmentScheme<C>>
|
|||
// Compress the commitments and expected evaluations at x together.
|
||||
// using the challenge x_1
|
||||
let mut q_commitments: Vec<_> = vec![
|
||||
(self.params.empty_msm(), C::Scalar::ONE); // (accumulator, next x_1 power).
|
||||
(msm.params.empty_msm(), C::Scalar::ONE); // (accumulator, next x_1 power).
|
||||
point_sets.len()];
|
||||
|
||||
// A vec of vecs of evals. The outer vec corresponds to the point set,
|
||||
|
@ -143,6 +144,6 @@ impl<'params, C: CurveAffine> Verifier<'params, IPACommitmentScheme<C>>
|
|||
);
|
||||
|
||||
// Verify the opening proof
|
||||
super::commitment::verify_proof(self.params, msm, transcript, *x_3, v)
|
||||
super::commitment::verify_proof(msm, transcript, *x_3, v)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,8 +76,7 @@ pub struct AccumulatorStrategy<'params, C: CurveAffine> {
|
|||
msm: MSMIPA<'params, C>,
|
||||
}
|
||||
|
||||
impl<'params, C: CurveAffine>
|
||||
VerificationStrategy<'params, IPACommitmentScheme<C>, VerifierIPA<'params, C>>
|
||||
impl<'params, C: CurveAffine> VerificationStrategy<'params, IPACommitmentScheme<C>, VerifierIPA<C>>
|
||||
for AccumulatorStrategy<'params, C>
|
||||
{
|
||||
type Output = Self;
|
||||
|
@ -117,8 +116,7 @@ pub struct SingleStrategy<'params, C: CurveAffine> {
|
|||
msm: MSMIPA<'params, C>,
|
||||
}
|
||||
|
||||
impl<'params, C: CurveAffine>
|
||||
VerificationStrategy<'params, IPACommitmentScheme<C>, VerifierIPA<'params, C>>
|
||||
impl<'params, C: CurveAffine> VerificationStrategy<'params, IPACommitmentScheme<C>, VerifierIPA<C>>
|
||||
for SingleStrategy<'params, C>
|
||||
{
|
||||
type Output = ();
|
||||
|
|
Loading…
Reference in New Issue