fn open<'a>(
        ck: &Self::CommitterKey,
        labeled_polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<E::Fr, P>>,
        _commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
        point: &'a P::Point,
        opening_challenges: &mut ChallengeGenerator<E::Fr, S>,
        rands: impl IntoIterator<Item = &'a Self::Randomness>,
        _rng: Option<&mut dyn RngCore>,
    ) -> Result<Self::Proof, Self::Error>
    where
        P: 'a,
        Self::Randomness: 'a,
        Self::Commitment: 'a,
    {
        let mut p = P::zero();
        let mut r = kzg10::Randomness::empty();
        let mut shifted_w = P::zero();
        let mut shifted_r = kzg10::Randomness::empty();
        let mut shifted_r_witness = P::zero();

        let mut enforce_degree_bound = false;
        for (polynomial, rand) in labeled_polynomials.into_iter().zip(rands) {
            let degree_bound = polynomial.degree_bound();
            assert_eq!(degree_bound.is_some(), rand.shifted_rand.is_some());

            let enforced_degree_bounds: Option<&[usize]> = ck
                .enforced_degree_bounds
                .as_ref()
                .map(|bounds| bounds.as_slice());
            kzg10::KZG10::<E, P>::check_degrees_and_bounds(
                ck.supported_degree(),
                ck.max_degree,
                enforced_degree_bounds,
                &polynomial,
            )?;

            // compute next challenges challenge^j and challenge^{j+1}.
            let challenge_j = opening_challenges.try_next_challenge_of_size(CHALLENGE_SIZE);

            assert_eq!(degree_bound.is_some(), rand.shifted_rand.is_some());

            p += (challenge_j, polynomial.polynomial());
            r += (challenge_j, &rand.rand);

            if let Some(degree_bound) = degree_bound {
                enforce_degree_bound = true;
                let shifted_rand = rand.shifted_rand.as_ref().unwrap();
                let (witness, shifted_rand_witness) =
                    kzg10::KZG10::<E, P>::compute_witness_polynomial(
                        polynomial.polynomial(),
                        *point,
                        &shifted_rand,
                    )?;
                let challenge_j_1 = opening_challenges.try_next_challenge_of_size(CHALLENGE_SIZE);

                let shifted_witness = shift_polynomial(ck, &witness, degree_bound);

                shifted_w += (challenge_j_1, &shifted_witness);
                shifted_r += (challenge_j_1, shifted_rand);
                if let Some(shifted_rand_witness) = shifted_rand_witness {
                    shifted_r_witness += (challenge_j_1, &shifted_rand_witness);
                }
            }
        }
        let proof_time = start_timer!(|| "Creating proof for unshifted polynomials");
        let proof = kzg10::KZG10::open(&ck.powers(), &p, *point, &r)?;
        let mut w = proof.w.into_projective();
        let mut random_v = proof.random_v;
        end_timer!(proof_time);

        if enforce_degree_bound {
            let proof_time = start_timer!(|| "Creating proof for shifted polynomials");
            let shifted_proof = kzg10::KZG10::open_with_witness_polynomial(
                &ck.shifted_powers(None).unwrap(),
                *point,
                &shifted_r,
                &shifted_w,
                Some(&shifted_r_witness),
            )?;
            end_timer!(proof_time);

            w += &shifted_proof.w.into_projective();
            if let Some(shifted_random_v) = shifted_proof.random_v {
                random_v = random_v.map(|v| v + &shifted_random_v);
            }
        }

        Ok(kzg10::Proof {
            w: w.into_affine(),
            random_v,
        })
    }
/// On input a polynomial `p` and a point `point`, outputs a proof for the same.
On input a polynomial `p` and a point `point`, outputs a proof for the same.
On input a polynomial ` p ` and a point ` point ` outputs a proof for the same .
fn open<'a>(
        ck: &Self::CommitterKey,
        labeled_polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<E::Fr, P>>,
        _commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
        point: &'a P::Point,
        opening_challenges: &mut ChallengeGenerator<E::Fr, S>,
        rands: impl IntoIterator<Item = &'a Self::Randomness>,
        _rng: Option<&mut dyn RngCore>,
    ) -> Result<Self::Proof, Self::Error>
    where
        P: 'a,
        Self::Randomness: 'a,
        Self::Commitment: 'a,
    {
        let mut p = P::zero();
        let mut r = kzg10::Randomness::empty();
        let mut shifted_w = P::zero();
        let mut shifted_r = kzg10::Randomness::empty();
        let mut shifted_r_witness = P::zero();
        let mut enforce_degree_bound = false;
        for (polynomial, rand) in labeled_polynomials.into_iter().zip(rands) {
            let degree_bound = polynomial.degree_bound();
            assert_eq!(degree_bound.is_some(), rand.shifted_rand.is_some());
            let enforced_degree_bounds: Option<&[usize]> = ck
                .enforced_degree_bounds
                .as_ref()
                .map(|bounds| bounds.as_slice());
            kzg10::KZG10::<E, P>::check_degrees_and_bounds(
                ck.supported_degree(),
                ck.max_degree,
                enforced_degree_bounds,
                &polynomial,
            )?;
            // compute next challenges challenge^j and challenge^{j+1}.
            let challenge_j = opening_challenges.try_next_challenge_of_size(CHALLENGE_SIZE);
            assert_eq!(degree_bound.is_some(), rand.shifted_rand.is_some());
            p += (challenge_j, polynomial.polynomial());
            r += (challenge_j, &rand.rand);
            if let Some(degree_bound) = degree_bound {
                enforce_degree_bound = true;
                let shifted_rand = rand.shifted_rand.as_ref().unwrap();
                let (witness, shifted_rand_witness) =
                    kzg10::KZG10::<E, P>::compute_witness_polynomial(
                        polynomial.polynomial(),
                        *point,
                        &shifted_rand,
                    )?;
                let challenge_j_1 = opening_challenges.try_next_challenge_of_size(CHALLENGE_SIZE);
                let shifted_witness = shift_polynomial(ck, &witness, degree_bound);
                shifted_w += (challenge_j_1, &shifted_witness);
                shifted_r += (challenge_j_1, shifted_rand);
                if let Some(shifted_rand_witness) = shifted_rand_witness {
                    shifted_r_witness += (challenge_j_1, &shifted_rand_witness);
                }
            }
        }
        let proof_time = start_timer!(|| "Creating proof for unshifted polynomials");
        let proof = kzg10::KZG10::open(&ck.powers(), &p, *point, &r)?;
        let mut w = proof.w.into_projective();
        let mut random_v = proof.random_v;
        end_timer!(proof_time);
        if enforce_degree_bound {
            let proof_time = start_timer!(|| "Creating proof for shifted polynomials");
            let shifted_proof = kzg10::KZG10::open_with_witness_polynomial(
                &ck.shifted_powers(None).unwrap(),
                *point,
                &shifted_r,
                &shifted_w,
                Some(&shifted_r_witness),
            )?;
            end_timer!(proof_time);
            w += &shifted_proof.w.into_projective();
            if let Some(shifted_random_v) = shifted_proof.random_v {
                random_v = random_v.map(|v| v + &shifted_random_v);
            }
        }
        Ok(kzg10::Proof {
            w: w.into_affine(),
            random_v,
        })
    }
fn open < ' a > ( ck : & Self :: CommitterKey , labeled_polynomials : impl IntoIterator < Item = & ' a LabeledPolynomial < E :: Fr , P > > , _commitments : impl IntoIterator < Item = & ' a LabeledCommitment < Self :: Commitment > > , point : & ' a P :: Point , opening_challenges : & mut ChallengeGenerator < E :: Fr , S > , rands : impl IntoIterator < Item = & ' a Self :: Randomness > , _rng : Option < & mut dyn RngCore > , ) -> Result < Self :: Proof , Self :: Error > where P : ' a , Self :: Randomness : ' a , Self :: Commitment : ' a , { let mut p = P :: zero ( ) ; let mut r = kzg10 :: Randomness :: empty ( ) ; let mut shifted_w = P :: zero ( ) ; let mut shifted_r = kzg10 :: Randomness :: empty ( ) ; let mut shifted_r_witness = P :: zero ( ) ; let mut enforce_degree_bound = false ; for ( polynomial , rand ) in labeled_polynomials . into_iter ( ) . zip ( rands ) { let degree_bound = polynomial . degree_bound ( ) ; assert_eq ! ( degree_bound is_some ( ) rand shifted_rand is_some ( ) ) ; let enforced_degree_bounds : Option < & [ usize ] > = ck . enforced_degree_bounds . as_ref ( ) . map ( | bounds | bounds . as_slice ( ) ) ; kzg10 :: KZG10 :: < E , P > :: check_degrees_and_bounds ( ck . supported_degree ( ) , ck . max_degree , enforced_degree_bounds , & polynomial , ) ? ; // compute next challenges challenge^j and challenge^{j+1}. let challenge_j = opening_challenges . try_next_challenge_of_size ( CHALLENGE_SIZE ) ; assert_eq ! ( degree_bound is_some ( ) rand shifted_rand is_some ( ) ) ; p += ( challenge_j , polynomial . polynomial ( ) ) ; r += ( challenge_j , & rand . rand ) ; if let Some ( degree_bound ) = degree_bound { enforce_degree_bound = true ; let shifted_rand = rand . shifted_rand . as_ref ( ) . unwrap ( ) ; let ( witness , shifted_rand_witness ) = kzg10 :: KZG10 :: < E , P > :: compute_witness_polynomial ( polynomial . polynomial ( ) , * point , & shifted_rand , ) ? ; let challenge_j_1 = opening_challenges . try_next_challenge_of_size ( CHALLENGE_SIZE ) ; let shifted_witness = shift_polynomial ( ck , & witness , degree_bound ) ; shifted_w += ( challenge_j_1 , & shifted_witness ) ; shifted_r += ( challenge_j_1 , shifted_rand ) ; if let Some ( shifted_rand_witness ) = shifted_rand_witness { shifted_r_witness += ( challenge_j_1 , & shifted_rand_witness ) ; } } } let proof_time = start_timer ! ( " " ) ; let proof = kzg10 :: KZG10 :: open ( & ck . powers ( ) , & p , * point , & r ) ? ; let mut w = proof . w . into_projective ( ) ; let mut random_v = proof . random_v ; end_timer ! ( proof_time ) ; if enforce_degree_bound { let proof_time = start_timer ! ( " " ) ; let shifted_proof = kzg10 :: KZG10 :: open_with_witness_polynomial ( & ck . shifted_powers ( None ) . unwrap ( ) , * point , & shifted_r , & shifted_w , Some ( & shifted_r_witness ) , ) ? ; end_timer ! ( proof_time ) ; w += & shifted_proof . w . into_projective ( ) ; if let Some ( shifted_random_v ) = shifted_proof . random_v { random_v = random_v . map ( | v | v + & shifted_random_v ) ; } } Ok ( kzg10 :: Proof { w : w . into_affine ( ) , random_v , } ) }
On input a polynomial `p` and a point `point`, outputs a proof for the same.
On input a polynomial ` p ` and a point ` point ` outputs a proof for the same .
ck
&Self::CommitterKey
labeled_polynomials
impl IntoIterator<Item = &'a LabeledPolynomial<E::Fr, P>>
_commitments
impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>
point
&'a P::Point
opening_challenges
&mut ChallengeGenerator<E::Fr, S>
rands
impl IntoIterator<Item = &'a Self::Randomness>
_rng
Option<&mut dyn RngCore>
ck
&Self::CommitterKey
labeled_polynomials
impl IntoIterator<Item = &'a LabeledPolynomial<E::Fr, P>>
_commitments
impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>
point
&'a P::Point
opening_challenges
&mut ChallengeGenerator<E::Fr, S>
rands
impl IntoIterator<Item = &'a Self::Randomness>
_rng
Option<&mut dyn RngCore>