@@ -6,8 +6,8 @@ pragma solidity ^0.8.23;
66library BLSHelper {
77
88 struct XY {
9- uint x;
10- uint y;
9+ uint256 x;
10+ uint256 y;
1111 }
1212 /**
1313 * sum all the points in the array
@@ -17,11 +17,11 @@ library BLSHelper {
1717 * @return ret the sum of all points
1818 */
1919 function sum (XY[] memory points , uint256 _pp ) internal pure returns (XY memory ret ){
20- uint x = points[0 ].x;
21- uint y = points[0 ].y;
22- uint z = 1 ;
20+ uint256 x = points[0 ].x;
21+ uint256 y = points[0 ].y;
22+ uint256 z = 1 ;
2323
24- for (uint i = 1 ; i < points.length ; i++ ) {
24+ for (uint256 i = 1 ; i < points.length ; i++ ) {
2525 (x, y, z) = jacAdd (x, y, z, points[i].x, points[i].y, 1 , _pp);
2626 }
2727 (x, y) = toAffine (x, y, z, _pp);
@@ -54,7 +54,7 @@ library BLSHelper {
5454 return (_x1, _y1, _z1);
5555
5656 // We follow the equations described in https://pdfs.semanticscholar.org/5c64/29952e08025a9649c2b0ba32518e9a7fb5c2.pdf Section 5
57- uint [4 ] memory zs;
57+ uint256 [4 ] memory zs;
5858 // z1^2, z1^3, z2^2, z2^3
5959 zs[0 ] = mulmod (_z1, _z1, _pp);
6060 zs[1 ] = mulmod (_z1, zs[0 ], _pp);
@@ -72,7 +72,7 @@ library BLSHelper {
7272 // In case of zs[0] == zs[2] && zs[1] == zs[3], double function should be used
7373 require (zs[0 ] != zs[2 ] || zs[1 ] != zs[3 ], "Use jacDouble function instead " );
7474
75- uint [4 ] memory hr;
75+ uint256 [4 ] memory hr;
7676 //h
7777 hr[0 ] = addmod (zs[2 ], _pp - zs[0 ], _pp);
7878 //r
@@ -160,9 +160,9 @@ library BLSHelper {
160160 uint256 z = mulmod (_z, _z, _pp); //z1^2
161161
162162 // s
163- uint s = mulmod (4 , mulmod (_x, y, _pp), _pp);
163+ uint256 s = mulmod (4 , mulmod (_x, y, _pp), _pp);
164164 // m
165- uint m = addmod (mulmod (3 , x, _pp), mulmod (_aa, mulmod (z, z, _pp), _pp), _pp);
165+ uint256 m = addmod (mulmod (3 , x, _pp), mulmod (_aa, mulmod (z, z, _pp), _pp), _pp);
166166
167167 // x, y, z at this point will be reassigned and rather represent qx, qy, qz from the paper
168168 // This allows to reduce the gas cost and stack footprint of the algorithm
@@ -193,9 +193,9 @@ library BLSHelper {
193193 uint256 _pp )
194194 internal pure returns (uint256 , uint256 )
195195 {
196- uint x = 0 ;
197- uint y = 0 ;
198- uint z = 0 ;
196+ uint256 x = 0 ;
197+ uint256 y = 0 ;
198+ uint256 z = 0 ;
199199
200200 // Double if x1==x2 else add
201201 if (_x1 == _x2) {
0 commit comments