This commit is contained in:
committed by
Christopher Goes
parent
157047c8a3
commit
ec2fedd36c
@@ -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
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
+1
-1
@@ -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)))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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{
|
||||
|
||||
+22
-22
@@ -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")
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
+3
-3
@@ -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
|
||||
|
||||
+1
-1
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user