Skip to content

Commit

Permalink
Added comments
Browse files Browse the repository at this point in the history
  • Loading branch information
rasmus-kirk committed Dec 30, 2024
1 parent 9c95267 commit b74cb6c
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion code/src/pcdl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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<R: Rng>(
rng: &mut R,
p: PallasPoly,
Expand Down Expand Up @@ -233,6 +241,14 @@ pub fn open<R: Rng>(
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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit b74cb6c

Please sign in to comment.