MCPcopy Create free account
hub / github.com/arkworks-rs/poly-commit / open

Method open

poly-commit/src/sonic_pc/mod.rs:340–382  ·  view source on GitHub ↗
(
        ck: &Self::CommitterKey,
        labeled_polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<E::ScalarField, P>>,
        _commitments: impl IntoIterator<Item = &'a LabeledCommitment

Source from the content-addressed store, hash-verified

338 }
339
340 fn open<'a>(
341 ck: &Self::CommitterKey,
342 labeled_polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<E::ScalarField, P>>,
343 _commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
344 point: &'a P::Point,
345 sponge: &mut impl CryptographicSponge,
346 states: impl IntoIterator<Item = &'a Self::CommitmentState>,
347 _rng: Option<&mut dyn RngCore>,
348 ) -> Result<Self::Proof, Self::Error>
349 where
350 Self::CommitmentState: 'a,
351 Self::Commitment: 'a,
352 P: 'a,
353 {
354 let mut combined_polynomial = P::zero();
355 let mut combined_rand = kzg10::Randomness::empty();
356
357 let mut curr_challenge = sponge.squeeze_field_elements_with_sizes(&[CHALLENGE_SIZE])[0];
358
359 for (polynomial, state) in labeled_polynomials.into_iter().zip(states) {
360 let enforced_degree_bounds: Option<&[usize]> = ck
361 .enforced_degree_bounds
362 .as_ref()
363 .map(|bounds| bounds.as_slice());
364
365 kzg10::KZG10::<E, P>::check_degrees_and_bounds(
366 ck.supported_degree(),
367 ck.max_degree,
368 enforced_degree_bounds,
369 &polynomial,
370 )?;
371
372 combined_polynomial += (curr_challenge, polynomial.polynomial());
373 combined_rand += (curr_challenge, state);
374 curr_challenge = sponge.squeeze_field_elements_with_sizes(&[CHALLENGE_SIZE])[0];
375 }
376
377 let proof_time = start_timer!(|| "Creating proof for polynomials");
378 let proof = kzg10::KZG10::open(&ck.powers(), &combined_polynomial, *point, &combined_rand)?;
379 end_timer!(proof_time);
380
381 Ok(proof)
382 }
383
384 fn check<'a>(
385 vk: &Self::VerifierKey,

Callers

nothing calls this directly

Calls 4

openFunction · 0.85
polynomialMethod · 0.80
supported_degreeMethod · 0.45
powersMethod · 0.45

Tested by

no test coverage detected