The commitment procedures for our tensor check protocol. The algorithm takes advantage of the tree structure of folding polynomials in our protocol. Please refer to our paper for more details. The function takes as input a committer key and the tree structure of all the folding polynomials, and produces the desired commitment for each polynomial.
(
&self,
polynomials: &FoldedPolynomialTree<E::ScalarField, SF>,
max_msm_buffer: usize,
)
| 163 | /// The algorithm takes advantage of the tree structure of folding polynomials in our protocol. Please refer to our paper for more details. |
| 164 | /// The function takes as input a committer key and the tree structure of all the folding polynomials, and produces the desired commitment for each polynomial. |
| 165 | pub fn commit_folding<SF>( |
| 166 | &self, |
| 167 | polynomials: &FoldedPolynomialTree<E::ScalarField, SF>, |
| 168 | max_msm_buffer: usize, |
| 169 | ) -> Vec<Commitment<E>> |
| 170 | where |
| 171 | SF: Iterable, |
| 172 | SF::Item: Borrow<E::ScalarField>, |
| 173 | { |
| 174 | let n = polynomials.depth(); |
| 175 | let mut pippengers: Vec<ChunkedPippenger<E::G1>> = Vec::new(); |
| 176 | let mut folded_bases = Vec::new(); |
| 177 | for i in 1..n + 1 { |
| 178 | let pippenger: ChunkedPippenger<<E as Pairing>::G1> = |
| 179 | ChunkedPippenger::with_size(max_msm_buffer / n); |
| 180 | let bases_init = self.powers_of_g.iter(); |
| 181 | |
| 182 | let delta = self.powers_of_g.len() - ceil_div(polynomials.len(), 1 << i); |
| 183 | // TODO: change `skip` to `advance_by` once rust-lang/rust#7774 is fixed. |
| 184 | // See <https://github.com/rust-lang/rust/issues/77404> |
| 185 | let bases = bases_init.skip(delta); |
| 186 | folded_bases.push(bases); |
| 187 | pippengers.push(pippenger); |
| 188 | } |
| 189 | |
| 190 | for (i, coefficient) in polynomials.iter() { |
| 191 | let base = folded_bases[i - 1].next().unwrap(); |
| 192 | pippengers[i - 1].add(base.borrow(), coefficient.into_bigint()); |
| 193 | } |
| 194 | |
| 195 | pippengers |
| 196 | .into_iter() |
| 197 | .map(|p| Commitment(p.finalize().into_affine())) |
| 198 | .collect::<Vec<_>>() |
| 199 | } |
| 200 | |
| 201 | /// The commitment procedures for our tensor check protocol. |
| 202 | /// The algorithm takes advantage of the tree structure of folding polynomials in our protocol. Please refer to our paper for more details. |