Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenfeizhang committed Jun 14, 2024
1 parent d54a9e7 commit 81668ee
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
21 changes: 11 additions & 10 deletions bi-kzg/src/bi_kzg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,13 @@ where
affine_bases
};

assert_eq!(coeff_bases[..supported_n], powers_of_tau_0);

BiKZGSRS {
tau_0,
tau_1,
powers_of_g: coeff_bases,
powers_of_tau_0: powers_of_tau_0,
// powers_of_tau_0: powers_of_tau_0,
powers_of_g_lagrange_over_both_roots: lagrange_bases,
h: E::G2Affine::generator(),
tau_0_h: (E::G2Affine::generator() * tau_0).into(),
Expand Down Expand Up @@ -225,8 +227,11 @@ where

{
let lag_coeff = poly.evaluate_y(&prover_param.borrow().tau_1);
let com_lag =
best_multiexp(&lag_coeff, prover_param.borrow().powers_of_tau_0.as_slice()).into();
let com_lag = best_multiexp(
&lag_coeff,
prover_param.borrow().powers_of_g[..poly.degree_0].as_ref(),
)
.into();
assert_eq!(
com, com_lag,
"commitment is not equal to lagrange commitment"
Expand All @@ -243,11 +248,11 @@ where
point: &Self::Point,
) -> (Self::Proof, Self::Evaluation) {
let pi_0 = {
let f_x_b = polynomial.evaluate_y(&point.1);
let q_0_x_b = univariate_quotient(&f_x_b, &point.1);
let f_x_b = polynomial.evaluate_y(&point.1);
let q_0_x_b = univariate_quotient(&f_x_b, &point.1);
best_multiexp(
&q_0_x_b,
prover_param.borrow().powers_of_tau_0.as_slice(),
prover_param.borrow().powers_of_g[..polynomial.degree_0].as_ref(),
)
.to_affine()
};
Expand All @@ -273,7 +278,6 @@ where
// // lag_base_ptr = unsafe { lag_base_ptr.offset(degree_m as isize)};
// // domain1.ifft_in_place(&mut cj);
// best_fft(&mut cj, );


// let mut cb_temp = cj[degree_m-1];
// unsafe{ cb_ptr.add(j*degree_m + degree_m - 1).write(cb_temp) };
Expand All @@ -286,11 +290,8 @@ where
// });
// handles.push(handle);
// }


};


// fixme
let tau_0 = prover_param.borrow().tau_0;
let tau_1 = prover_param.borrow().tau_1;
Expand Down
4 changes: 2 additions & 2 deletions bi-kzg/src/structs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ pub struct BiKZGSRS<E: Engine> {
/// ..., g_1^{\tau_0^N\tau_1^M}
/// )
pub powers_of_g: Vec<E::G1Affine>,
/// g in lagrange form over omega_0
pub powers_of_tau_0: Vec<E::G1Affine>,
// /// g in lagrange form over omega_0
// pub powers_of_tau_0: Vec<E::G1Affine>,
/// g in lagrange form over omega_0 and omega_1
pub powers_of_g_lagrange_over_both_roots: Vec<E::G1Affine>,
/// The generator of G2.
Expand Down

0 comments on commit 81668ee

Please sign in to comment.