From 53999c74d30890d7069d1f3247ffab8f4a5370be Mon Sep 17 00:00:00 2001 From: Mark Spanbroek Date: Wed, 13 Mar 2024 11:23:45 +0100 Subject: [PATCH] Provide all gas to precompiles Rationale: subtracting 2000 from the provided gas seems arbitrary, and doesn't provide any benefits. Whether verify() fails with an out-of-gas error, or returns 'false', in both cases the proof is not verified. Co-Authored-By: Balazs Komuves --- contracts/Groth16Verifier.sol | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contracts/Groth16Verifier.sol b/contracts/Groth16Verifier.sol index c433177..115caed 100644 --- a/contracts/Groth16Verifier.sol +++ b/contracts/Groth16Verifier.sol @@ -65,7 +65,7 @@ contract Groth16Verifier is IGroth16Verifier { input[3] = point2.y; // solhint-disable-next-line no-inline-assembly assembly { - success := staticcall(sub(gas(), 2000), 6, input, 128, sum, 64) + success := staticcall(gas(), 6, input, 128, sum, 64) } } @@ -83,7 +83,7 @@ contract Groth16Verifier is IGroth16Verifier { input[2] = scalar; // solhint-disable-next-line no-inline-assembly assembly { - success := staticcall(sub(gas(), 2000), 7, input, 96, product, 64) + success := staticcall(gas(), 7, input, 96, product, 64) } } @@ -134,7 +134,7 @@ contract Groth16Verifier is IGroth16Verifier { // solhint-disable-next-line no-inline-assembly assembly { - success := staticcall(sub(gas(), 2000), 8, input, 768, output, 32) + success := staticcall(gas(), 8, input, 768, output, 32) } return (success, output[0]); }