Fix curve (#429)

* update secp256k1 library from go-eth code

* cast deprecated functions to use new BitCurve type

* add IsOnCurve checks and tests

* add test outcome check

* fix test
This commit is contained in:
Wanwiset Peerapatanapokin 2024-02-11 15:59:28 +04:00 committed by GitHub
parent bbd7d00068
commit b272e7418c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -231,7 +231,7 @@ func TestOnCurveDeserialize(t *testing.T) {
}
func TestCurveScalarMult(t *testing.T) {
curve := crypto.S256()
curve := crypto.S256().(*secp256k1.BitCurve)
x, y := curve.ScalarBaseMult(curve.Params().N.Bytes())
if x == nil && y == nil {
@ -262,13 +262,7 @@ func TestNilPointerDereferencePanic(t *testing.T) {
t.Error("Failed to Serialize input Ring signature")
}
deserializedSig, err := Deserialize(sig)
if err != nil {
t.Error("Failed to Deserialize Ring signature")
}
verified := Verify(deserializedSig, false)
if verified {
t.Error("Should failed to verify Ring signature as the signature is invalid")
}
_ , err = Deserialize(sig)
// Should failed to verify Ring signature as the signature is invalid
assert.EqualError(t, err, "failed to deserialize, invalid ring signature")
}