From 7d00d1261f487b830d8b196bc1a26ddef9c1d6e5 Mon Sep 17 00:00:00 2001 From: Jim McDonald Date: Tue, 22 Oct 2024 22:55:08 +0100 Subject: [PATCH] Avoid crash when signing and verifing signatures using keys rather than accounts. --- CHANGELOG.md | 3 +++ cmd/signaturesign.go | 3 +++ cmd/signatureverify.go | 5 +++++ cmd/version.go | 2 +- 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c1a242b..9278187 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +1.36.2: + - avoid crash when signing and verifing signatures using keys rather than accounts + 1.36.1: - more JSON data for epoch summary - fix crash when block ifno had no blobs diff --git a/cmd/signaturesign.go b/cmd/signaturesign.go index 17d49a9..603b90c 100644 --- a/cmd/signaturesign.go +++ b/cmd/signaturesign.go @@ -19,6 +19,7 @@ import ( "os" spec "github.com/attestantio/go-eth2-client/spec/phase0" + "github.com/pkg/errors" "github.com/spf13/cobra" "github.com/spf13/viper" "github.com/wealdtech/ethdo/util" @@ -59,6 +60,8 @@ In quiet mode this will return 0 if the data can be signed, otherwise 1.`, account, err = util.ParseAccount(ctx, viper.GetString("account"), util.GetPassphrases(), true) case viper.GetString("private-key") != "": account, err = util.ParseAccount(ctx, viper.GetString("private-key"), nil, true) + default: + err = errors.New("account or private key must be supplied") } errCheck(err, "Failed to obtain account") diff --git a/cmd/signatureverify.go b/cmd/signatureverify.go index 4f60938..3cf8c41 100644 --- a/cmd/signatureverify.go +++ b/cmd/signatureverify.go @@ -19,6 +19,7 @@ import ( "os" spec "github.com/attestantio/go-eth2-client/spec/phase0" + "github.com/pkg/errors" "github.com/spf13/cobra" "github.com/spf13/viper" "github.com/wealdtech/ethdo/util" @@ -71,6 +72,10 @@ In quiet mode this will return 0 if the data can be signed, otherwise 1.`, account, err = util.ParseAccount(ctx, viper.GetString("private-key"), nil, false) case viper.GetString("public-key") != "": account, err = util.ParseAccount(ctx, viper.GetString("public-key"), nil, false) + case signatureVerifySigner != "": + account, err = util.ParseAccount(ctx, signatureVerifySigner, nil, false) + default: + err = errors.New("one of account, private-key, public-key, or signer must be supplied") } errCheck(err, "Failed to obtain account") outputIf(viper.GetBool("debug"), fmt.Sprintf("Public key is %#x", account.PublicKey().Marshal())) diff --git a/cmd/version.go b/cmd/version.go index 50bea78..2c41e11 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -24,7 +24,7 @@ import ( // ReleaseVersion is the release version of the codebase. // Usually overridden by tag names when building binaries. -var ReleaseVersion = "local build (latest release 1.36.1)" +var ReleaseVersion = "local build (latest release 1.36.2)" // versionCmd represents the version command. var versionCmd = &cobra.Command{