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

Method open

poly-commit/src/streaming_kzg/time.rs:104–123  ·  view source on GitHub ↗

Given a polynomial `polynomial` and an evaluation point `evaluation_point`, return the evaluation of `polynomial in `evaluation_point`, together with an evaluation proof.

(
        &self,
        polynomial: &[E::ScalarField],
        evalualtion_point: &E::ScalarField,
    )

Source from the content-addressed store, hash-verified

102 /// return the evaluation of `polynomial in `evaluation_point`,
103 /// together with an evaluation proof.
104 pub fn open(
105 &self,
106 polynomial: &[E::ScalarField],
107 evalualtion_point: &E::ScalarField,
108 ) -> (E::ScalarField, EvaluationProof<E>) {
109 let mut quotient = Vec::new();
110
111 let mut previous = E::ScalarField::zero();
112 for &c in polynomial.iter().rev() {
113 let coefficient = c + previous * evalualtion_point;
114 quotient.insert(0, coefficient);
115 previous = coefficient;
116 }
117
118 let (&evaluation, quotient) = quotient
119 .split_first()
120 .unwrap_or((&E::ScalarField::zero(), &[]));
121 let evaluation_proof = msm::<E>(&self.powers_of_g, quotient);
122 (evaluation, EvaluationProof(evaluation_proof))
123 }
124
125 /// Evaluate a single polynomial at a set of points `eval_points`, and provide a single evaluation proof.
126 pub fn open_multi_points(

Callers 4

test_open_consistencyFunction · 0.45
test_trivial_commitmentFunction · 0.45
test_commitmentFunction · 0.45
test_open_multi_pointsFunction · 0.45

Calls 3

EvaluationProofClass · 0.85
iterMethod · 0.80
insertMethod · 0.80

Tested by 4

test_open_consistencyFunction · 0.36
test_trivial_commitmentFunction · 0.36
test_commitmentFunction · 0.36
test_open_multi_pointsFunction · 0.36