Skip to content

Commit 440e714

Browse files
committed
refactor: remove redundant check for pubkey at infinity
1 parent 27cc553 commit 440e714

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

libevm/precompiles/p256verify/p256verify.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,11 @@ func (in *input) verify() bool {
7979
func (in *input) pubkey() (*ecdsa.PublicKey, bool) {
8080
x := in.bigWord(xPos)
8181
y := in.bigWord(yPos)
82-
if x.Sign() == 0 && y.Sign() == 0 {
83-
return nil, false
84-
}
8582

83+
// There is no need to explicitly check for the point at infinity because
84+
// [elliptic.Curve] documentation states that it's not on the curve and the
85+
// check would therefore be performed twice.
86+
// See https://cs.opensource.google/go/go/+/refs/tags/go1.24.3:src/crypto/elliptic/nistec.go;l=132
8687
curve := elliptic.P256()
8788
if !curve.IsOnCurve(x, y) {
8889
return nil, false

0 commit comments

Comments
 (0)