diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index 4d32b92f5..93ea6ae03 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -193,7 +193,7 @@ func (app *BaseApp) initFromStore(mainKey sdk.StoreKey) error { // TODO: we don't actually need the main store here main := app.cms.GetKVStore(mainKey) if main == nil { - return errors.New("BaseApp expects MultiStore with 'main' KVStore") + return errors.New("baseapp expects MultiStore with 'main' KVStore") } // XXX: Do we really need the header? What does it have that we want @@ -216,11 +216,11 @@ func (app *BaseApp) initFromStore(mainKey sdk.StoreKey) error { } err := proto.Unmarshal(headerBytes, &header) if err != nil { - return errors.Wrap(err, "Failed to parse Header") + return errors.Wrap(err, "failed to parse Header") } lastVersion := lastCommitID.Version if header.Height != lastVersion { - errStr := fmt.Sprintf("Expected db://%s.Height %v but got %v", dbHeaderKey, lastVersion, header.Height) + errStr := fmt.Sprintf("expected db://%s.Height %v but got %v", dbHeaderKey, lastVersion, header.Height) return errors.New(errStr) } } @@ -468,10 +468,10 @@ func (app *BaseApp) runTx(mode runTxMode, txBytes []byte, tx sdk.Tx) (result sdk if r := recover(); r != nil { switch r.(type) { case sdk.ErrorOutOfGas: - log := fmt.Sprintf("Out of gas in location: %v", r.(sdk.ErrorOutOfGas).Descriptor) + log := fmt.Sprintf("out of gas in location: %v", r.(sdk.ErrorOutOfGas).Descriptor) result = sdk.ErrOutOfGas(log).Result() default: - log := fmt.Sprintf("Recovered: %v\nstack:\n%v", r, string(debug.Stack())) + log := fmt.Sprintf("recovered: %v\nstack:\n%v", r, string(debug.Stack())) result = sdk.ErrInternal(log).Result() } } diff --git a/client/context/helpers.go b/client/context/helpers.go index 0229827fe..0e28f5fd0 100644 --- a/client/context/helpers.go +++ b/client/context/helpers.go @@ -30,12 +30,12 @@ func (ctx CoreContext) BroadcastTx(tx []byte) (*ctypes.ResultBroadcastTxCommit, } if res.CheckTx.Code != uint32(0) { - return res, errors.Errorf("CheckTx failed: (%d) %s", + return res, errors.Errorf("checkTx failed: (%d) %s", res.CheckTx.Code, res.CheckTx.Log) } if res.DeliverTx.Code != uint32(0) { - return res, errors.Errorf("DeliverTx failed: (%d) %s", + return res, errors.Errorf("deliverTx failed: (%d) %s", res.DeliverTx.Code, res.DeliverTx.Log) } @@ -75,7 +75,7 @@ func (ctx CoreContext) query(key cmn.HexBytes, storeName, endPath string) (res [ } resp := result.Response if resp.Code != uint32(0) { - return res, errors.Errorf("Query failed: (%d) %s", resp.Code, resp.Log) + return res, errors.Errorf("query failed: (%d) %s", resp.Code, resp.Log) } return resp.Value, nil } @@ -95,7 +95,7 @@ func (ctx CoreContext) GetFromAddress() (from sdk.Address, err error) { info, err := keybase.Get(name) if err != nil { - return nil, errors.Errorf("No key for: %s", name) + return nil, errors.Errorf("no key for: %s", name) } return info.PubKey.Address(), nil @@ -107,7 +107,7 @@ func (ctx CoreContext) SignAndBuild(name, passphrase string, msg sdk.Msg, cdc *w // build the Sign Messsage from the Standard Message chainID := ctx.ChainID if chainID == "" { - return nil, errors.Errorf("Chain ID required but not specified") + return nil, errors.Errorf("chain ID required but not specified") } accnum := ctx.AccountNumber sequence := ctx.Sequence @@ -174,7 +174,7 @@ func (ctx CoreContext) EnsureSignBuildBroadcast(name string, msg sdk.Msg, cdc *w // get the next sequence for the account address func (ctx CoreContext) GetAccountNumber(address []byte) (int64, error) { if ctx.Decoder == nil { - return 0, errors.New("AccountDecoder required but not provided") + return 0, errors.New("accountDecoder required but not provided") } res, err := ctx.Query(auth.AddressStoreKey(address), ctx.AccountStore) @@ -198,7 +198,7 @@ func (ctx CoreContext) GetAccountNumber(address []byte) (int64, error) { // get the next sequence for the account address func (ctx CoreContext) NextSequence(address []byte) (int64, error) { if ctx.Decoder == nil { - return 0, errors.New("AccountDecoder required but not provided") + return 0, errors.New("accountDecoder required but not provided") } res, err := ctx.Query(auth.AddressStoreKey(address), ctx.AccountStore) @@ -229,7 +229,7 @@ func (ctx CoreContext) GetPassphraseFromStdin(name string) (pass string, err err // GetNode prepares a simple rpc.Client func (ctx CoreContext) GetNode() (rpcclient.Client, error) { if ctx.Client == nil { - return nil, errors.New("Must define node URI") + return nil, errors.New("must define node URI") } return ctx.Client, nil } diff --git a/client/input.go b/client/input.go index 53906ca88..03140a33c 100644 --- a/client/input.go +++ b/client/input.go @@ -32,7 +32,7 @@ func GetPassword(prompt string, buf *bufio.Reader) (pass string, err error) { return "", err } if len(pass) < MinPassLength { - return "", errors.Errorf("Password must be at least %d characters", MinPassLength) + return "", errors.Errorf("password must be at least %d characters", MinPassLength) } return pass, nil } @@ -68,7 +68,7 @@ func GetCheckPassword(prompt, prompt2 string, buf *bufio.Reader) (string, error) return "", err } if pass != pass2 { - return "", errors.New("Passphrases don't match") + return "", errors.New("passphrases don't match") } return pass, nil } diff --git a/client/keys/add.go b/client/keys/add.go index 7ad9474ce..5210a388a 100644 --- a/client/keys/add.go +++ b/client/keys/add.go @@ -53,7 +53,7 @@ func runAddCmd(cmd *cobra.Command, args []string) error { name = "inmemorykey" } else { if len(args) != 1 || len(args[0]) == 0 { - return errors.New("You must provide a name for the key") + return errors.New("you must provide a name for the key") } name = args[0] kb, err = GetKeyBase() diff --git a/client/lcd/root.go b/client/lcd/root.go index c3ec75c96..66491dfec 100644 --- a/client/lcd/root.go +++ b/client/lcd/root.go @@ -49,7 +49,7 @@ func ServeCommand(cdc *wire.Codec) *cobra.Command { // Wait forever and cleanup cmn.TrapSignal(func() { err := listener.Close() - logger.Error("Error closing listener", "err", err) + logger.Error("error closing listener", "err", err) }) return nil }, diff --git a/client/rpc/root.go b/client/rpc/root.go index e89972c3c..63ba64a18 100644 --- a/client/rpc/root.go +++ b/client/rpc/root.go @@ -18,7 +18,7 @@ const ( // XXX: remove this when not needed func todoNotImplemented(_ *cobra.Command, _ []string) error { - return errors.New("TODO: Command not yet implemented") + return errors.New("todo: Command not yet implemented") } // AddCommands adds a number of rpc-related subcommands diff --git a/client/tx/search.go b/client/tx/search.go index 3ab3a3df1..b3ebbf34e 100644 --- a/client/tx/search.go +++ b/client/tx/search.go @@ -54,7 +54,7 @@ func SearchTxCmd(cdc *wire.Codec) *cobra.Command { func searchTxs(ctx context.CoreContext, cdc *wire.Codec, tags []string) ([]txInfo, error) { if len(tags) == 0 { - return nil, errors.New("Must declare at least one tag to search") + return nil, errors.New("must declare at least one tag to search") } // XXX: implement ANY query := strings.Join(tags, " AND ") diff --git a/cmd/gaia/app/genesis.go b/cmd/gaia/app/genesis.go index 558bca38a..06fdbbcc5 100644 --- a/cmd/gaia/app/genesis.go +++ b/cmd/gaia/app/genesis.go @@ -92,7 +92,7 @@ func GaiaAppGenTx(cdc *wire.Codec, pk crypto.PubKey) ( overwrite := viper.GetBool(flagOWK) name := viper.GetString(flagName) if name == "" { - return nil, nil, tmtypes.GenesisValidator{}, errors.New("Must specify --name (validator moniker)") + return nil, nil, tmtypes.GenesisValidator{}, errors.New("must specify --name (validator moniker)") } var addr sdk.Address diff --git a/examples/democoin/x/cool/errors.go b/examples/democoin/x/cool/errors.go index 7a5e62c5d..73df2386e 100644 --- a/examples/democoin/x/cool/errors.go +++ b/examples/democoin/x/cool/errors.go @@ -16,5 +16,5 @@ const ( // ErrIncorrectCoolAnswer - Error returned upon an incorrect guess func ErrIncorrectCoolAnswer(codespace sdk.CodespaceType, answer string) sdk.Error { - return sdk.NewError(codespace, CodeIncorrectCoolAnswer, fmt.Sprintf("Incorrect cool answer: %v", answer)) + return sdk.NewError(codespace, CodeIncorrectCoolAnswer, fmt.Sprintf("incorrect cool answer: %v", answer)) } diff --git a/examples/democoin/x/pow/errors.go b/examples/democoin/x/pow/errors.go index a499e0d9f..e25964da7 100644 --- a/examples/democoin/x/pow/errors.go +++ b/examples/democoin/x/pow/errors.go @@ -23,21 +23,21 @@ const ( func codeToDefaultMsg(code CodeType) string { switch code { case CodeInvalidDifficulty: - return "Insuffient difficulty" + return "insuffient difficulty" case CodeNonexistentDifficulty: - return "Nonexistent difficulty" + return "nonexistent difficulty" case CodeNonexistentReward: - return "Nonexistent reward" + return "nonexistent reward" case CodeNonexistentCount: - return "Nonexistent count" + return "nonexistent count" case CodeInvalidProof: - return "Invalid proof" + return "invalid proof" case CodeNotBelowTarget: - return "Not below target" + return "not below target" case CodeInvalidCount: - return "Invalid count" + return "invalid count" case CodeUnknownRequest: - return "Unknown request" + return "unknown request" default: return sdk.CodeToDefaultMsg(code) } diff --git a/server/export.go b/server/export.go index 794235f62..0ff7456ad 100644 --- a/server/export.go +++ b/server/export.go @@ -20,7 +20,7 @@ func ExportCmd(ctx *Context, cdc *wire.Codec, appExporter AppExporter) *cobra.Co home := viper.GetString("home") appState, validators, err := appExporter(home, ctx.Logger) if err != nil { - return errors.Errorf("Error exporting state: %v\n", err) + return errors.Errorf("error exporting state: %v\n", err) } doc, err := tmtypes.GenesisDocFromFile(ctx.Config.GenesisFile()) if err != nil { diff --git a/server/start.go b/server/start.go index 9bf2d30cd..5224ef30d 100644 --- a/server/start.go +++ b/server/start.go @@ -9,8 +9,8 @@ import ( tcmd "github.com/tendermint/tendermint/cmd/tendermint/commands" "github.com/tendermint/tendermint/node" - "github.com/tendermint/tendermint/proxy" pvm "github.com/tendermint/tendermint/privval" + "github.com/tendermint/tendermint/proxy" cmn "github.com/tendermint/tmlibs/common" ) @@ -55,7 +55,7 @@ func startStandAlone(ctx *Context, appCreator AppCreator) error { svr, err := server.NewServer(addr, "socket", app) if err != nil { - return errors.Errorf("Error creating listener: %v\n", err) + return errors.Errorf("error creating listener: %v\n", err) } svr.SetLogger(ctx.Logger.With("module", "abci-server")) svr.Start() diff --git a/server/start_test.go b/server/start_test.go index 1c1ad671e..046bbe19b 100644 --- a/server/start_test.go +++ b/server/start_test.go @@ -40,7 +40,7 @@ func TestStartStandAlone(t *testing.T) { svrAddr, _, err := FreeTCPAddr() require.Nil(t, err) svr, err := server.NewServer(svrAddr, "socket", app) - require.Nil(t, err, "Error creating listener") + require.Nil(t, err, "error creating listener") svr.SetLogger(logger.With("module", "abci-server")) svr.Start() diff --git a/store/rootmultistore.go b/store/rootmultistore.go index 11cebc22e..05a2e13fb 100644 --- a/store/rootmultistore.go +++ b/store/rootmultistore.go @@ -89,7 +89,7 @@ func (rs *rootMultiStore) LoadVersion(ver int64) error { id := CommitID{} store, err := rs.loadCommitStoreFromParams(id, storeParams) if err != nil { - return fmt.Errorf("Failed to load rootMultiStore: %v", err) + return fmt.Errorf("failed to load rootMultiStore: %v", err) } rs.stores[key] = store } @@ -112,7 +112,7 @@ func (rs *rootMultiStore) LoadVersion(ver int64) error { storeParams := rs.storesParams[key] store, err := rs.loadCommitStoreFromParams(commitID, storeParams) if err != nil { - return fmt.Errorf("Failed to load rootMultiStore: %v", err) + return fmt.Errorf("failed to load rootMultiStore: %v", err) } newStores[key] = store } @@ -120,7 +120,7 @@ func (rs *rootMultiStore) LoadVersion(ver int64) error { // If any CommitStoreLoaders were not used, return error. for key := range rs.storesParams { if _, ok := newStores[key]; !ok { - return fmt.Errorf("Unused CommitStoreLoader: %v", key) + return fmt.Errorf("unused CommitStoreLoader: %v", key) } } @@ -399,14 +399,14 @@ func getCommitInfo(db dbm.DB, ver int64) (commitInfo, error) { cInfoKey := fmt.Sprintf(commitInfoKeyFmt, ver) cInfoBytes := db.Get([]byte(cInfoKey)) if cInfoBytes == nil { - return commitInfo{}, fmt.Errorf("Failed to get rootMultiStore: no data") + return commitInfo{}, fmt.Errorf("failed to get rootMultiStore: no data") } // Parse bytes. var cInfo commitInfo err := cdc.UnmarshalBinary(cInfoBytes, &cInfo) if err != nil { - return commitInfo{}, fmt.Errorf("Failed to get rootMultiStore: %v", err) + return commitInfo{}, fmt.Errorf("failed to get rootMultiStore: %v", err) } return cInfo, nil } diff --git a/types/account.go b/types/account.go index a7dd50ead..00f6cc524 100644 --- a/types/account.go +++ b/types/account.go @@ -160,7 +160,7 @@ func GetFromBech32(bech32str, prefix string) ([]byte, error) { } if hrp != prefix { - return nil, fmt.Errorf("Invalid bech32 prefix. Expected %s, Got %s", prefix, hrp) + return nil, fmt.Errorf("invalid bech32 prefix. Expected %s, Got %s", prefix, hrp) } return bz, nil diff --git a/types/coin.go b/types/coin.go index 8a80bee22..ee2693964 100644 --- a/types/coin.go +++ b/types/coin.go @@ -280,7 +280,7 @@ func ParseCoin(coinStr string) (coin Coin, err error) { matches := reCoin.FindStringSubmatch(coinStr) if matches == nil { - err = fmt.Errorf("Invalid coin expression: %s", coinStr) + err = fmt.Errorf("invalid coin expression: %s", coinStr) return } denomStr, amountStr := matches[2], matches[1] @@ -316,7 +316,7 @@ func ParseCoins(coinsStr string) (coins Coins, err error) { // Validate coins before returning. if !coins.IsValid() { - return nil, fmt.Errorf("ParseCoins invalid: %#v", coins) + return nil, fmt.Errorf("parseCoins invalid: %#v", coins) } return coins, nil diff --git a/types/errors.go b/types/errors.go index 20d452464..f979ee118 100644 --- a/types/errors.go +++ b/types/errors.go @@ -68,31 +68,31 @@ const ( func CodeToDefaultMsg(code CodeType) string { switch code { case CodeInternal: - return "Internal error" + return "internal error" case CodeTxDecode: - return "Tx parse error" + return "tx parse error" case CodeInvalidSequence: - return "Invalid sequence" + return "invalid sequence" case CodeUnauthorized: - return "Unauthorized" + return "unauthorized" case CodeInsufficientFunds: - return "Insufficent funds" + return "insufficent funds" case CodeUnknownRequest: - return "Unknown request" + return "unknown request" case CodeInvalidAddress: - return "Invalid address" + return "invalid address" case CodeInvalidPubKey: - return "Invalid pubkey" + return "invalid pubkey" case CodeUnknownAddress: - return "Unknown address" + return "unknown address" case CodeInsufficientCoins: - return "Insufficient coins" + return "insufficient coins" case CodeInvalidCoins: - return "Invalid coins" + return "invalid coins" case CodeOutOfGas: - return "Out of gas" + return "out of gas" default: - return fmt.Sprintf("Unknown code %d", code) + return fmt.Sprintf("unknown code %d", code) } } @@ -183,7 +183,7 @@ type sdkError struct { // Implements ABCIError. func (err *sdkError) Error() string { - return fmt.Sprintf("Error{%d:%d,%#v}", err.codespace, err.code, err.err) + return fmt.Sprintf("error{%d:%d,%#v}", err.codespace, err.code, err.err) } // Implements ABCIError. diff --git a/x/auth/client/rest/query.go b/x/auth/client/rest/query.go index 9ccbe8e14..1f68a69e5 100644 --- a/x/auth/client/rest/query.go +++ b/x/auth/client/rest/query.go @@ -37,7 +37,7 @@ func QueryAccountRequestHandlerFn(storeName string, cdc *wire.Codec, decoder aut res, err := ctx.Query(auth.AddressStoreKey(addr), storeName) if err != nil { w.WriteHeader(http.StatusInternalServerError) - w.Write([]byte(fmt.Sprintf("Could't query account. Error: %s", err.Error()))) + w.Write([]byte(fmt.Sprintf("couldn't query account. Error: %s", err.Error()))) return } @@ -51,7 +51,7 @@ func QueryAccountRequestHandlerFn(storeName string, cdc *wire.Codec, decoder aut account, err := decoder(res) if err != nil { w.WriteHeader(http.StatusInternalServerError) - w.Write([]byte(fmt.Sprintf("Could't parse query result. Result: %s. Error: %s", res, err.Error()))) + w.Write([]byte(fmt.Sprintf("couldn't parse query result. Result: %s. Error: %s", res, err.Error()))) return } @@ -59,7 +59,7 @@ func QueryAccountRequestHandlerFn(storeName string, cdc *wire.Codec, decoder aut output, err := cdc.MarshalJSON(account) if err != nil { w.WriteHeader(http.StatusInternalServerError) - w.Write([]byte(fmt.Sprintf("Could't marshall query result. Error: %s", err.Error()))) + w.Write([]byte(fmt.Sprintf("couldn't marshall query result. Error: %s", err.Error()))) return } diff --git a/x/bank/errors.go b/x/bank/errors.go index bf2a3ef26..cf11ddc22 100644 --- a/x/bank/errors.go +++ b/x/bank/errors.go @@ -17,9 +17,9 @@ const ( func codeToDefaultMsg(code sdk.CodeType) string { switch code { case CodeInvalidInput: - return "Invalid input coins" + return "invalid input coins" case CodeInvalidOutput: - return "Invalid output coins" + return "invalid output coins" default: return sdk.CodeToDefaultMsg(code) } diff --git a/x/ibc/client/cli/relay.go b/x/ibc/client/cli/relay.go index caf96d60a..96c5b08cc 100644 --- a/x/ibc/client/cli/relay.go +++ b/x/ibc/client/cli/relay.go @@ -116,7 +116,7 @@ OUTER: lengthKey := ibc.EgressLengthKey(toChainID) egressLengthbz, err := query(fromChainNode, lengthKey, c.ibcStore) if err != nil { - c.logger.Error("Error querying outgoing packet list length", "err", err) + c.logger.Error("error querying outgoing packet list length", "err", err) continue OUTER //TODO replace with continue (I think it should just to the correct place where OUTER is now) } var egressLength int64 @@ -134,14 +134,14 @@ OUTER: for i := processed; i < egressLength; i++ { egressbz, err := query(fromChainNode, ibc.EgressKey(toChainID, i), c.ibcStore) if err != nil { - c.logger.Error("Error querying egress packet", "err", err) + c.logger.Error("error querying egress packet", "err", err) continue OUTER // TODO replace to break, will break first loop then send back to the beginning (aka OUTER) } err = c.broadcastTx(seq, toChainNode, c.refine(egressbz, i, passphrase)) seq++ if err != nil { - c.logger.Error("Error broadcasting ingress packet", "err", err) + c.logger.Error("error broadcasting ingress packet", "err", err) continue OUTER // TODO replace to break, will break first loop then send back to the beginning (aka OUTER) } diff --git a/x/ibc/errors.go b/x/ibc/errors.go index 60a141eba..f7beb0e1d 100644 --- a/x/ibc/errors.go +++ b/x/ibc/errors.go @@ -17,9 +17,9 @@ const ( func codeToDefaultMsg(code sdk.CodeType) string { switch code { case CodeInvalidSequence: - return "Invalid IBC packet sequence" + return "invalid IBC packet sequence" case CodeIdenticalChains: - return "Source and destination chain cannot be identical" + return "source and destination chain cannot be identical" default: return sdk.CodeToDefaultMsg(code) } diff --git a/x/slashing/errors.go b/x/slashing/errors.go index 087dc0314..b9b152c7b 100644 --- a/x/slashing/errors.go +++ b/x/slashing/errors.go @@ -19,21 +19,21 @@ const ( ) func ErrNoValidatorForAddress(codespace sdk.CodespaceType) sdk.Error { - return newError(codespace, CodeInvalidValidator, "That address is not associated with any known validator") + return newError(codespace, CodeInvalidValidator, "that address is not associated with any known validator") } func ErrBadValidatorAddr(codespace sdk.CodespaceType) sdk.Error { - return newError(codespace, CodeInvalidValidator, "Validator does not exist for that address") + return newError(codespace, CodeInvalidValidator, "validator does not exist for that address") } func ErrValidatorJailed(codespace sdk.CodespaceType) sdk.Error { - return newError(codespace, CodeValidatorJailed, "Validator jailed, cannot yet be unrevoked") + return newError(codespace, CodeValidatorJailed, "validator jailed, cannot yet be unrevoked") } func codeToDefaultMsg(code CodeType) string { switch code { case CodeInvalidValidator: - return "Invalid Validator" + return "invalid Validator" case CodeValidatorJailed: - return "Validator Jailed" + return "validator Jailed" default: return sdk.CodeToDefaultMsg(code) } diff --git a/x/slashing/tick.go b/x/slashing/tick.go index 526baece0..6eb6eeb32 100644 --- a/x/slashing/tick.go +++ b/x/slashing/tick.go @@ -26,7 +26,7 @@ func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, sk Keeper) (tags case tmtypes.ABCIEvidenceTypeDuplicateVote: sk.handleDoubleSign(ctx, evidence.Height, evidence.Time, pk) default: - ctx.Logger().With("module", "x/slashing").Error(fmt.Sprintf("Ignored unknown evidence type: %s", string(evidence.Type))) + ctx.Logger().With("module", "x/slashing").Error(fmt.Sprintf("ignored unknown evidence type: %s", string(evidence.Type))) } } diff --git a/x/stake/client/rest/query.go b/x/stake/client/rest/query.go index f8a2f00e5..d9288fb11 100644 --- a/x/stake/client/rest/query.go +++ b/x/stake/client/rest/query.go @@ -51,7 +51,7 @@ func bondingStatusHandlerFn(ctx context.CoreContext, storeName string, cdc *wire res, err := ctx.Query(key, storeName) if err != nil { w.WriteHeader(http.StatusInternalServerError) - w.Write([]byte(fmt.Sprintf("Couldn't query bond. Error: %s", err.Error()))) + w.Write([]byte(fmt.Sprintf("couldn't query bond. Error: %s", err.Error()))) return } @@ -65,7 +65,7 @@ func bondingStatusHandlerFn(ctx context.CoreContext, storeName string, cdc *wire err = cdc.UnmarshalBinary(res, &bond) if err != nil { w.WriteHeader(http.StatusInternalServerError) - w.Write([]byte(fmt.Sprintf("Couldn't decode bond. Error: %s", err.Error()))) + w.Write([]byte(fmt.Sprintf("couldn't decode bond. Error: %s", err.Error()))) return } @@ -142,7 +142,7 @@ func validatorsHandlerFn(ctx context.CoreContext, storeName string, cdc *wire.Co kvs, err := ctx.QuerySubspace(cdc, stake.ValidatorsKey, storeName) if err != nil { w.WriteHeader(http.StatusInternalServerError) - w.Write([]byte(fmt.Sprintf("Couldn't query validators. Error: %s", err.Error()))) + w.Write([]byte(fmt.Sprintf("couldn't query validators. Error: %s", err.Error()))) return } @@ -163,7 +163,7 @@ func validatorsHandlerFn(ctx context.CoreContext, storeName string, cdc *wire.Co } if err != nil { w.WriteHeader(http.StatusInternalServerError) - w.Write([]byte(fmt.Sprintf("Couldn't decode validator. Error: %s", err.Error()))) + w.Write([]byte(fmt.Sprintf("couldn't decode validator. Error: %s", err.Error()))) return } validators[i] = bech32Validator diff --git a/x/stake/client/rest/tx.go b/x/stake/client/rest/tx.go index 77a6540ee..669bdd39f 100644 --- a/x/stake/client/rest/tx.go +++ b/x/stake/client/rest/tx.go @@ -76,18 +76,18 @@ func editDelegationsRequestHandlerFn(cdc *wire.Codec, kb keys.Keybase, ctx conte delegatorAddr, err := sdk.GetAccAddressBech32(msg.DelegatorAddr) if err != nil { w.WriteHeader(http.StatusInternalServerError) - w.Write([]byte(fmt.Sprintf("Couldn't decode delegator. Error: %s", err.Error()))) + w.Write([]byte(fmt.Sprintf("couldn't decode delegator. Error: %s", err.Error()))) return } validatorAddr, err := sdk.GetValAddressBech32(msg.ValidatorAddr) if err != nil { w.WriteHeader(http.StatusInternalServerError) - w.Write([]byte(fmt.Sprintf("Couldn't decode validator. Error: %s", err.Error()))) + w.Write([]byte(fmt.Sprintf("couldn't decode validator. Error: %s", err.Error()))) return } if !bytes.Equal(info.Address(), delegatorAddr) { w.WriteHeader(http.StatusUnauthorized) - w.Write([]byte("Must use own delegator address")) + w.Write([]byte("must use own delegator address")) return } messages[i] = stake.MsgDelegate{ @@ -101,18 +101,18 @@ func editDelegationsRequestHandlerFn(cdc *wire.Codec, kb keys.Keybase, ctx conte delegatorAddr, err := sdk.GetAccAddressBech32(msg.DelegatorAddr) if err != nil { w.WriteHeader(http.StatusInternalServerError) - w.Write([]byte(fmt.Sprintf("Couldn't decode delegator. Error: %s", err.Error()))) + w.Write([]byte(fmt.Sprintf("couldn't decode delegator. Error: %s", err.Error()))) return } validatorAddr, err := sdk.GetValAddressBech32(msg.ValidatorAddr) if err != nil { w.WriteHeader(http.StatusInternalServerError) - w.Write([]byte(fmt.Sprintf("Couldn't decode validator. Error: %s", err.Error()))) + w.Write([]byte(fmt.Sprintf("couldn't decode validator. Error: %s", err.Error()))) return } if !bytes.Equal(info.Address(), delegatorAddr) { w.WriteHeader(http.StatusUnauthorized) - w.Write([]byte("Must use own delegator address")) + w.Write([]byte("must use own delegator address")) return } messages[i] = stake.MsgUnbond{ diff --git a/x/stake/errors.go b/x/stake/errors.go index 0ae57530a..796d638db 100644 --- a/x/stake/errors.go +++ b/x/stake/errors.go @@ -26,17 +26,17 @@ const ( func codeToDefaultMsg(code CodeType) string { switch code { case CodeInvalidValidator: - return "Invalid Validator" + return "invalid Validator" case CodeInvalidBond: - return "Invalid Bond" + return "invalid Bond" case CodeInvalidInput: - return "Invalid Input" + return "invalid Input" case CodeUnauthorized: - return "Unauthorized" + return "unauthorized" case CodeInternal: - return "Internal Error" + return "internal Error" case CodeUnknownRequest: - return "Unknown request" + return "unknown request" default: return sdk.CodeToDefaultMsg(code) } @@ -49,55 +49,55 @@ func ErrNotEnoughBondShares(codespace sdk.CodespaceType, shares string) sdk.Erro return newError(codespace, CodeInvalidBond, fmt.Sprintf("not enough shares only have %v", shares)) } func ErrValidatorEmpty(codespace sdk.CodespaceType) sdk.Error { - return newError(codespace, CodeInvalidValidator, "Cannot bond to an empty validator") + return newError(codespace, CodeInvalidValidator, "cannot bond to an empty validator") } func ErrBadBondingDenom(codespace sdk.CodespaceType) sdk.Error { - return newError(codespace, CodeInvalidBond, "Invalid coin denomination") + return newError(codespace, CodeInvalidBond, "invalid coin denomination") } func ErrBadBondingAmount(codespace sdk.CodespaceType) sdk.Error { - return newError(codespace, CodeInvalidBond, "Amount must be > 0") + return newError(codespace, CodeInvalidBond, "amount must be > 0") } func ErrNoBondingAcct(codespace sdk.CodespaceType) sdk.Error { - return newError(codespace, CodeInvalidValidator, "No bond account for this (address, validator) pair") + return newError(codespace, CodeInvalidValidator, "no bond account for this (address, validator) pair") } func ErrCommissionNegative(codespace sdk.CodespaceType) sdk.Error { - return newError(codespace, CodeInvalidValidator, "Commission must be positive") + return newError(codespace, CodeInvalidValidator, "commission must be positive") } func ErrCommissionHuge(codespace sdk.CodespaceType) sdk.Error { - return newError(codespace, CodeInvalidValidator, "Commission cannot be more than 100%") + return newError(codespace, CodeInvalidValidator, "commission cannot be more than 100%") } func ErrBadValidatorAddr(codespace sdk.CodespaceType) sdk.Error { - return newError(codespace, CodeInvalidValidator, "Validator does not exist for that address") + return newError(codespace, CodeInvalidValidator, "validator does not exist for that address") } func ErrBadDelegatorAddr(codespace sdk.CodespaceType) sdk.Error { - return newError(codespace, CodeInvalidValidator, "Delegator does not exist for that address") + return newError(codespace, CodeInvalidValidator, "delegator does not exist for that address") } func ErrValidatorExistsAddr(codespace sdk.CodespaceType) sdk.Error { - return newError(codespace, CodeInvalidValidator, "Validator already exist, cannot re-create validator") + return newError(codespace, CodeInvalidValidator, "validator already exist, cannot re-create validator") } func ErrValidatorRevoked(codespace sdk.CodespaceType) sdk.Error { - return newError(codespace, CodeInvalidValidator, "Validator for this address is currently revoked") + return newError(codespace, CodeInvalidValidator, "validator for this address is currently revoked") } func ErrMissingSignature(codespace sdk.CodespaceType) sdk.Error { - return newError(codespace, CodeInvalidValidator, "Missing signature") + return newError(codespace, CodeInvalidValidator, "missing signature") } func ErrBondNotNominated(codespace sdk.CodespaceType) sdk.Error { - return newError(codespace, CodeInvalidValidator, "Cannot bond to non-nominated account") + return newError(codespace, CodeInvalidValidator, "cannot bond to non-nominated account") } func ErrNoValidatorForAddress(codespace sdk.CodespaceType) sdk.Error { - return newError(codespace, CodeInvalidValidator, "Validator does not exist for that address") + return newError(codespace, CodeInvalidValidator, "validator does not exist for that address") } func ErrNoDelegatorForAddress(codespace sdk.CodespaceType) sdk.Error { - return newError(codespace, CodeInvalidValidator, "Delegator does not contain validator bond") + return newError(codespace, CodeInvalidValidator, "delegator does not contain validator bond") } func ErrInsufficientFunds(codespace sdk.CodespaceType) sdk.Error { - return newError(codespace, CodeInvalidInput, "Insufficient bond shares") + return newError(codespace, CodeInvalidInput, "insufficient bond shares") } func ErrBadShares(codespace sdk.CodespaceType) sdk.Error { return newError(codespace, CodeInvalidInput, "bad shares provided as input, must be MAX or decimal") } func ErrBadRemoveValidator(codespace sdk.CodespaceType) sdk.Error { - return newError(codespace, CodeInvalidValidator, "Error removing validator") + return newError(codespace, CodeInvalidValidator, "error removing validator") } //---------------------------------------- diff --git a/x/stake/keeper.go b/x/stake/keeper.go index 4a2e6ff4b..a4a1bc01c 100644 --- a/x/stake/keeper.go +++ b/x/stake/keeper.go @@ -804,7 +804,7 @@ func (k Keeper) Slash(ctx sdk.Context, pubkey crypto.PubKey, height int64, fract logger := ctx.Logger().With("module", "x/stake") val, found := k.GetValidatorByPubKey(ctx, pubkey) if !found { - panic(fmt.Errorf("Attempted to slash a nonexistent validator with address %s", pubkey.Address())) + panic(fmt.Errorf("attempted to slash a nonexistent validator with address %s", pubkey.Address())) } sharesToRemove := val.PoolShares.Amount.Mul(fraction) pool := k.GetPool(ctx) @@ -820,7 +820,7 @@ func (k Keeper) Revoke(ctx sdk.Context, pubkey crypto.PubKey) { logger := ctx.Logger().With("module", "x/stake") val, found := k.GetValidatorByPubKey(ctx, pubkey) if !found { - panic(fmt.Errorf("Validator with pubkey %s not found, cannot revoke", pubkey)) + panic(fmt.Errorf("validator with pubkey %s not found, cannot revoke", pubkey)) } val.Revoked = true k.updateValidator(ctx, val) // update the validator, now revoked @@ -833,7 +833,7 @@ func (k Keeper) Unrevoke(ctx sdk.Context, pubkey crypto.PubKey) { logger := ctx.Logger().With("module", "x/stake") val, found := k.GetValidatorByPubKey(ctx, pubkey) if !found { - panic(fmt.Errorf("Validator with pubkey %s not found, cannot unrevoke", pubkey)) + panic(fmt.Errorf("validator with pubkey %s not found, cannot unrevoke", pubkey)) } val.Revoked = false k.updateValidator(ctx, val) // update the validator, now unrevoked diff --git a/x/stake/msg.go b/x/stake/msg.go index a0922bb87..fbdd04853 100644 --- a/x/stake/msg.go +++ b/x/stake/msg.go @@ -122,7 +122,7 @@ func (msg MsgEditValidator) ValidateBasic() sdk.Error { } empty := Description{} if msg.Description == empty { - return newError(DefaultCodespace, CodeInvalidInput, "Transaction must include some information to modify") + return newError(DefaultCodespace, CodeInvalidInput, "transaction must include some information to modify") } return nil }