Allow blockid for validator info.

This commit is contained in:
Jim McDonald
2025-01-31 17:03:48 +00:00
parent 005eed1360
commit 5d95e93b76
4 changed files with 13 additions and 5 deletions

View File

@@ -1,3 +1,6 @@
1.36.6:
- allow specification of blockid for validator info
1.36.5: 1.36.5:
- avoid corner case mnemonic derivation with 25th word - avoid corner case mnemonic derivation with 25th word

View File

@@ -1,4 +1,4 @@
// Copyright © 2020 - 2022 Weald Technology Trading // Copyright © 2020 - 2025 Weald Technology Trading
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
@@ -67,7 +67,7 @@ In quiet mode this will return 0 if the validator information can be obtained, o
os.Exit(_exitFailure) os.Exit(_exitFailure)
} }
validator, err := util.ParseValidator(ctx, eth2Client.(eth2client.ValidatorsProvider), viper.GetString("validator"), "head") validator, err := util.ParseValidator(ctx, eth2Client.(eth2client.ValidatorsProvider), viper.GetString("validator"), viper.GetString("blockid"))
errCheck(err, "Failed to obtain validator") errCheck(err, "Failed to obtain validator")
if viper.GetBool("verbose") { if viper.GetBool("verbose") {
@@ -185,7 +185,8 @@ func graphData(network string, validatorPubKey []byte) (uint64, spec.Gwei, error
func init() { func init() {
validatorCmd.AddCommand(validatorInfoCmd) validatorCmd.AddCommand(validatorInfoCmd)
validatorInfoCmd.Flags().String("validator", "", "Public key for which to obtain status") validatorInfoCmd.Flags().String("validator", "", "ID of the validator")
validatorInfoCmd.Flags().String("blockid", "head", "the block at which to fetch the information")
validatorFlags(validatorInfoCmd) validatorFlags(validatorInfoCmd)
} }
@@ -193,4 +194,7 @@ func validatorInfoBindings(cmd *cobra.Command) {
if err := viper.BindPFlag("validator", cmd.Flags().Lookup("validator")); err != nil { if err := viper.BindPFlag("validator", cmd.Flags().Lookup("validator")); err != nil {
panic(err) panic(err)
} }
if err := viper.BindPFlag("blockid", cmd.Flags().Lookup("blockid")); err != nil {
panic(err)
}
} }

View File

@@ -1,4 +1,4 @@
// Copyright © 2019 - 2024 Weald Technology Trading. // Copyright © 2019 - 2025 Weald Technology Trading.
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
@@ -24,7 +24,7 @@ import (
// ReleaseVersion is the release version of the codebase. // ReleaseVersion is the release version of the codebase.
// Usually overridden by tag names when building binaries. // Usually overridden by tag names when building binaries.
var ReleaseVersion = "local build (latest release 1.36.5)" var ReleaseVersion = "local build (latest release 1.36.6)"
// versionCmd represents the version command. // versionCmd represents the version command.
var versionCmd = &cobra.Command{ var versionCmd = &cobra.Command{

View File

@@ -682,6 +682,7 @@ $ ethdo validator exit --private-key=0x01e748d098d3bcb477d636f19d510399ae18205fa
`ethdo validator info` provides information for a given validator. Options include: `ethdo validator info` provides information for a given validator. Options include:
- `validator`: the validator for which to obtain information, as a [validator specifier](https://github.com/wealdtech/ethdo#validator-specifier) - `validator`: the validator for which to obtain information, as a [validator specifier](https://github.com/wealdtech/ethdo#validator-specifier)
- `blockid`: the ID (slot, root, 'head') of the block at which to obtain information
```sh ```sh
$ ethdo validator info --validator=Validators/1 $ ethdo validator info --validator=Validators/1