Rename addition -> add, scalarMul -> multiply

This commit is contained in:
Mark Spanbroek 2024-01-30 09:35:44 +01:00 committed by markspanbroek
parent 91388096c1
commit 111ed0826c
1 changed files with 7 additions and 7 deletions

View File

@ -32,10 +32,10 @@ library Pairing {
} }
/// The sum of two points of G1 /// The sum of two points of G1
function addition( function add(
G1Point memory p1, G1Point memory p1,
G1Point memory p2 G1Point memory p2
) internal view returns (G1Point memory r) { ) internal view returns (G1Point memory sum) {
uint[4] memory input; uint[4] memory input;
input[0] = p1.x; input[0] = p1.x;
input[1] = p1.y; input[1] = p1.y;
@ -51,10 +51,10 @@ library Pairing {
/// The product of a point on G1 and a scalar, i.e. /// The product of a point on G1 and a scalar, i.e.
/// p == p.scalarMul(1) and p.addition(p) == p.scalarMul(2) for all points p. /// p == p.scalarMul(1) and p.addition(p) == p.scalarMul(2) for all points p.
function scalarMul( function multiply(
G1Point memory p, G1Point memory p,
uint s uint s
) internal view returns (G1Point memory r) { ) internal view returns (G1Point memory product) {
uint[3] memory input; uint[3] memory input;
input[0] = p.x; input[0] = p.x;
input[1] = p.y; input[1] = p.y;
@ -164,12 +164,12 @@ contract Groth16Verifier {
input[i] < _SNARK_SCALAR_FIELD, input[i] < _SNARK_SCALAR_FIELD,
"verifier-gte-snark-scalar-field" "verifier-gte-snark-scalar-field"
); );
vkX = Pairing.addition( vkX = Pairing.add(
vkX, vkX,
Pairing.scalarMul(_verifyingKey.ic[i + 1], input[i]) Pairing.multiply(_verifyingKey.ic[i + 1], input[i])
); );
} }
vkX = Pairing.addition(vkX, _verifyingKey.ic[0]); vkX = Pairing.add(vkX, _verifyingKey.ic[0]);
return return
Pairing.pairingProd4( Pairing.pairingProd4(
Pairing.negate(proof.a), Pairing.negate(proof.a),