diff --git a/client/grpc/oracle/proof/proof.go b/client/grpc/oracle/proof/proof.go index 4d2d33f27..66de4e9f4 100644 --- a/client/grpc/oracle/proof/proof.go +++ b/client/grpc/oracle/proof/proof.go @@ -149,7 +149,7 @@ func getProofsByKey( } } default: - return nil, &ics23.ExistenceProof{}, &ics23.ExistenceProof{}, fmt.Errorf("Unknown proof ops found") + return nil, &ics23.ExistenceProof{}, &ics23.ExistenceProof{}, fmt.Errorf("unknown proof ops found") } } diff --git a/client/grpc/oracle/proof/service.go b/client/grpc/oracle/proof/service.go index 758ae8fa6..3dd5f95d4 100644 --- a/client/grpc/oracle/proof/service.go +++ b/client/grpc/oracle/proof/service.go @@ -13,7 +13,6 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/bandprotocol/chain/v2/x/oracle/types" - oracletypes "github.com/bandprotocol/chain/v2/x/oracle/types" ) // RegisterProofService registers the node gRPC service on the provided gRPC router. @@ -89,7 +88,7 @@ func (s proofServer) Proof(ctx context.Context, req *QueryProofRequest) (*QueryP } // Unmarshal the value into a Result object - var rs oracletypes.Result + var rs types.Result types.ModuleCdc.MustUnmarshal(value, &rs) // Create an OracleDataProof object with the relevant information @@ -195,7 +194,7 @@ func (s proofServer) MultiProof(ctx context.Context, req *QueryMultiProofRequest } // Unmarshal the value into a Result object - var rs oracletypes.Result + var rs types.Result types.ModuleCdc.MustUnmarshal(value, &rs) // Create an OracleDataProof object with the relevant information diff --git a/client/grpc/oracle/proof/signature.go b/client/grpc/oracle/proof/signature.go index 32d925283..cb8b85ab3 100644 --- a/client/grpc/oracle/proof/signature.go +++ b/client/grpc/oracle/proof/signature.go @@ -44,7 +44,7 @@ func recoverETHAddress(msg, sig, signer []byte) ([]byte, uint8, error) { return crypto.PubkeyToAddress(*pubuc).Bytes(), 27 + i, nil } } - return nil, 0, fmt.Errorf("No match address found") + return nil, 0, fmt.Errorf("no match address found") } func GetPrefix(t tmproto.SignedMsgType, height int64, round int64) ([]byte, error) { @@ -126,7 +126,7 @@ func GetSignaturesAndPrefix(info *types.SignedHeader) ([]TMSignature, CommonEnco } } if len(addrs) == 0 { - return nil, CommonEncodedVotePart{}, fmt.Errorf("No valid precommit") + return nil, CommonEncodedVotePart{}, fmt.Errorf("no valid precommit") } signatures := make([]TMSignature, len(addrs)) diff --git a/pkg/gzip/gzip_test.go b/pkg/gzip/gzip_test.go index c3725a777..c7890a37d 100644 --- a/pkg/gzip/gzip_test.go +++ b/pkg/gzip/gzip_test.go @@ -22,7 +22,7 @@ func TestUncompress(t *testing.T) { require.NoError(t, err) require.Equal(t, file1, accFile) - accFile, err = gzip.Uncompress(gzipFile, 2) + _, err = gzip.Uncompress(gzipFile, 2) require.Error(t, err) _, err = gzip.Uncompress(file1, 999) diff --git a/testing/chain.go b/testing/chain.go index 78cdd9d00..3018238c5 100644 --- a/testing/chain.go +++ b/testing/chain.go @@ -28,7 +28,6 @@ import ( clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" commitmenttypes "github.com/cosmos/ibc-go/v7/modules/core/23-commitment/types" ibchost "github.com/cosmos/ibc-go/v7/modules/core/24-host" - "github.com/cosmos/ibc-go/v7/modules/core/exported" ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" ibctmtypes "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" "github.com/cosmos/ibc-go/v7/testing/mock" @@ -325,7 +324,7 @@ func (chain *TestChain) SendReport( // GetClientState retrieves the client state for the provided clientID. The client is // expected to exist otherwise testing will fail. -func (chain *TestChain) GetClientState(clientID string) exported.ClientState { +func (chain *TestChain) GetClientState(clientID string) ibcexported.ClientState { clientState, found := chain.App.GetIBCKeeper().ClientKeeper.GetClientState(chain.GetContext(), clientID) require.True(chain.t, found) @@ -334,7 +333,10 @@ func (chain *TestChain) GetClientState(clientID string) exported.ClientState { // GetConsensusState retrieves the consensus state for the provided clientID and height. // It will return a success boolean depending on if consensus state exists or not. -func (chain *TestChain) GetConsensusState(clientID string, height exported.Height) (exported.ConsensusState, bool) { +func (chain *TestChain) GetConsensusState( + clientID string, + height ibcexported.Height, +) (ibcexported.ConsensusState, bool) { return chain.App.GetIBCKeeper().ClientKeeper.GetClientConsensusState(chain.GetContext(), clientID, height) } @@ -357,7 +359,7 @@ func (chain *TestChain) GetValsAtHeight(height int64) (*tmtypes.ValidatorSet, bo // GetAcknowledgement retrieves an acknowledgement for the provided packet. If the // acknowledgement does not exist then testing will fail. -func (chain *TestChain) GetAcknowledgement(packet exported.PacketI) []byte { +func (chain *TestChain) GetAcknowledgement(packet ibcexported.PacketI) []byte { ack, found := chain.App.GetIBCKeeper().ChannelKeeper.GetPacketAcknowledgement( chain.GetContext(), packet.GetDestPort(), diff --git a/x/bank/keeper/keeper.go b/x/bank/keeper/keeper.go index 286923d9d..f4a841091 100644 --- a/x/bank/keeper/keeper.go +++ b/x/bank/keeper/keeper.go @@ -42,7 +42,7 @@ func (k *WrappedBankKeeper) SetDistrKeeper(dk types.DistributionKeeper) { // Logger returns a module-specific logger. func (k WrappedBankKeeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", fmt.Sprint("x/wrappedbank")) + return ctx.Logger().With("module", "x/wrappedbank") } // BurnCoins moves the specified amount of coins from the given module name to diff --git a/x/oracle/keeper/grpc_query.go b/x/oracle/keeper/grpc_query.go index 6eb8a6ef2..b8344c312 100644 --- a/x/oracle/keeper/grpc_query.go +++ b/x/oracle/keeper/grpc_query.go @@ -341,7 +341,7 @@ func (k Querier) RequestVerification( // Provided signature should be valid, which means this query request should be signed by the provided reporter pk, err := hex.DecodeString(req.Reporter) if err != nil || len(pk) != secp256k1.PubKeySize { - return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("unable to get reporter's public key")) + return nil, status.Error(codes.InvalidArgument, "unable to get reporter's public key") } reporterPubKey := secp256k1.PubKey(pk[:]) diff --git a/x/oracle/keeper/owasm_test.go b/x/oracle/keeper/owasm_test.go index 94c43d877..415dcf2b6 100644 --- a/x/oracle/keeper/owasm_test.go +++ b/x/oracle/keeper/owasm_test.go @@ -125,6 +125,7 @@ func TestPrepareRequestSuccessBasic(t *testing.T) { sdk.WrapSDKContext(ctx), authtypes.NewQueryAllBalancesRequest(testapp.FeePayer.Address, &query.PageRequest{}), ) + require.NoError(t, err) feePayerBalances := balancesRes.Balances // OracleScript#1: Prepare asks for DS#1,2,3 with ExtID#1,2,3 and calldata "beeb" @@ -974,6 +975,7 @@ func TestCollectFeeBasicSuccess(t *testing.T) { sdk.WrapSDKContext(ctx), authtypes.NewQueryAllBalancesRequest(testapp.FeePayer.Address, &query.PageRequest{}), ) + require.NoError(t, err) feePayerBalances := balancesRes.Balances feePayerBalances[0].Amount = feePayerBalances[0].Amount.Sub(sdk.NewInt(3000000)) @@ -1006,6 +1008,7 @@ func TestCollectFeeBasicSuccessWithOtherAskCount(t *testing.T) { sdk.WrapSDKContext(ctx), authtypes.NewQueryAllBalancesRequest(testapp.FeePayer.Address, &query.PageRequest{}), ) + require.NoError(t, err) feePayerBalances := balancesRes.Balances feePayerBalances[0].Amount = feePayerBalances[0].Amount.Sub(sdk.NewInt(12000000)) diff --git a/yoda/event.go b/yoda/event.go index 9c14b4bff..7e8ac35e8 100644 --- a/yoda/event.go +++ b/yoda/event.go @@ -35,10 +35,10 @@ func GetEventValues(log sdk.ABCIMessageLog, evType string, evKey string) (res [] func GetEventValue(log sdk.ABCIMessageLog, evType string, evKey string) (string, error) { values := GetEventValues(log, evType, evKey) if len(values) == 0 { - return "", fmt.Errorf("Cannot find event with type: %s, key: %s", evType, evKey) + return "", fmt.Errorf("cannot find event with type: %s, key: %s", evType, evKey) } if len(values) > 1 { - return "", fmt.Errorf("Found more than one event with type: %s, key: %s", evType, evKey) + return "", fmt.Errorf("found more than one event with type: %s, key: %s", evType, evKey) } return values[0], nil } diff --git a/yoda/executor/executor.go b/yoda/executor/executor.go index 86251e5c3..8e97e1dc9 100644 --- a/yoda/executor/executor.go +++ b/yoda/executor/executor.go @@ -41,9 +41,9 @@ func NewExecutor(executor string) (exec Executor, err error) { case "rest": exec = NewRestExec(base, timeout) case "docker": - return nil, fmt.Errorf("Docker executor is currently not supported") + return nil, fmt.Errorf("docker executor is currently not supported") default: - return nil, fmt.Errorf("Invalid executor name: %s, base: %s", name, base) + return nil, fmt.Errorf("invalid executor name: %s, base: %s", name, base) } // TODO: Remove hardcode in test execution @@ -72,17 +72,17 @@ func NewExecutor(executor string) (exec Executor, err error) { func parseExecutor(executorStr string) (name string, base string, timeout time.Duration, err error) { executor := strings.SplitN(executorStr, ":", 2) if len(executor) != 2 { - return "", "", 0, fmt.Errorf("Invalid executor, cannot parse executor: %s", executorStr) + return "", "", 0, fmt.Errorf("invalid executor, cannot parse executor: %s", executorStr) } u, err := url.Parse(executor[1]) if err != nil { - return "", "", 0, fmt.Errorf("Invalid url, cannot parse %s to url with error: %s", executor[1], err.Error()) + return "", "", 0, fmt.Errorf("invalid url, cannot parse %s to url with error: %s", executor[1], err.Error()) } query := u.Query() timeoutStr := query.Get(flagQueryTimeout) if timeoutStr == "" { - return "", "", 0, fmt.Errorf("Invalid timeout, executor requires query timeout") + return "", "", 0, fmt.Errorf("invalid timeout, executor requires query timeout") } // Remove timeout from query because we need to return `base` query.Del(flagQueryTimeout) @@ -90,7 +90,7 @@ func parseExecutor(executorStr string) (name string, base string, timeout time.D timeout, err = time.ParseDuration(timeoutStr) if err != nil { - return "", "", 0, fmt.Errorf("Invalid timeout, cannot parse duration with error: %s", err.Error()) + return "", "", 0, fmt.Errorf("invalid timeout, cannot parse duration with error: %s", err.Error()) } return executor[0], u.String(), timeout, nil } diff --git a/yoda/executor/multi_test.go b/yoda/executor/multi_test.go index ed77616f7..9a3138324 100644 --- a/yoda/executor/multi_test.go +++ b/yoda/executor/multi_test.go @@ -80,6 +80,7 @@ func TestMultiExecOneWorking(t *testing.T) { exec2 := newMockExec([]byte("output"), 0, nil) exec3 := newMockExec(nil, 0, errors.New("error3")) exec, err := NewMultiExec([]Executor{exec1, exec2, exec3}, "round-robin") + require.NoError(t, err) result, err := exec.Exec(nil, "", nil) require.NoError(t, err) require.Equal(t, ExecResult{Output: []byte("output"), Code: 0}, result) @@ -96,6 +97,7 @@ func TestMultiExecAllErrors(t *testing.T) { exec2 := newMockExec(nil, 0, errors.New("error2")) exec3 := newMockExec(nil, 0, errors.New("error3")) exec, err := NewMultiExec([]Executor{exec1, exec2, exec3}, "round-robin") + require.NoError(t, err) _, err = exec.Exec(nil, "", nil) require.EqualError(t, err, "MultiError: error1, error2, error3") _, err = exec.Exec(nil, "", nil) diff --git a/yoda/run.go b/yoda/run.go index cdf8f5133..e21d52f49 100644 --- a/yoda/run.go +++ b/yoda/run.go @@ -106,14 +106,14 @@ func runCmd(c *Context) *cobra.Command { Args: cobra.ExactArgs(0), RunE: func(cmd *cobra.Command, args []string) error { if cfg.ChainID == "" { - return errors.New("Chain ID must not be empty") + return errors.New("chain ID must not be empty") } keys, err := kb.List() if err != nil { return err } if len(keys) == 0 { - return errors.New("No key available") + return errors.New("no key available") } c.keys = keys c.validator, err = sdk.ValAddressFromBech32(cfg.Validator)