Add theta challenge

This commit is contained in:
therealyingtong 2020-12-01 14:44:14 +08:00
parent 5d891e029d
commit 2ba44cff9f
3 changed files with 18 additions and 3 deletions

View file

@ -91,6 +91,10 @@ impl<C: CurveAffine> VerifyingKey<C> {
}
}
#[derive(Clone, Copy, Debug)]
struct Theta;
type ChallengeTheta<F> = ChallengeScalar<F, Theta>;
#[derive(Clone, Copy, Debug)]
struct Beta;
type ChallengeBeta<F> = ChallengeScalar<F, Beta>;

View file

@ -3,7 +3,8 @@ use std::iter;
use super::{
circuit::{Advice, Assignment, Circuit, Column, ConstraintSystem, Fixed},
permutation, ChallengeBeta, ChallengeGamma, ChallengeX, ChallengeY, Error, Proof, ProvingKey,
permutation, ChallengeBeta, ChallengeGamma, ChallengeTheta, ChallengeX, ChallengeY, Error,
Proof, ProvingKey,
};
use crate::arithmetic::{eval_polynomial, Curve, CurveAffine, FieldExt};
use crate::poly::{
@ -168,6 +169,9 @@ impl<C: CurveAffine> Proof<C> {
})
.collect();
// Sample theta challenge for keeping lookup columns linearly independent
let theta = ChallengeTheta::<C::Scalar>::get(&mut transcript);
// Sample beta challenge
let beta = ChallengeBeta::get(&mut transcript);

View file

@ -1,7 +1,10 @@
use ff::Field;
use std::iter;
use super::{ChallengeBeta, ChallengeGamma, ChallengeX, ChallengeY, Error, Proof, VerifyingKey};
use super::{
ChallengeBeta, ChallengeGamma, ChallengeTheta, ChallengeX, ChallengeY, Error, Proof,
VerifyingKey,
};
use crate::arithmetic::{CurveAffine, FieldExt};
use crate::poly::{
commitment::{Guard, Params, MSM},
@ -45,6 +48,9 @@ impl<'a, C: CurveAffine> Proof<C> {
.map_err(|_| Error::TranscriptError)?;
}
// Sample theta challenge for keeping lookup columns linearly independent
let theta = ChallengeTheta::get(&mut transcript);
// Sample beta challenge
let beta = ChallengeBeta::get(&mut transcript);
@ -72,7 +78,7 @@ impl<'a, C: CurveAffine> Proof<C> {
// This check ensures the circuit is satisfied so long as the polynomial
// commitments open to the correct values.
self.check_hx(params, vk, beta, gamma, y, x)?;
self.check_hx(params, vk, theta, beta, gamma, y, x)?;
for eval in self
.advice_evals
@ -189,6 +195,7 @@ impl<'a, C: CurveAffine> Proof<C> {
&self,
params: &'a Params<C>,
vk: &VerifyingKey<C>,
theta: ChallengeTheta<C::Scalar>,
beta: ChallengeBeta<C::Scalar>,
gamma: ChallengeGamma<C::Scalar>,
y: ChallengeY<C::Scalar>,