Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions clientcontroller/babylon.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package clientcontroller

import (
"context"
"errors"
"fmt"
"math"
"time"
Expand Down Expand Up @@ -108,7 +109,7 @@ func (bc *BabylonController) QueryStakingParamsByVersion(version uint32) (*types
for _, pk := range stakingParamRes.Params.CovenantPks {
covPk, err := pk.ToBTCPK()
if err != nil {
return nil, fmt.Errorf("invalid covenant public key")
return nil, errors.New("invalid covenant public key")
}
covenantPks = append(covenantPks, covPk)
}
Expand Down Expand Up @@ -242,11 +243,11 @@ func DelegationRespToDelegation(del *btcstakingtypes.BTCDelegationResponse) (*ty
)

if del.StakingTxHex == "" {
return nil, fmt.Errorf("staking tx should not be empty in delegation")
return nil, errors.New("staking tx should not be empty in delegation")
}

if del.SlashingTxHex == "" {
return nil, fmt.Errorf("slashing tx should not be empty in delegation")
return nil, errors.New("slashing tx should not be empty in delegation")
}

for _, s := range del.CovenantSigs {
Expand All @@ -270,7 +271,7 @@ func DelegationRespToDelegation(del *btcstakingtypes.BTCDelegationResponse) (*ty
}

if del.UnbondingTime > uint32(math.MaxUint16) {
return nil, fmt.Errorf("unbonding time should be smaller than max uint16")
return nil, errors.New("unbonding time should be smaller than max uint16")
}

if del.TotalSat > uint64(math.MaxInt64) {
Expand Down Expand Up @@ -301,11 +302,11 @@ func UndelegationRespToUndelegation(undel *btcstakingtypes.BTCUndelegationRespon
)

if undel.UnbondingTxHex == "" {
return nil, fmt.Errorf("staking tx should not be empty in undelegation")
return nil, errors.New("staking tx should not be empty in undelegation")
}

if undel.SlashingTxHex == "" {
return nil, fmt.Errorf("slashing tx should not be empty in undelegation")
return nil, errors.New("slashing tx should not be empty in undelegation")
}

for _, unbondingSig := range undel.CovenantUnbondingSigList {
Expand Down
5 changes: 3 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package config

import (
"errors"
"fmt"
"path/filepath"
"time"
Expand Down Expand Up @@ -90,11 +91,11 @@ func LoadConfig(homePath string) (*Config, error) {
// normalized. The cleaned up config is returned on success.
func (cfg *Config) Validate() error {
if cfg.Metrics == nil {
return fmt.Errorf("empty metrics config")
return errors.New("empty metrics config")
}

if err := cfg.Metrics.Validate(); err != nil {
return fmt.Errorf("invalid metrics config")
return errors.New("invalid metrics config")
}

switch cfg.BitcoinNetwork {
Expand Down
2 changes: 1 addition & 1 deletion covenant-signer/cmd/signerCmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ var runSignerCmd = &cobra.Command{
}
prk = kr
} else {
return fmt.Errorf("unknown key store type")
return errors.New("unknown key store type")
}

app := signerapp.NewSignerApp(
Expand Down
8 changes: 5 additions & 3 deletions covenant-signer/config/keystore.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package config

import "fmt"
import (
"errors"
)

type KeyStoreType int

Expand All @@ -13,7 +15,7 @@ func KeyStoreToString(c KeyStoreType) (string, error) {
case CosmosKeyStore:
return "cosmos", nil
default:
return "", fmt.Errorf("unknown key store type")
return "", errors.New("unknown key store type")
}
}

Expand All @@ -22,7 +24,7 @@ func KeyStoreFromString(s string) (KeyStoreType, error) {
case "cosmos":
return CosmosKeyStore, nil
default:
return -1, fmt.Errorf("unknown key store type")
return -1, errors.New("unknown key store type")
}
}

Expand Down
3 changes: 2 additions & 1 deletion covenant-signer/keystore/cosmos/cosmoskeyretriever.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cosmos

import (
"context"
"errors"
"fmt"
"strings"
"sync"
Expand Down Expand Up @@ -41,7 +42,7 @@ func (k *CosmosKeyringRetriever) PrivKey(ctx context.Context) (*btcec.PrivateKey
defer k.mu.Unlock()

if k.btcecPrivKey == nil {
return nil, fmt.Errorf("private key is not unlocked. Please call Unlock() first")
return nil, errors.New("private key is not unlocked. Please call Unlock() first")
}

return k.btcecPrivKey, nil
Expand Down