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

Method verify

poly-commit/src/streaming_kzg/mod.rs:172–189  ·  view source on GitHub ↗

The verification procedure for the EvaluationProof with a single polynomial evaluated at a single evaluation point. The polynomial are evaluated at the point ``alpha`` and is committed as ``commitment``. The evaluation proof can be obtained either in a space-efficient or a time-efficient flavour.

(
        &self,
        commitment: &Commitment<E>,
        &alpha: &E::ScalarField,
        evaluation: &E::ScalarField,
        proof: &EvaluationProof<E>,
    )

Source from the content-addressed store, hash-verified

170 /// The polynomial are evaluated at the point ``alpha`` and is committed as ``commitment``.
171 /// The evaluation proof can be obtained either in a space-efficient or a time-efficient flavour.
172 pub fn verify(
173 &self,
174 commitment: &Commitment<E>,
175 &alpha: &E::ScalarField,
176 evaluation: &E::ScalarField,
177 proof: &EvaluationProof<E>,
178 ) -> VerificationResult {
179 let scalars = [(-alpha).into_bigint(), E::ScalarField::one().into_bigint()];
180 let ep = <E::G2 as VariableBaseMSM>::msm_bigint(&self.powers_of_g2, &scalars);
181 let lhs = commitment.0.into_group() - self.powers_of_g[0].mul(evaluation);
182 let g2 = self.powers_of_g2[0];
183
184 if E::pairing(lhs, g2) == E::pairing(proof.0, ep) {
185 Ok(())
186 } else {
187 Err(VerificationError)
188 }
189 }
190
191 /// The verification procedure for the EvaluationProof with a set of polynomials evaluated at a set of evaluation points.
192 /// All the polynomials are evaluated at the set of points ``eval_points`` and are committed as ``commitments``.

Callers 1

checkMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected