mirror of
https://github.com/saymrwulf/pasta_curves-source.git
synced 2026-09-04 20:03:39 +00:00
Update documentation in polycommit verifier
This commit is contained in:
parent
d168f5c21b
commit
0b2ec8965f
1 changed files with 10 additions and 7 deletions
|
|
@ -38,8 +38,8 @@ impl<'a, C: CurveAffine> Guard<'a, C> {
|
||||||
self.msm
|
self.msm
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Lets caller supply the purported G point and simply appends it to
|
/// Lets caller supply the purported G point and simply appends
|
||||||
/// return an updated MSM.
|
/// [-z1] G to return an updated MSM.
|
||||||
pub fn use_g(mut self, g: C) -> (MSM<'a, C>, Accumulator<C>) {
|
pub fn use_g(mut self, g: C) -> (MSM<'a, C>, Accumulator<C>) {
|
||||||
self.msm.append_term(self.neg_z1, g);
|
self.msm.append_term(self.neg_z1, g);
|
||||||
|
|
||||||
|
|
@ -51,7 +51,7 @@ impl<'a, C: CurveAffine> Guard<'a, C> {
|
||||||
(self.msm, accumulator)
|
(self.msm, accumulator)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Computes the g value when given a potential scalar as input.
|
/// Computes G + H, where G = ⟨s, params.g⟩ and H is used for blinding
|
||||||
pub fn compute_g(&self) -> C {
|
pub fn compute_g(&self) -> C {
|
||||||
let s = compute_s(&self.challenges_sq, self.allinv);
|
let s = compute_s(&self.challenges_sq, self.allinv);
|
||||||
|
|
||||||
|
|
@ -159,9 +159,11 @@ impl<C: CurveAffine> Proof<C> {
|
||||||
let c_packed = transcript.squeeze().get_lower_128();
|
let c_packed = transcript.squeeze().get_lower_128();
|
||||||
let c: C::Scalar = get_challenge_scalar(Challenge(c_packed));
|
let c: C::Scalar = get_challenge_scalar(Challenge(c_packed));
|
||||||
|
|
||||||
// Check
|
// Construct
|
||||||
// [c] P + [c * v] U + [c] sum(L_i * u_i^2) + [c] sum(R_i * u_i^-2) + delta - [z1] G - [z1 * b] U - [z1 - z2] H
|
// [c] P + [c * v] U + [c] sum(L_i * u_i^2) + [c] sum(R_i * u_i^-2) + delta - [z1 * b] U + [z1 - z2] H
|
||||||
// = 0
|
// = [z1] (G + H)
|
||||||
|
// The computation of [z1] (G + H) happens in either Guard::use_challenges()
|
||||||
|
// or Guard::use_g().
|
||||||
|
|
||||||
let b = compute_b(x, &challenges, &challenges_inv);
|
let b = compute_b(x, &challenges, &challenges_inv);
|
||||||
|
|
||||||
|
|
@ -171,6 +173,7 @@ impl<C: CurveAffine> Proof<C> {
|
||||||
commitment_msm.scale(c);
|
commitment_msm.scale(c);
|
||||||
msm.add_msm(&commitment_msm);
|
msm.add_msm(&commitment_msm);
|
||||||
|
|
||||||
|
// [c] sum(L_i * u_i^2) + [c] sum(R_i * u_i^-2)
|
||||||
for scalar in &mut extra_scalars {
|
for scalar in &mut extra_scalars {
|
||||||
*scalar *= &c;
|
*scalar *= &c;
|
||||||
}
|
}
|
||||||
|
|
@ -185,7 +188,7 @@ impl<C: CurveAffine> Proof<C> {
|
||||||
// delta
|
// delta
|
||||||
msm.append_term(Field::one(), self.delta);
|
msm.append_term(Field::one(), self.delta);
|
||||||
|
|
||||||
// - [z1 - z2] H
|
// + [z1 - z2] H
|
||||||
msm.add_to_h_scalar(self.z1 - &self.z2);
|
msm.add_to_h_scalar(self.z1 - &self.z2);
|
||||||
|
|
||||||
let guard = Guard {
|
let guard = Guard {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue