(
ck: &Self::CommitterKey,
labeled_polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<G::ScalarField, P>>,
commitments: impl IntoIterator<Item = &'a LabeledCommitment<
| 473 | } |
| 474 | |
| 475 | fn open<'a>( |
| 476 | ck: &Self::CommitterKey, |
| 477 | labeled_polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<G::ScalarField, P>>, |
| 478 | commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>, |
| 479 | point: &'a P::Point, |
| 480 | sponge: &mut impl CryptographicSponge, |
| 481 | states: impl IntoIterator<Item = &'a Self::CommitmentState>, |
| 482 | rng: Option<&mut dyn RngCore>, |
| 483 | ) -> Result<Self::Proof, Self::Error> |
| 484 | where |
| 485 | Self::Commitment: 'a, |
| 486 | Self::CommitmentState: 'a, |
| 487 | P: 'a, |
| 488 | { |
| 489 | let mut combined_polynomial = P::zero(); |
| 490 | let mut combined_rand = G::ScalarField::zero(); |
| 491 | let mut combined_commitment_proj = G::Group::zero(); |
| 492 | |
| 493 | let mut has_hiding = false; |
| 494 | |
| 495 | let polys_iter = labeled_polynomials.into_iter(); |
| 496 | let states_iter = states.into_iter(); |
| 497 | let comms_iter = commitments.into_iter(); |
| 498 | |
| 499 | let combine_time = start_timer!(|| "Combining polynomials, randomness, and commitments."); |
| 500 | |
| 501 | let mut cur_challenge = sponge.squeeze_field_elements_with_sizes(&[CHALLENGE_SIZE])[0]; |
| 502 | |
| 503 | for (labeled_polynomial, (labeled_commitment, state)) in |
| 504 | polys_iter.zip(comms_iter.zip(states_iter)) |
| 505 | { |
| 506 | let label = labeled_polynomial.label(); |
| 507 | assert_eq!(labeled_polynomial.label(), labeled_commitment.label()); |
| 508 | Self::check_degrees_and_bounds(ck.supported_degree(), labeled_polynomial)?; |
| 509 | |
| 510 | let polynomial = labeled_polynomial.polynomial(); |
| 511 | let degree_bound = labeled_polynomial.degree_bound(); |
| 512 | let hiding_bound = labeled_polynomial.hiding_bound(); |
| 513 | let commitment = labeled_commitment.commitment(); |
| 514 | |
| 515 | combined_polynomial += (cur_challenge, polynomial); |
| 516 | combined_commitment_proj += &commitment.comm.mul(cur_challenge); |
| 517 | |
| 518 | if hiding_bound.is_some() { |
| 519 | has_hiding = true; |
| 520 | combined_rand += &(cur_challenge * &state.rand); |
| 521 | } |
| 522 | |
| 523 | cur_challenge = sponge.squeeze_field_elements_with_sizes(&[CHALLENGE_SIZE])[0]; |
| 524 | |
| 525 | let has_degree_bound = degree_bound.is_some(); |
| 526 | |
| 527 | assert_eq!( |
| 528 | has_degree_bound, |
| 529 | commitment.shifted_comm.is_some(), |
| 530 | "shifted_comm mismatch for {}", |
| 531 | label |
| 532 | ); |
nothing calls this directly
no test coverage detected