From ed8130b7bfe8c2e53ba32eaa3ad17af68e758649 Mon Sep 17 00:00:00 2001 From: therealyingtong Date: Sun, 13 Sep 2020 11:37:10 +0800 Subject: [PATCH] Introduce Accumulator struct and return it in use_g() --- src/poly/commitment.rs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/poly/commitment.rs b/src/poly/commitment.rs index 7f96286..9917fbb 100644 --- a/src/poly/commitment.rs +++ b/src/poly/commitment.rs @@ -23,6 +23,16 @@ pub struct OpeningProof { z2: C::Scalar, } +/// TODO: documentation +#[derive(Debug, Clone)] +pub struct Accumulator { + /// TODO: documentation + pub g: C, + + /// TODO: documentation + pub challenges_sq_packed: Vec, +} + /// A multiscalar multiplication in the polynomial commitment scheme #[derive(Debug, Clone)] pub struct MSM<'a, C: CurveAffine> { @@ -267,11 +277,16 @@ impl<'a, C: CurveAffine> Guard<'a, C> { /// Lets caller supply the purported G point and simply appends it to /// return an updated MSM. - pub fn use_g(mut self, g: C) -> MSM<'a, C> { + pub fn use_g(mut self, g: C) -> (MSM<'a, C>, Accumulator) { &self.msm.other_scalars.push(self.neg_z1); &self.msm.other_bases.push(g); - self.msm + let accumulator = Accumulator { + g, + challenges_sq_packed: self.challenges_sq_packed, + }; + + (self.msm, accumulator) } }