added revert reasons to the snark_scalar_field checks in verifier.sol templates

This commit is contained in:
Koh Wei Jie 2019-07-30 10:20:33 +08:00
parent f8ba7cbfa7
commit 2e9be76932
3 changed files with 3 additions and 3 deletions

@ -188,7 +188,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);
for (uint i = 0; i < input.length; i++) { for (uint i = 0; i < input.length; i++) {
require(input[i] < snark_scalar_field); require(input[i] < snark_scalar_field,"verifier-gte-snark-scalar-field");
vk_x = Pairing.addition(vk_x, Pairing.scalar_mul(vk.IC[i + 1], input[i])); vk_x = Pairing.addition(vk_x, Pairing.scalar_mul(vk.IC[i + 1], input[i]));
} }
vk_x = Pairing.addition(vk_x, vk.IC[0]); vk_x = Pairing.addition(vk_x, vk.IC[0]);

@ -179,7 +179,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);
for (uint i = 0; i < input.length; i++) { for (uint i = 0; i < input.length; i++) {
require(input[i] < snark_scalar_field); require(input[i] < snark_scalar_field,"verifier-gte-snark-scalar-field");
vk_x = Pairing.addition(vk_x, Pairing.scalar_mul(vk.IC[i + 1], input[i])); vk_x = Pairing.addition(vk_x, Pairing.scalar_mul(vk.IC[i + 1], input[i]));
} }
vk_x = Pairing.addition(vk_x, vk.IC[0]); vk_x = Pairing.addition(vk_x, vk.IC[0]);

@ -189,7 +189,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);
for (uint i = 0; i < input.length; i++) { for (uint i = 0; i < input.length; i++) {
require(input[i] < snark_scalar_field); require(input[i] < snark_scalar_field,"verifier-gte-snark-scalar-field");
vk_x = Pairing.addition(vk_x, Pairing.scalar_mul(vk.IC[i + 1], input[i])); vk_x = Pairing.addition(vk_x, Pairing.scalar_mul(vk.IC[i + 1], input[i]));
} }
vk_x = Pairing.addition(vk_x, vk.IC[0]); vk_x = Pairing.addition(vk_x, vk.IC[0]);