move vk_x before the loop

This commit is contained in:
poma 2020-02-07 22:55:41 +08:00
parent f85e53b925
commit c81dfb07dd
No known key found for this signature in database
GPG Key ID: BA20CB01FE165657

@ -187,6 +187,7 @@ contract Verifier {
// Compute the linear combination vk_x // Compute the linear combination vk_x
Pairing.G1Point memory vk_x = Pairing.G1Point(0, 0); Pairing.G1Point memory vk_x = Pairing.G1Point(0, 0);
vk_x = Pairing.plus(vk_x, vk.IC[0]);
// Make sure that every input is less than the snark scalar field // Make sure that every input is less than the snark scalar field
for (uint256 i = 0; i < input.length; i++) { for (uint256 i = 0; i < input.length; i++) {
@ -194,8 +195,6 @@ contract Verifier {
vk_x = Pairing.plus(vk_x, Pairing.scalar_mul(vk.IC[i + 1], input[i])); vk_x = Pairing.plus(vk_x, Pairing.scalar_mul(vk.IC[i + 1], input[i]));
} }
vk_x = Pairing.plus(vk_x, vk.IC[0]);
return Pairing.pairing( return Pairing.pairing(
Pairing.negate(_proof.A), Pairing.negate(_proof.A),
_proof.B, _proof.B,