Avoid crash when signing and verifing signatures using keys rather than accounts.

This commit is contained in:
Jim McDonald
2024-10-22 22:55:08 +01:00
parent ac85a9539b
commit 7d00d1261f
4 changed files with 12 additions and 1 deletions

View File

@@ -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

View File

@@ -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")

View File

@@ -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()))

View File

@@ -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{