Compare commits

..

5 Commits

Author SHA1 Message Date
Jim McDonald
f898466395 Increase timeout for fetching offline preparation. 2023-03-21 08:04:33 +00:00
Jim McDonald
e496fa1977 Do not mask account errors. 2023-03-07 13:50:50 +00:00
Jim McDonald
d016326779 Merge pull request #71 from lastperson/patch-1
Fix the 'credentials set' example.
2023-03-03 11:16:45 +00:00
Oleksii Matiiasevych
ee14b5ee8e Fix the 'credentials set' example. 2023-03-03 14:03:05 +07:00
Jim McDonald
9ae927feab Handle keystore in validator credentials set. 2023-02-27 22:07:45 +00:00
6 changed files with 38 additions and 8 deletions

View File

@@ -1,3 +1,6 @@
dev:
- allow use of keystores with validator credentials set
1.28.4:
- allow validator exit to use a keystore as its validator parameter

View File

@@ -42,7 +42,7 @@ import (
// minTimeout is the minimum timeout for this command.
// It needs to be set here as we want timeouts to be low in general, but this can be pulling
// a lot of data for an unsophisticated audience so it's easier to set a higher timeout..
var minTimeout = 2 * time.Minute
var minTimeout = 5 * time.Minute
// defaultBeaconNode is used if no other connection is supplied.
var defaultBeaconNode = "http://mainnet-consensus.attestant.io/"
@@ -329,7 +329,16 @@ func (c *command) generateOperationsFromAccountAndPrivateKey(ctx context.Context
}
func (c *command) generateOperationsFromValidatorAndPrivateKey(ctx context.Context) error {
validatorInfo, err := c.chainInfo.FetchValidatorInfo(ctx, c.validator)
validatorAccount, err := util.ParseAccount(ctx, c.validator, nil, false)
if err != nil {
return err
}
validatorPubkey, err := util.BestPublicKey(validatorAccount)
if err != nil {
return err
}
validatorInfo, err := c.chainInfo.FetchValidatorInfo(ctx, fmt.Sprintf("%#x", validatorPubkey.Marshal()))
if err != nil {
return err
}
@@ -721,7 +730,7 @@ func (c *command) setup(ctx context.Context) error {
if c.debug {
fmt.Fprintf(os.Stderr, "No node connection, attempting to use %s\n", defaultBeaconNode)
}
c.consensusClient, err = util.ConnectToBeaconNode(ctx, defaultBeaconNode, c.timeout, c.allowInsecureConnections)
c.consensusClient, err = util.ConnectToBeaconNode(ctx, defaultBeaconNode, c.timeout, true)
if err != nil {
return err
}

View File

@@ -41,7 +41,7 @@ import (
// minTimeout is the minimum timeout for this command.
// It needs to be set here as we want timeouts to be low in general, but this can be pulling
// a lot of data for an unsophisticated audience so it's easier to set a higher timeout..
var minTimeout = 2 * time.Minute
var minTimeout = 5 * time.Minute
// validatorPath is the regular expression that matches a validator path.
var validatorPath = regexp.MustCompile("^m/12381/3600/[0-9]+/0/0$")
@@ -51,6 +51,9 @@ var (
exitOperationFilename = "exit-operation.json"
)
// defaultBeaconNode is used if no other connection is supplied.
var defaultBeaconNode = "http://mainnet-consensus.attestant.io/"
func (c *command) process(ctx context.Context) error {
if err := c.setup(ctx); err != nil {
return err
@@ -442,7 +445,22 @@ func (c *command) setup(ctx context.Context) error {
var err error
c.consensusClient, err = util.ConnectToBeaconNode(ctx, c.connection, c.timeout, c.allowInsecureConnections)
if err != nil {
return errors.Wrap(err, "failed to connect to consensus node")
if c.connection != "" {
// The user provided a connection, so don't second-guess them by using a different node.
return err
}
// The user did not provide a connection, so attempt to use the default node.
if c.debug {
fmt.Fprintf(os.Stderr, "No node connection, attempting to use %s\n", defaultBeaconNode)
}
c.consensusClient, err = util.ConnectToBeaconNode(ctx, defaultBeaconNode, c.timeout, true)
if err != nil {
return err
}
if !c.quiet {
fmt.Fprintf(os.Stderr, "No connection supplied; using mainnet public access endpoint\n")
}
}
// Set up chaintime.

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.28.4)"
var ReleaseVersion = "local build (latest release 1.28.5)"
// versionCmd represents the version command.
var versionCmd = &cobra.Command{

View File

@@ -592,7 +592,7 @@ $ ethdo validator credentials get --validator=Validators/1
`ethdo validator credentials set` updates withdrawal credentials from BLS "type 0" credentials to execution "type 1" credentials. Full information about using this command can be found in the [specific documentation](./changingwithdrawalcredentials.md).
```sh
$ ethdo validator credentials set --validator=Validators/1 --execution-address=0x8f…9F --private-key=0x3b…9c
$ ethdo validator credentials set --validator=Validators/1 --withdrawal-address=0x8f…9F --private-key=0x3b…9c
```
#### `depositdata`

View File

@@ -52,7 +52,7 @@ func ParseAccount(ctx context.Context,
account, err := parseAccountFromSpecifier(ctx, accountStr, supplementary, unlock)
if err != nil {
// It is possible that this is actually a path to a keystore, so try that instead.
if _, err = os.Stat(accountStr); err == nil {
if _, statErr := os.Stat(accountStr); statErr == nil {
account, err = parseAccountFromKeystorePath(ctx, accountStr, supplementary, unlock)
}
}