From dd9c8ccacb661344587f700fd8b896b8872369fc Mon Sep 17 00:00:00 2001 From: Alexander McFarlane Date: Fri, 7 Apr 2023 06:55:18 +0100 Subject: [PATCH] fixes an issue where pairing raises an unexpected exception due to success=0x0 having odd length --- templates/verifier_groth16.sol.ejs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/templates/verifier_groth16.sol.ejs b/templates/verifier_groth16.sol.ejs index 707b2b54..15ba71f6 100644 --- a/templates/verifier_groth16.sol.ejs +++ b/templates/verifier_groth16.sol.ejs @@ -107,10 +107,9 @@ library Pairing { uint[1] memory out; bool success; // solium-disable-next-line security/no-inline-assembly + // precompiled bn128 curve pairing as per EIP197 - defined as contract "8" assembly { success := staticcall(sub(gas(), 2000), 8, add(input, 0x20), mul(inputSize, 0x20), out, 0x20) - // Use "invalid" to make gas estimation work - switch success case 0 { invalid() } } require(success,"pairing-opcode-failed"); return out[0] != 0;