Skip to content

Commit

Permalink
error message consistency
Browse files Browse the repository at this point in the history
Signed-off-by: garyschulte <garyschulte@gmail.com>
  • Loading branch information
garyschulte committed Aug 13, 2024
1 parent c095378 commit 551f2e5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions gnark/gnark-jni/gnark-eip-196.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 551f2e5

Please sign in to comment.