From c55b34fc76f0e71d0786cbdfded1c9705412393f Mon Sep 17 00:00:00 2001 From: Mark Spanbroek Date: Wed, 31 Jan 2024 11:55:32 +0100 Subject: [PATCH] uint -> uint256 Co-Authored-By: Balazs Komuves --- contracts/Groth16.sol | 10 +++++----- contracts/Groth16Verifier.sol | 18 +++++++++--------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/contracts/Groth16.sol b/contracts/Groth16.sol index 8e92e34..d392566 100644 --- a/contracts/Groth16.sol +++ b/contracts/Groth16.sol @@ -2,16 +2,16 @@ pragma solidity 0.8.23; struct G1Point { - uint x; - uint y; + uint256 x; + uint256 y; } // A field element F_{p^2} encoded as `real + i * imag`. // We chose to not represent this as an array of 2 numbers, because both Circom // and Ethereum EIP-197 encode to an array, but with conflicting encodings. struct Fp2Element { - uint real; - uint imag; + uint256 real; + uint256 imag; } struct G2Point { @@ -28,6 +28,6 @@ struct Groth16Proof { interface IGroth16Verifier { function verify( Groth16Proof calldata proof, - uint[] calldata pubSignals + uint256[] calldata pubSignals ) external view returns (bool); } diff --git a/contracts/Groth16Verifier.sol b/contracts/Groth16Verifier.sol index cb17175..4a99100 100644 --- a/contracts/Groth16Verifier.sol +++ b/contracts/Groth16Verifier.sol @@ -21,7 +21,7 @@ pragma solidity 0.8.23; import "./Groth16.sol"; contract Groth16Verifier is IGroth16Verifier { - uint private constant _P = + uint256 private constant _P = 21888242871839275222246405745257275088696311157297823662689037894645226208583; uint256 private constant _R = 21888242871839275222246405745257275088548364400416034343698204186575808495617; @@ -54,7 +54,7 @@ contract Groth16Verifier is IGroth16Verifier { G1Point memory point1, G1Point memory point2 ) private view returns (bool success, G1Point memory sum) { - uint[4] memory input; + uint256[4] memory input; input[0] = point1.x; input[1] = point1.y; input[2] = point2.x; @@ -67,9 +67,9 @@ contract Groth16Verifier is IGroth16Verifier { function _multiply( G1Point memory point, - uint scalar + uint256 scalar ) private view returns (bool success, G1Point memory product) { - uint[3] memory input; + uint256[3] memory input; input[0] = point.x; input[1] = point.y; input[2] = scalar; @@ -88,9 +88,9 @@ contract Groth16Verifier is IGroth16Verifier { G2Point memory c2, G1Point memory d1, G2Point memory d2 - ) private view returns (bool success, uint outcome) { - uint[24] memory input; // 4 pairs of G1 and G2 points - uint[1] memory output; + ) private view returns (bool success, uint256 outcome) { + uint256[24] memory input; // 4 pairs of G1 and G2 points + uint256[1] memory output; input[0] = a1.x; input[1] = a1.y; @@ -129,7 +129,7 @@ contract Groth16Verifier is IGroth16Verifier { function verify( Groth16Proof calldata proof, - uint[] memory input + uint256[] memory input ) public view returns (bool success) { // Check amount of public inputs if (input.length + 1 != _verifyingKey.ic.length) { @@ -155,7 +155,7 @@ contract Groth16Verifier is IGroth16Verifier { } } // Check the pairing - uint outcome; + uint256 outcome; (success, outcome) = _checkPairing( _negate(proof.a), proof.b,