Open several polynomials at one or more points each (possibly different for each polynomial). Each entry in the in the query set of points contains the label of the polynomial which should be queried at that point. Behaviour is undefined if `query_set` contains the entries with the same point label but different actual points. The opening challenges are independent for each batch of polynomials.
(
ck: &Self::CommitterKey,
labeled_polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<F, P>>,
commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitm
| 267 | /// |
| 268 | /// The opening challenges are independent for each batch of polynomials. |
| 269 | fn batch_open<'a>( |
| 270 | ck: &Self::CommitterKey, |
| 271 | labeled_polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<F, P>>, |
| 272 | commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>, |
| 273 | query_set: &QuerySet<P::Point>, |
| 274 | sponge: &mut impl CryptographicSponge, |
| 275 | states: impl IntoIterator<Item = &'a Self::CommitmentState>, |
| 276 | rng: Option<&mut dyn RngCore>, |
| 277 | ) -> Result<Self::BatchProof, Self::Error> |
| 278 | where |
| 279 | P: 'a, |
| 280 | Self::CommitmentState: 'a, |
| 281 | Self::Commitment: 'a, |
| 282 | { |
| 283 | // The default implementation achieves proceeds by rearranging the queries in |
| 284 | // order to gather (i.e. batch) all polynomials that should be queried at |
| 285 | // the same point, then opening their commitments simultaneously with a |
| 286 | // single call to `open` (per point) |
| 287 | let rng = &mut optional_rng::OptionalRng(rng); |
| 288 | let poly_st_comm: BTreeMap<_, _> = labeled_polynomials |
| 289 | .into_iter() |
| 290 | .zip(states) |
| 291 | .zip(commitments.into_iter()) |
| 292 | .map(|((poly, st), comm)| (poly.label(), (poly, st, comm))) |
| 293 | .collect(); |
| 294 | |
| 295 | let open_time = start_timer!(|| format!( |
| 296 | "Opening {} polynomials at query set of size {}", |
| 297 | poly_st_comm.len(), |
| 298 | query_set.len(), |
| 299 | )); |
| 300 | |
| 301 | let mut query_to_labels_map = BTreeMap::new(); |
| 302 | |
| 303 | // `label` is the label of the polynomial the query refers to |
| 304 | // `point_label` is the label of the point being queried |
| 305 | // `point` is the actual point |
| 306 | for (label, (point_label, point)) in query_set.iter() { |
| 307 | // For each point label in `query_set`, we define an entry in |
| 308 | // `query_to_labels_map` containing a pair whose first element is |
| 309 | // the actual point and the second one is the set of labels of the |
| 310 | // polynomials being queried at that point |
| 311 | let labels = query_to_labels_map |
| 312 | .entry(point_label) |
| 313 | .or_insert((point, BTreeSet::new())); |
| 314 | labels.1.insert(label); |
| 315 | } |
| 316 | |
| 317 | let mut proofs = Vec::new(); |
| 318 | for (_point_label, (point, labels)) in query_to_labels_map.into_iter() { |
| 319 | let mut query_polys: Vec<&'a LabeledPolynomial<_, _>> = Vec::new(); |
| 320 | let mut query_states: Vec<&'a Self::CommitmentState> = Vec::new(); |
| 321 | let mut query_comms: Vec<&'a LabeledCommitment<Self::Commitment>> = Vec::new(); |
| 322 | |
| 323 | // Constructing matching vectors with the polynomial, commitment |
| 324 | // randomness and actual commitment for each polynomial being |
| 325 | // queried at `point` |
| 326 | for label in labels { |
nothing calls this directly
no test coverage detected