(
ck: &Self::CommitterKey,
linear_combinations: impl IntoIterator<Item = &'a LinearCombination<E::ScalarField>>,
polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<E::
| 494 | } |
| 495 | |
| 496 | fn open_combinations<'a>( |
| 497 | ck: &Self::CommitterKey, |
| 498 | linear_combinations: impl IntoIterator<Item = &'a LinearCombination<E::ScalarField>>, |
| 499 | polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<E::ScalarField, P>>, |
| 500 | commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>, |
| 501 | query_set: &QuerySet<P::Point>, |
| 502 | sponge: &mut impl CryptographicSponge, |
| 503 | states: impl IntoIterator<Item = &'a Self::CommitmentState>, |
| 504 | rng: Option<&mut dyn RngCore>, |
| 505 | ) -> Result<BatchLCProof<E::ScalarField, Self::BatchProof>, Self::Error> |
| 506 | where |
| 507 | Self::CommitmentState: 'a, |
| 508 | Self::Commitment: 'a, |
| 509 | P: 'a, |
| 510 | { |
| 511 | let label_map = polynomials |
| 512 | .into_iter() |
| 513 | .zip(states) |
| 514 | .zip(commitments) |
| 515 | .map(|((p, s), c)| (p.label(), (p, s, c))) |
| 516 | .collect::<BTreeMap<_, _>>(); |
| 517 | |
| 518 | let mut lc_polynomials = Vec::new(); |
| 519 | let mut lc_states = Vec::new(); |
| 520 | let mut lc_commitments = Vec::new(); |
| 521 | let mut lc_info = Vec::new(); |
| 522 | |
| 523 | for lc in linear_combinations { |
| 524 | let lc_label = lc.label().clone(); |
| 525 | let mut poly = P::zero(); |
| 526 | let mut degree_bound = None; |
| 527 | let mut hiding_bound = None; |
| 528 | let mut state = Self::CommitmentState::empty(); |
| 529 | let mut comm = E::G1::zero(); |
| 530 | |
| 531 | let num_polys = lc.len(); |
| 532 | for (coeff, label) in lc.iter().filter(|(_, l)| !l.is_one()) { |
| 533 | let label: &String = label.try_into().expect("cannot be one!"); |
| 534 | let &(cur_poly, cur_state, curr_comm) = |
| 535 | label_map.get(label).ok_or(Error::MissingPolynomial { |
| 536 | label: label.to_string(), |
| 537 | })?; |
| 538 | |
| 539 | if num_polys == 1 && cur_poly.degree_bound().is_some() { |
| 540 | assert!( |
| 541 | coeff.is_one(), |
| 542 | "Coefficient must be one for degree-bounded equations" |
| 543 | ); |
| 544 | degree_bound = cur_poly.degree_bound(); |
| 545 | } else if cur_poly.degree_bound().is_some() { |
| 546 | eprintln!("Degree bound when number of equations is non-zero"); |
| 547 | return Err(Self::Error::EquationHasDegreeBounds(lc_label)); |
| 548 | } |
| 549 | |
| 550 | // Some(_) > None, always. |
| 551 | hiding_bound = core::cmp::max(hiding_bound, cur_poly.hiding_bound()); |
| 552 | poly += (*coeff, cur_poly.polynomial()); |
| 553 | state += (*coeff, cur_state); |
nothing calls this directly
no test coverage detected