From 551f2e54c7a5a8e7c560e64453b2e8a4f812be8b Mon Sep 17 00:00:00 2001 From: garyschulte Date: Tue, 13 Aug 2024 09:44:33 -0700 Subject: [PATCH] error message consistency Signed-off-by: garyschulte --- gnark/gnark-jni/gnark-eip-196.go | 5 ++--- .../gnark/AltBN128PairingPrecompiledContractLegacyTest.java | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/gnark/gnark-jni/gnark-eip-196.go b/gnark/gnark-jni/gnark-eip-196.go index 30a9632e..cd9c792b 100644 --- a/gnark/gnark-jni/gnark-eip-196.go +++ b/gnark/gnark-jni/gnark-eip-196.go @@ -20,7 +20,6 @@ import ( var ErrMalformedPointEIP196 = errors.New("invalid point encoding") var ErrInvalidInputPairingLengthEIP196 = errors.New("invalid input parameters, invalid input length for pairing") var ErrPointNotInFieldEIP196 = errors.New("point not in field") -var ErrPointOnCurveCheckFailedEIP196 = errors.New("point is not on curve") var ErrPointInSubgroupCheckFailedEIP196 = errors.New("point is not in subgroup") const ( @@ -282,7 +281,7 @@ func safeUnmarshalEIP196(g1 *bn254.G1Affine, input []byte, offset int) (error) { } err := g1.Y.SetBytesCanonical(pointBytes[32:64]) if (err == nil) { - if (!g1.IsOnCurve()) { + if (!g1.IsInSubGroup()) { return ErrPointInSubgroupCheckFailedEIP196 } return nil @@ -308,7 +307,7 @@ func safeUnmarshalG2EIP196(g2 *bn254.G2Affine, input []byte) (error) { g2.Y.A1.SetBytesCanonical(input[64:96]) g2.Y.A0.SetBytesCanonical(input[96:128]) if (!g2.IsInSubGroup()) { - return ErrPointOnCurveCheckFailedEIP196 + return ErrPointInSubgroupCheckFailedEIP196 } return nil diff --git a/gnark/src/test/java/org/hyperledger/besu/nativelib/gnark/AltBN128PairingPrecompiledContractLegacyTest.java b/gnark/src/test/java/org/hyperledger/besu/nativelib/gnark/AltBN128PairingPrecompiledContractLegacyTest.java index 48efa2c7..a9aa6c2d 100644 --- a/gnark/src/test/java/org/hyperledger/besu/nativelib/gnark/AltBN128PairingPrecompiledContractLegacyTest.java +++ b/gnark/src/test/java/org/hyperledger/besu/nativelib/gnark/AltBN128PairingPrecompiledContractLegacyTest.java @@ -130,7 +130,7 @@ public void compute_invalidPointsOutsideSubgroupG2() { // assert there is an error assertThat(errorLength.getValue()).isNotEqualTo(0); String errorStr = new String(error, 0, errorLength.getValue()); - assertThat(errorStr).isEqualTo("invalid input parameters, point is not on curve"); + assertThat(errorStr).isEqualTo("invalid input parameters, point is not in subgroup"); // assert there is no output assertThat(outputLength.getValue()).isEqualTo(0); }