From b74cb6c117f38d279ac912fbf917eebef82a24b8 Mon Sep 17 00:00:00 2001 From: rasmus-kirk Date: Mon, 30 Dec 2024 14:55:07 +0100 Subject: [PATCH] Added comments --- code/src/pcdl.rs | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/code/src/pcdl.rs b/code/src/pcdl.rs index 36a28f9..202e5e4 100644 --- a/code/src/pcdl.rs +++ b/code/src/pcdl.rs @@ -91,6 +91,11 @@ impl HPoly { } } +/// Creates a commitment to the coefficients of the polynomial $p$ of degree $d' < d$, with optional hiding $\o$, using pedersen commitments. +/// +/// p: A univariate polynomial p(X), +/// d: A degree bound for p, we require that p.degree() <= d, +/// w: Optional hiding to pass to the underlying Pederson Commitment pub fn commit(p: &PallasPoly, d: usize, w: Option<&PallasScalar>) -> PallasPoint { let n = d + 1; @@ -104,11 +109,14 @@ pub fn commit(p: &PallasPoly, d: usize, w: Option<&PallasScalar>) -> PallasPoint pedersen::commit(w, &GS[0..n], &coeffs) } +/// Creates a proof that states: "I know a polynomial p of degree d' less than d, with commitment C s.t. p(z) = v" where p is private and d, z, v are public. +/// /// rng: Required since the function uses randomness /// p: A univariate polynomial p(X) /// C: A commitment to p, +/// d: A degree bound for p, we require that p.degree() <= d, /// z: An evaluation point z -/// w: Commitment randomness ω +/// w: Commitment randomness ω for the Pedersen Commitment C pub fn open( rng: &mut R, p: PallasPoly, @@ -233,6 +241,14 @@ pub fn open( pi } +/// Cheaply checks that a proof, pi, is correct. It is not a full check +/// however, since an expensive part of the check is deferred until a later point. +/// +/// C: A commitment to p, +/// d: A degree bound for p, we require that p.degree() <= d, +/// z: An evaluation point z +/// v: v = p(z) +/// pi: The evaluation proof pub fn succinct_check( C: PallasPoint, d: usize, @@ -297,6 +313,13 @@ pub fn succinct_check( Ok((h, U)) } +/// The full check on the evaluation proof, pi +/// +/// C: A commitment to p, +/// d: A degree bound for p, we require that p.degree() <= d, +/// z: An evaluation point z +/// v: v = p(z) +/// pi: The evaluation proof pub fn check( C: &PallasPoint, d: usize,