You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While updating to go 1.24, some existing code triggered a panic during signing. The panic is caused because stdlib crypto code expects fields of the public component of a private key to be present.
Steps to Reproduce
package flowpanic_test
import (
"testing"
"github.com/onflow/flow-go-sdk/crypto"
)
func TestSign(t *testing.T) {
privateKey, err := crypto.GeneratePrivateKey(crypto.ECDSA_P256, make([]byte, 32))
if err != nil {
t.Fatal(err)
}
// privateKey.PublicKey() // necessary on go 1.24 to avoid panic
signer, err := crypto.NewInMemorySigner(privateKey, crypto.SHA3_256)
if err != nil {
t.Fatal(err)
}
_, err = signer.Sign([]byte("some message"))
if err != nil {
t.Fatal(err)
}
}
Instructions
I created a minimal reproduction here using flow-go-sdk v1.3.3: https://github.com/sul3n3t/flow-panic
Problem
While updating to go 1.24, some existing code triggered a panic during signing. The panic is caused because stdlib crypto code expects fields of the public component of a private key to be present.
Steps to Reproduce
Results in
Acceptance Criteria
The test is expected to pass without calling the
.PublicKey()
methodContext
I came across this while updating go in a much larger repo. I have a workaround by calling
crypto.PrivateKey#PublicKey()
.The text was updated successfully, but these errors were encountered: