From 6f98d6bc0316f843cfaa383f45f1eeb4b38ead54 Mon Sep 17 00:00:00 2001 From: wborgeaud Date: Wed, 7 Sep 2022 16:46:27 +0200 Subject: [PATCH 1/3] Comment batch opening --- plonky2/src/fri/oracle.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plonky2/src/fri/oracle.rs b/plonky2/src/fri/oracle.rs index 1f5b648f..efe34939 100644 --- a/plonky2/src/fri/oracle.rs +++ b/plonky2/src/fri/oracle.rs @@ -180,7 +180,13 @@ impl, C: GenericConfig, const D: usize> // Final low-degree polynomial that goes into FRI. let mut final_poly = PolynomialCoeffs::empty(); + // Each batch `i` consists of an opening point `z_i` and polynomials `{f_ij}_j` to be opened at that point. + // For each batch, we compute the composition polynomial `F_i = sum alpha^j f_ij`, + // where `alpha` is a random challenge in the extension field. + // The final polynomial is then computed as `final_poly = sum_i alpha^(k_i) (F_i(X) - F_i(z_i))/(X-z_i)` + // where the `k_i`s are chosen such that each power of `alpha` appears only once in the final sum. for FriBatchInfo { point, polynomials } in &instance.batches { + // Collect the coefficients of all the polynomials in `polynomials`. let polys_coeff = polynomials.iter().map(|fri_poly| { &oracles[fri_poly.oracle_index].polynomials[fri_poly.polynomial_index] }); From 8fd4fc430446b38fcb3b21312c47985b58b90153 Mon Sep 17 00:00:00 2001 From: wborgeaud Date: Wed, 7 Sep 2022 16:49:23 +0200 Subject: [PATCH 2/3] Minor --- plonky2/src/fri/structure.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plonky2/src/fri/structure.rs b/plonky2/src/fri/structure.rs index 1a37a1b2..d5c2c81c 100644 --- a/plonky2/src/fri/structure.rs +++ b/plonky2/src/fri/structure.rs @@ -42,7 +42,7 @@ pub struct FriBatchInfoTarget { #[derive(Copy, Clone, Debug)] pub struct FriPolynomialInfo { - /// Index into `FriInstanceInfoTarget`'s `oracles` list. + /// Index into `FriInstanceInfo`'s `oracles` list. pub oracle_index: usize, /// Index of the polynomial within the oracle. pub polynomial_index: usize, From f1e21ffb5d4acdf22067829fd7eba1d3611689d1 Mon Sep 17 00:00:00 2001 From: wborgeaud Date: Wed, 7 Sep 2022 20:57:38 +0200 Subject: [PATCH 3/3] More comment --- plonky2/src/fri/oracle.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plonky2/src/fri/oracle.rs b/plonky2/src/fri/oracle.rs index efe34939..75f8847a 100644 --- a/plonky2/src/fri/oracle.rs +++ b/plonky2/src/fri/oracle.rs @@ -185,6 +185,8 @@ impl, C: GenericConfig, const D: usize> // where `alpha` is a random challenge in the extension field. // The final polynomial is then computed as `final_poly = sum_i alpha^(k_i) (F_i(X) - F_i(z_i))/(X-z_i)` // where the `k_i`s are chosen such that each power of `alpha` appears only once in the final sum. + // There are usually two batches for the openings at `zeta` and `g * zeta`. + // The oracles used in Plonky2 are given in `FRI_ORACLES` in `plonky2/src/plonk/plonk_common.rs`. for FriBatchInfo { point, polynomials } in &instance.batches { // Collect the coefficients of all the polynomials in `polynomials`. let polys_coeff = polynomials.iter().map(|fri_poly| {