diff --git a/CHANGELOG.md b/CHANGELOG.md index 79be2b3..41e5c5e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ dev: - add "slot" to "proposer duties" command + - add activation epoch and time to "validator info" command where applicable 1.33.0: - show all slots with 'synccommittee inclusion' diff --git a/cmd/validatorinfo.go b/cmd/validatorinfo.go index 1e3da04..ef6d674 100644 --- a/cmd/validatorinfo.go +++ b/cmd/validatorinfo.go @@ -30,6 +30,7 @@ import ( "github.com/pkg/errors" "github.com/spf13/cobra" "github.com/spf13/viper" + standardchaintime "github.com/wealdtech/ethdo/services/chaintime/standard" "github.com/wealdtech/ethdo/util" string2eth "github.com/wealdtech/go-string2eth" ) @@ -53,6 +54,14 @@ In quiet mode this will return 0 if the validator information can be obtained, o }) errCheck(err, "Failed to connect to Ethereum 2 beacon node") + chainTime, err := standardchaintime.New(ctx, + standardchaintime.WithSpecProvider(eth2Client.(eth2client.SpecProvider)), + standardchaintime.WithGenesisTimeProvider(eth2Client.(eth2client.GenesisTimeProvider)), + ) + if err != nil { + errCheck(err, "failed to set up chaintime service") + } + if viper.GetString("validator") == "" { fmt.Println("validator is required") os.Exit(_exitFailure) @@ -84,7 +93,13 @@ In quiet mode this will return 0 if the validator information can be obtained, o } if viper.GetBool("verbose") { if validator.Status.IsPending() { - fmt.Printf("Activation eligibility epoch: %d\n", validator.Validator.ActivationEligibilityEpoch) + if validator.Validator.ActivationEpoch == 0xffffffffffffffff { + fmt.Printf("Activation eligibility epoch: %d\n", validator.Validator.ActivationEligibilityEpoch) + fmt.Printf("Activation eligibility timestamp: %v\n", chainTime.StartOfEpoch(validator.Validator.ActivationEligibilityEpoch)) + } else { + fmt.Printf("Activation epoch: %d\n", validator.Validator.ActivationEpoch) + fmt.Printf("Activation timestamp: %v\n", chainTime.StartOfEpoch(validator.Validator.ActivationEpoch)) + } } if validator.Status.HasActivated() { fmt.Printf("Activation epoch: %d\n", validator.Validator.ActivationEpoch)