Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Koukyosyumei committed Dec 29, 2024
1 parent fd30e15 commit 03c2cac
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
9 changes: 3 additions & 6 deletions myzkp/src/modules/zksnark/tutorial_snark/protocol_3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,9 @@ pub fn setup(g1: &G1Point, g2: &G2Point, qap: &QAP<FqOrder>) -> (ProofKey3, Veri
let r_i_s = qap.r_i_vec[i].eval(&s).sanitize();
let o_i_s = qap.o_i_vec[i].eval(&s).sanitize();
g1_checksum_vec.push(
g1.mul_ref(
((beta_ell.mul_ref(&ell_i_s))
.add_ref(&beta_r.mul_ref(&r_i_s))
.add_ref(&beta_o.mul_ref(&o_i_s)))
.get_value(),
),
g1 * ((beta_ell.mul_ref(&ell_i_s))
.add_ref(&beta_r.mul_ref(&r_i_s))
.add_ref(&beta_o.mul_ref(&o_i_s))),
);
}

Expand Down
16 changes: 8 additions & 8 deletions myzkp/src/modules/zksnark/tutorial_snark/protocol_5.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ pub fn setup(g1: &G1Point, g2: &G2Point, qap: &QAP<FqOrder>) -> (ProofKey5, Veri
let rho_r = FqOrder::random_element(&[]);
let rho_o = rho_ell.mul_ref(&rho_r);

let g1_ell = g1 * rho_ell.get_value();
let g1_r = g1 * rho_r.get_value();
let g2_r = g2 * rho_r.get_value();
let g1_o = g1 * rho_o.get_value();
let g2_o = g2 * rho_o.get_value();
let g1_ell = g1 * &rho_ell;
let g1_r = g1 * &rho_r;
let g2_r = g2 * &rho_r;
let g1_o = g1 * &rho_o;
let g2_o = g2 * &rho_o;

let mut g1_checksum_vec = Vec::with_capacity(qap.d);

Expand Down Expand Up @@ -89,9 +89,9 @@ pub fn setup(g1: &G1Point, g2: &G2Point, qap: &QAP<FqOrder>) -> (ProofKey5, Veri
g1_checksum_vec: g1_checksum_vec,
},
VerificationKey5 {
g2_alpha_ell: g2 * alpha_ell.get_value(),
g1_alpha_r: g1 * alpha_r.get_value(),
g2_alpha_o: g2 * alpha_o.get_value(),
g2_alpha_ell: g2 * &alpha_ell,
g1_alpha_r: g1 * &alpha_r,
g2_alpha_o: g2 * &alpha_o,
g1_beta_eta: g1 * beta.get_value() * eta.get_value(),
g2_beta_eta: g2 * beta.get_value() * eta.get_value(),
g2_t_s: g2_o * qap.t.eval(&s).sanitize().get_value(),
Expand Down

0 comments on commit 03c2cac

Please sign in to comment.