From a65fe3184298c52e84f6338cbabb0198f5a3877a Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Sat, 12 Oct 2024 16:36:11 +0100 Subject: [PATCH] add note on zero check --- crypto/bn256/gnark/pairing.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/crypto/bn256/gnark/pairing.go b/crypto/bn256/gnark/pairing.go index a9e049111d..b9b6405534 100644 --- a/crypto/bn256/gnark/pairing.go +++ b/crypto/bn256/gnark/pairing.go @@ -19,8 +19,17 @@ func PairingCheck(a_ []*G1, b_ []*G2) bool { a := getInnerG1s(a_) b := getInnerG2s(b_) - // Check if input is empty - if len(a) == 0 { + // Assume that len(a) == len(b) + // + // The pairing function will return + // false, if this is not the case. + size := len(a) + + // Check if input is empty -- gnark will + // return false on an empty input, however + // the ossified behavior is to return true + // on an empty input, so we add this if statement. + if size == 0 { return true }