This commit is contained in:
Jim McDonald
2024-03-04 16:34:21 +00:00
parent 697b6d4230
commit 564228ff00
53 changed files with 53 additions and 52 deletions

View File

@@ -158,6 +158,7 @@ linters:
- nlreturn
- nolintlint
- nosnakecase
- perfsprint
- promlinter
- rowserrcheck
- scopelint

View File

@@ -29,7 +29,7 @@ var accountCreateCmd = &cobra.Command{
ethdo account create --account="primary/operations" --passphrase="my secret"
In quiet mode this will return 0 if the account is created successfully, otherwise 1.`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
res, err := accountcreate.Run(cmd)
if err != nil {
return err

View File

@@ -29,7 +29,7 @@ var accountDeriveCmd = &cobra.Command{
ethdo account derive --mnemonic="..." --path="m/12381/3600/0/0"
In quiet mode this will return 0 if the inputs can derive an account account, otherwise 1.`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
res, err := accountderive.Run(cmd)
if err != nil {
return err

View File

@@ -29,7 +29,7 @@ var accountImportCmd = &cobra.Command{
ethdo account import --account="primary/testing" --key="0x..." --passphrase="my secret"
In quiet mode this will return 0 if the account is imported successfully, otherwise 1.`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
res, err := accountimport.Run(cmd)
if err != nil {
return err

View File

@@ -33,7 +33,7 @@ var accountInfoCmd = &cobra.Command{
ethdo account info --account="primary/my funds"
In quiet mode this will return 0 if the account exists, otherwise 1.`,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
ctx, cancel := context.WithTimeout(context.Background(), viper.GetDuration("timeout"))
defer cancel()

View File

@@ -30,7 +30,7 @@ var accountKeyCmd = &cobra.Command{
ethdo account key --account="Personal wallet/Operations" --passphrase="my account passphrase"
In quiet mode this will return 0 if the key can be obtained, otherwise 1.`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
res, err := accountkey.Run(cmd)
if err != nil {
return err

View File

@@ -29,7 +29,7 @@ var accountLockCmd = &cobra.Command{
ethdo account lock --account="primary/my funds"
In quiet mode this will return 0 if the account is locked, otherwise 1.`,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
ctx, cancel := context.WithTimeout(context.Background(), viper.GetDuration("timeout"))
defer cancel()

View File

@@ -30,7 +30,7 @@ var accountUnlockCmd = &cobra.Command{
ethdo account unlock --account="primary/my funds" --passphrase="secret"
In quiet mode this will return 0 if the account is unlocked, otherwise 1.`,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
ctx, cancel := context.WithTimeout(context.Background(), viper.GetDuration("timeout"))
defer cancel()

View File

@@ -29,7 +29,7 @@ var attesterDutiesCmd = &cobra.Command{
ethdo attester duties --validator=Validators/00001 --epoch=12345
In quiet mode this will return 0 if a duty from the attester is found, otherwise 1.`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
res, err := attesterduties.Run(cmd)
if err != nil {
return err

View File

@@ -29,7 +29,7 @@ var attesterInclusionCmd = &cobra.Command{
ethdo attester inclusion --validator=Validators/00001 --epoch=12345
In quiet mode this will return 0 if an attestation from the attester is found on the block of the given epoch, otherwise 1.`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
res, err := attesterinclusion.Run(cmd)
if err != nil {
return err

View File

@@ -29,7 +29,7 @@ var blockAnalyzeCmd = &cobra.Command{
ethdo block analyze --blockid=12345
In quiet mode this will return 0 if the block information is present and not skipped, otherwise 1.`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
res, err := blockanalyze.Run(cmd)
if err != nil {
return err

View File

@@ -29,7 +29,7 @@ var blockInfoCmd = &cobra.Command{
ethdo block info --blockid=12345
In quiet mode this will return 0 if the block information is present and not skipped, otherwise 1.`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
res, err := blockinfo.Run(cmd)
if err != nil {
return err

View File

@@ -31,7 +31,7 @@ var chainEth1VotesCmd = &cobra.Command{
Note that this will fetch the votes made in blocks up to the end of the provided epoch.
In quiet mode this will return 0 if there is a majority for the votes, otherwise 1.`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
res, err := chaineth1votes.Run(cmd)
if err != nil {
return err

View File

@@ -35,7 +35,7 @@ var chainInfoCmd = &cobra.Command{
ethdo chain info
In quiet mode this will return 0 if the chain information can be obtained, otherwise 1.`,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
ctx := context.Background()
eth2Client, err := util.ConnectToBeaconNode(ctx, &util.ConnectOpts{

View File

@@ -29,7 +29,7 @@ var chainQueuesCmd = &cobra.Command{
ethdo chain queues
In quiet mode this will return 0 if the entry and exit queues are 0, otherwise 1.`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
res, err := chainqueues.Run(cmd)
if err != nil {
return err

View File

@@ -37,7 +37,7 @@ var chainSpecCmd = &cobra.Command{
ethdo chain spec
In quiet mode this will return 0 if the chain specification can be obtained, otherwise 1.`,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
ctx := context.Background()
eth2Client, err := util.ConnectToBeaconNode(ctx, &util.ConnectOpts{

View File

@@ -40,7 +40,7 @@ var chainStatusCmd = &cobra.Command{
ethdo chain status
In quiet mode this will return 0 if the chain status can be obtained, otherwise 1.`,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
ctx := context.Background()
eth2Client, err := util.ConnectToBeaconNode(ctx, &util.ConnectOpts{

View File

@@ -27,7 +27,7 @@ var chainTimeCmd = &cobra.Command{
Long: `Obtain info about the chain at a given time. For example:
ethdo chain time --slot=12345`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
res, err := chaintime.Run(cmd)
if err != nil {
return err

View File

@@ -28,7 +28,7 @@ var chainVerifySignedContributionAndProofCmd = &cobra.Command{
ethdo chain verify signedcontributionandproof --data=... --validator=...
validator can be an account, a public key or an index.`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
res, err := chainverifysignedcontributionandproof.Run(cmd)
if err != nil {
return err

View File

@@ -50,7 +50,7 @@ var depositVerifyCmd = &cobra.Command{
The deposit data is compared to the supplied withdrawal account/public key, validator public key, and value to ensure they match.
In quiet mode this will return 0 if the data is verified correctly, otherwise 1.`,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
assert(depositVerifyData != "", "--data is required")
var data []byte
var err error

View File

@@ -29,7 +29,7 @@ var epochSummaryCmd = &cobra.Command{
ethdo epoch summary --epoch=12345
In quiet mode this will return 0 if information for the epoch is found, otherwise 1.`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
res, err := epochsummary.Run(cmd)
if err != nil {
return err

View File

@@ -39,7 +39,7 @@ var exitVerifyCmd = &cobra.Command{
ethdo exit verify --signed-operation=exitdata.json --validator=primary/current
In quiet mode this will return 0 if the exit is verified correctly, otherwise 1.`,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
ctx := context.Background()
assert(viper.GetString("signed-operation") != "", "signed-operation is required")

View File

@@ -27,7 +27,7 @@ var nodeEventsCmd = &cobra.Command{
Long: `Report events from a node. For example:
ethdo node events --events=head,chain_reorg.`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
res, err := nodeevents.Run(cmd)
if err != nil {
return err

View File

@@ -33,7 +33,7 @@ var nodeInfoCmd = &cobra.Command{
ethdo node info
In quiet mode this will return 0 if the node information can be obtained, otherwise 1.`,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
ctx := context.Background()
eth2Client, err := util.ConnectToBeaconNode(ctx, &util.ConnectOpts{

View File

@@ -29,7 +29,7 @@ var proposerDutiesCmd = &cobra.Command{
ethdo proposer duties --epoch=12345
In quiet mode this will return 0 if duties can be obtained, otherwise 1.`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
res, err := proposerduties.Run(cmd)
if err != nil {
return err

View File

@@ -40,7 +40,7 @@ var signatureAggregateCmd = &cobra.Command{
Signatures are specified as "signature" for simple aggregation, and as "id:signature" for threshold aggregation.
In quiet mode this will return 0 if the signatures can be aggregated, otherwise 1.`,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
assert(len(signatureAggregateSignatures) > 1, "multiple signatures required to aggregate")
var signature *bls.Sign
var err error

View File

@@ -36,7 +36,7 @@ var signatureSignCmd = &cobra.Command{
ethdo signature sign --data=0x5f24e819400c6a8ee2bfc014343cd971b7eb707320025a7bcd83e621e26c35b7 --account="Personal wallet/Operations" --passphrase="my account passphrase"
In quiet mode this will return 0 if the data can be signed, otherwise 1.`,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
ctx, cancel := context.WithTimeout(context.Background(), viper.GetDuration("timeout"))
defer cancel()

View File

@@ -41,7 +41,7 @@ var signatureVerifyCmd = &cobra.Command{
ethdo signature verify --data=0x5f24e819400c6a8ee2bfc014343cd971b7eb707320025a7bcd83e621e26c35b7 --signature=0x8888... --account="Personal wallet/Operations"
In quiet mode this will return 0 if the data can be signed, otherwise 1.`,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
ctx, cancel := context.WithTimeout(context.Background(), viper.GetDuration("timeout"))
defer cancel()

View File

@@ -29,7 +29,7 @@ var slotTimeCmd = &cobra.Command{
ethdo slot time --slot=12345
In quiet mode this will return 0.`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
res, err := slottime.Run(cmd)
if err != nil {
return err

View File

@@ -31,7 +31,7 @@ var synccommitteeInclusionCmd = &cobra.Command{
In quiet mode this will return 0 if the validator was in the sync committee, otherwise 1.
epoch can be a specific epoch; If not supplied all slots for the current sync committee period will be provided`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
res, err := synccommitteeinclusion.Run(cmd)
if err != nil {
return err

View File

@@ -31,7 +31,7 @@ var synccommitteeMembersCmd = &cobra.Command{
In quiet mode this will return 0 if the synccommittee members are found, otherwise 1.
epoch can be a specific epoch. period can be 'current' for the current sync period or 'next' for the next sync period`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
res, err := synccommitteemembers.Run(cmd)
if err != nil {
return err

View File

@@ -29,7 +29,7 @@ var validatorCredentialsGetCmd = &cobra.Command{
ethdo validator credentials get --validator=primary/validator
In quiet mode this will return 0 if the validator exists, otherwise 1.`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
res, err := validatorcredentialsget.Run(cmd)
if err != nil {
return err

View File

@@ -38,7 +38,7 @@ The validator account can be specified in one of a number of ways:
- account and withdrawal account using --account and --withdrawal-account; this will generate a single operation
In quiet mode this will return 0 if the credentials operation has been generated (and successfully broadcast if online), otherwise 1.`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
res, err := validatorcredentialsset.Run(cmd)
if err != nil {
return err

View File

@@ -33,7 +33,7 @@ If validatoraccount is provided with an account path it will generate deposit da
The information generated can be passed to ethereal to create a deposit from the Ethereum 1 chain.
In quiet mode this will return 0 if the data can be generated correctly, otherwise 1.`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
res, err := validatordepositdata.Run(cmd)
if err != nil {
return err

View File

@@ -31,7 +31,7 @@ var validatorDutiesCmd = &cobra.Command{
Attester duties are known for the current and next epoch. Proposer duties are known for the current epoch.
In quiet mode this will return 0 if the duties have been obtained, otherwise 1.`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
res, err := validatorduties.Run(cmd)
if err != nil {
return err

View File

@@ -39,7 +39,7 @@ The validator and key can be specified in one of a number of ways:
- validator account using --validator
In quiet mode this will return 0 if the exit operation has been generated (and successfully broadcast if online), otherwise 1.`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
res, err := validatorexit.Run(cmd)
if err != nil {
return err

View File

@@ -28,7 +28,7 @@ var validatorExpectationCmd = &cobra.Command{
Long: `Calculate expectation for individual validators. For example:
ethdo validator expectation`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
res, err := validatorexpectation.Run(cmd)
if err != nil {
return err

View File

@@ -43,7 +43,7 @@ var validatorInfoCmd = &cobra.Command{
ethdo validator info --validator=primary/validator
In quiet mode this will return 0 if the validator information can be obtained, otherwise 1.`,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
ctx := context.Background()
eth2Client, err := util.ConnectToBeaconNode(ctx, &util.ConnectOpts{

View File

@@ -31,7 +31,7 @@ var validatorKeycheckCmd = &cobra.Command{
A mnemonic can be used in place of a private key, in which case the first 1,024 indices of the standard withdrawal key path will be scanned for a matching key.
In quiet mode this will return 0 if the withdrawal credentials match the key, otherwise 1.`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
res, err := validatorkeycheck.Run(cmd)
if err != nil {
return err

View File

@@ -29,7 +29,7 @@ var validatorSummaryCmd = &cobra.Command{
ethdo validator summary --validators=1,2,3 --epoch=12345
In quiet mode this will return 0 if information for the epoch is found, otherwise 1.`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
res, err := validatorsummary.Run(cmd)
if err != nil {
return err

View File

@@ -29,7 +29,7 @@ var validatorWithdrawalCmd = &cobra.Command{
ethdo validator withdrawal --validator=primary/validator
In quiet mode this will return 0 if the validator exists, otherwise 1.`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
res, err := validatorwithdrawal.Run(cmd)
if err != nil {
return err

View File

@@ -30,7 +30,7 @@ var validatorYieldCmd = &cobra.Command{
ethdo validator yield
It is important to understand the yield is both probabilistic and dependent on network conditions.`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
res, err := validatoryield.Run(cmd)
if err != nil {
return err

View File

@@ -33,7 +33,7 @@ var versionCmd = &cobra.Command{
Long: `Obtain the version of ethdo. For example:
ethdo version`,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
fmt.Println(ReleaseVersion)
if viper.GetBool("verbose") {
if info, ok := debug.ReadBuildInfo(); ok {

View File

@@ -34,7 +34,7 @@ var walletAccountsCmd = &cobra.Command{
ethdo wallet accounts --wallet=primary
In quiet mode this will return 0 if the wallet holds any addresses, otherwise 1.`,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
ctx, cancel := context.WithTimeout(context.Background(), viper.GetDuration("timeout"))
defer cancel()

View File

@@ -29,7 +29,7 @@ var walletBatchCmd = &cobra.Command{
ethdo wallet batch --wallet="Primary wallet" --passphrase=accounts-secret --batch-passphrase=batch-secret
In quiet mode this will return 0 if the wallet is batched successfully, otherwise 1.`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
res, err := walletbatch.Run(cmd)
if err != nil {
return err

View File

@@ -29,7 +29,7 @@ var walletCreateCmd = &cobra.Command{
ethdo wallet create --wallet="Primary wallet" --type=non-deterministic
In quiet mode this will return 0 if the wallet is created successfully, otherwise 1.`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
res, err := walletcreate.Run(cmd)
if err != nil {
return err

View File

@@ -28,7 +28,7 @@ var walletDeleteCmd = &cobra.Command{
ethdo wallet delete --wallet=primary
In quiet mode this will return 0 if the wallet has been deleted, otherwise 1.`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
res, err := walletdelete.Run(cmd)
if err != nil {
return err

View File

@@ -28,7 +28,7 @@ var walletExportCmd = &cobra.Command{
ethdo wallet export --wallet=primary --passphrase="my export secret"
In quiet mode this will return 0 if the wallet is able to be exported, otherwise 1.`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
res, err := walletexport.Run(cmd)
if err != nil {
return err

View File

@@ -29,7 +29,7 @@ var walletImportCmd = &cobra.Command{
ethdo wallet import --data=primary --passphrase="my export secret"
In quiet mode this will return 0 if the wallet is imported successfully, otherwise 1.`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
res, err := walletimport.Run(cmd)
if err != nil {
return err

View File

@@ -32,7 +32,7 @@ var walletInfoCmd = &cobra.Command{
ethdo wallet info --wallet=primary
In quiet mode this will return 0 if the wallet exists, otherwise 1.`,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
ctx, cancel := context.WithTimeout(context.Background(), viper.GetDuration("timeout"))
defer cancel()

View File

@@ -30,7 +30,7 @@ var walletListCmd = &cobra.Command{
ethdo wallet list
In quiet mode this will return 0 if any wallets are found, otherwise 1.`,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
assert(viper.GetString("remote") == "", "wallet list not available with remote wallets")
assert(viper.GetString("wallet") == "", "wallet list does not take a --wallet parameter")

View File

@@ -27,7 +27,7 @@ var walletSharedExportCmd = &cobra.Command{
Long: `Export a wallet for backup of transfer using Shamir secret sharing. For example:
ethdo wallet sharedexport --wallet=primary --participants=5 --threshold=3 --file=backup.dat`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
res, err := walletsharedexport.Run(cmd)
if err != nil {
return err

View File

@@ -29,7 +29,7 @@ var walletSharedImportCmd = &cobra.Command{
ethdo wallet sharedimport --file=backup.dat --shares="1234 2345 3456"
In quiet mode this will return 0 if the wallet is imported successfully, otherwise 1.`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
res, err := walletsharedimport.Run(cmd)
if err != nil {
return err