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 <bkomuves@gmail.com>
This commit is contained in:
Mark Spanbroek 2024-03-13 11:23:45 +01:00 committed by markspanbroek
parent 84eba26f76
commit 53999c74d3
1 changed files with 3 additions and 3 deletions

View File

@ -65,7 +65,7 @@ contract Groth16Verifier is IGroth16Verifier {
input[3] = point2.y; input[3] = point2.y;
// solhint-disable-next-line no-inline-assembly // solhint-disable-next-line no-inline-assembly
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; input[2] = scalar;
// solhint-disable-next-line no-inline-assembly // solhint-disable-next-line no-inline-assembly
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 // solhint-disable-next-line no-inline-assembly
assembly { assembly {
success := staticcall(sub(gas(), 2000), 8, input, 768, output, 32) success := staticcall(gas(), 8, input, 768, output, 32)
} }
return (success, output[0]); return (success, output[0]);
} }