diff --git a/gnark/src/main/java/org/hyperledger/besu/nativelib/gnark/LibGnarkEIP2537.java b/gnark/src/main/java/org/hyperledger/besu/nativelib/gnark/LibGnarkEIP2537.java index 176ce8e3..4ea6c489 100644 --- a/gnark/src/main/java/org/hyperledger/besu/nativelib/gnark/LibGnarkEIP2537.java +++ b/gnark/src/main/java/org/hyperledger/besu/nativelib/gnark/LibGnarkEIP2537.java @@ -64,7 +64,8 @@ public static int eip2537_perform_operation( o_len.setValue(128); break; case BLS12_G1MULTIEXP_OPERATION_SHIM_VALUE: - if (i.length <= 192) { + // for pair count <= 2, use straight add/mul loop: + if (i.length <= 192 * 2) { ret = eip2537blsG1MultiExp(i, output, err, i_len, EIP2537_PREALLOCATE_FOR_RESULT_BYTES, EIP2537_PREALLOCATE_FOR_ERROR_BYTES); } else { @@ -87,7 +88,8 @@ public static int eip2537_perform_operation( o_len.setValue(256); break; case BLS12_G2MULTIEXP_OPERATION_SHIM_VALUE: - if (i.length <= 288) { + // for pair count <= 2, use straight add/mul loop: + if (i.length <= 288 * 2) { ret = eip2537blsG2MultiExp(i, output, err, i_len, EIP2537_PREALLOCATE_FOR_RESULT_BYTES, EIP2537_PREALLOCATE_FOR_ERROR_BYTES);