From 309979d7781985758688f7d2fce1c72f3a8264df Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Tue, 23 Apr 2024 14:58:32 +0100 Subject: [PATCH] add check for multi_exp --- tests/core/pyspec/eth2spec/utils/bls.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/core/pyspec/eth2spec/utils/bls.py b/tests/core/pyspec/eth2spec/utils/bls.py index 639bff843..be297d20b 100644 --- a/tests/core/pyspec/eth2spec/utils/bls.py +++ b/tests/core/pyspec/eth2spec/utils/bls.py @@ -230,9 +230,12 @@ def multi_exp(points, integers): Performs a multi-scalar multiplication between `points` and `scalars`. `points` can either be in G1 or G2. - - Note: This method assumes that there is at least one point. """ + # Since this method accepts either G1 or G2, we need to know + # the type of the point to return. Hence, we need at least one point. + if not points or not integers: + raise Exception("Cannot call multi_exp with zero points or zero integers") + if bls == arkworks_bls or bls == fastest_bls: # Convert integers into arkworks Scalars scalars = []