Skip to content

Commit

Permalink
Fix brackets in the in field check
Browse files Browse the repository at this point in the history
  • Loading branch information
jbaylina committed Jul 26, 2019
1 parent 0349d90 commit f8ba7cb
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/bn128.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ class BN128 {
throw new Error("Expected values are not equal");
}

if (this.loopCountNef)
if (this.loopCountNeg)
{
R.Y = this.F2.neg(R.Y);
}
Expand Down
3 changes: 2 additions & 1 deletion templates/verifier_groth.sol
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,10 @@ contract Verifier {
require(input.length + 1 == vk.IC.length,"verifier-bad-input");
// Compute the linear combination vk_x
Pairing.G1Point memory vk_x = Pairing.G1Point(0, 0);
for (uint i = 0; i < input.length; i++)
for (uint i = 0; i < input.length; i++) {
require(input[i] < snark_scalar_field);
vk_x = Pairing.addition(vk_x, Pairing.scalar_mul(vk.IC[i + 1], input[i]));
}
vk_x = Pairing.addition(vk_x, vk.IC[0]);
if (!Pairing.pairingProd4(
Pairing.negate(proof.A), proof.B,
Expand Down
3 changes: 2 additions & 1 deletion templates/verifier_kimleeoh.sol
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,10 @@ contract Verifier {
require(input.length + 1 == vk.IC.length);
// Compute the linear combination vk_x
Pairing.G1Point memory vk_x = Pairing.G1Point(0, 0);
for (uint i = 0; i < input.length; i++)
for (uint i = 0; i < input.length; i++) {
require(input[i] < snark_scalar_field);
vk_x = Pairing.addition(vk_x, Pairing.scalar_mul(vk.IC[i + 1], input[i]));
}
vk_x = Pairing.addition(vk_x, vk.IC[0]);
if (!Pairing.pairingProd4(
Pairing.negate(proof.A), proof.B,
Expand Down
3 changes: 2 additions & 1 deletion templates/verifier_original.sol
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,10 @@ contract Verifier {
require(input.length + 1 == vk.IC.length,"verifier-bad-input");
// Compute the linear combination vk_x
Pairing.G1Point memory vk_x = Pairing.G1Point(0, 0);
for (uint i = 0; i < input.length; i++)
for (uint i = 0; i < input.length; i++) {
require(input[i] < snark_scalar_field);
vk_x = Pairing.addition(vk_x, Pairing.scalar_mul(vk.IC[i + 1], input[i]));
}
vk_x = Pairing.addition(vk_x, vk.IC[0]);
if (!Pairing.pairingProd2(proof.A, vk.A, Pairing.negate(proof.A_p), Pairing.P2())) return 1;
if (!Pairing.pairingProd2(vk.B, proof.B, Pairing.negate(proof.B_p), Pairing.P2())) return 2;
Expand Down

0 comments on commit f8ba7cb

Please sign in to comment.