Skip to content

Commit 5f465b6

Browse files
authored
change r(x) to I(x) (#288)
1 parent 9442655 commit 5f465b6

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

cryptography/kzg_multi_open/src/naive.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ fn _compute_multi_opening_naive(
9292
}
9393

9494
// Compute f(x) - I(x) / \prod (x - z_i)
95-
// Where I(x) is the polynomial such that r(z_i) = f(z_i) for all z_i
95+
// Where I(x) is the polynomial such that I(z_i) = f(z_i) for all z_i
9696
//
9797
// We can speed up computation of I(x) by doing an IFFT, given the coset generator, since
9898
// we know all of the points are of the form k * \omega where \omega is a root of unity
@@ -103,15 +103,15 @@ fn _compute_multi_opening_naive(
103103
.zip(evaluations.iter())
104104
.map(|(p, e)| (*p, *e))
105105
.collect();
106-
let r_x = lagrange_interpolate(&coordinates).expect("lagrange interpolation failed");
106+
let i_x = lagrange_interpolate(&coordinates).expect("lagrange interpolation failed");
107107

108-
// Check that the r_x polynomial is correct, it should essentially be the polynomial that
109-
// evaluates to f(z_i) = r(z_i)
108+
// Check that the i_x polynomial is correct, it should essentially be the polynomial that
109+
// evaluates to f(z_i) = I(z_i)
110110
for (point, evaluation) in points.iter().zip(evaluations.iter()) {
111-
assert_eq!(poly_eval(&r_x, point), *evaluation);
111+
assert_eq!(poly_eval(&i_x, point), *evaluation);
112112
}
113113

114-
let poly_shifted = poly_sub(polynomial.to_vec().clone(), r_x.clone());
114+
let poly_shifted = poly_sub(polynomial.to_vec().clone(), i_x.clone());
115115

116116
let mut quotient_poly = poly_shifted.to_vec().clone();
117117
for point in points.iter() {
@@ -146,17 +146,17 @@ fn _verify_multi_opening_naive(
146146
.zip(output_points.iter())
147147
.map(|(p, e)| (*p, *e))
148148
.collect();
149-
let r_x = lagrange_interpolate(&coordinates).unwrap();
149+
let i_x = lagrange_interpolate(&coordinates).unwrap();
150150

151151
let vanishing_poly = vanishing_poly(input_points);
152152
let comm_vanishing_poly: G2Point = verification_key.commit_g2(&vanishing_poly).into();
153153

154-
let comm_r_x = verification_key.commit_g1(&r_x);
155-
let comm_minus_r_x: G1Point = (G1Projective::from(commitment) - comm_r_x).into();
154+
let comm_i_x = verification_key.commit_g1(&i_x);
155+
let comm_minus_i_x: G1Point = (G1Projective::from(commitment) - comm_i_x).into();
156156
multi_pairings(&[
157157
(&proof, &G2Prepared::from(comm_vanishing_poly)),
158158
(
159-
&comm_minus_r_x,
159+
&comm_minus_i_x,
160160
&G2Prepared::from(-verification_key.g2_gen()),
161161
),
162162
])

0 commit comments

Comments
 (0)