Skip to content

Commit

Permalink
Merge PR cosmos#5665: Bump Module ABCI Error Codes
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderbez authored Feb 18, 2020
1 parent 794a496 commit a63de30
Show file tree
Hide file tree
Showing 10 changed files with 97 additions and 96 deletions.
7 changes: 3 additions & 4 deletions types/errors/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,9 @@ func errIsNil(err error) bool {
return false
}

// Redact replace all errors that do not initialize with a weave error with a
// generic internal error instance. This function is supposed to hide
// implementation details errors and leave only those that weave framework
// originates.
// Redact replaces an error that is not initialized as an ABCI Error with a
// generic internal error instance. If the error is an ABCI Error, that error is
// simply returned.
func Redact(err error) error {
if ErrPanic.Is(err) {
return errors.New(internalABCILog)
Expand Down
8 changes: 5 additions & 3 deletions x/auth/types/errors.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package types

import "errors"
import (
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)

var (
ErrorInvalidSigner = errors.New("tx intended signer does not match the given signer")
ErrorInvalidGasAdjustment = errors.New("invalid gas adjustment")
ErrorInvalidSigner = sdkerrors.Register(ModuleName, 2, "tx intended signer does not match the given signer")
ErrorInvalidGasAdjustment = sdkerrors.Register(ModuleName, 3, "invalid gas adjustment")
)
8 changes: 4 additions & 4 deletions x/bank/internal/types/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (

// x/bank module sentinel errors
var (
ErrNoInputs = sdkerrors.Register(ModuleName, 1, "no inputs to send transaction")
ErrNoOutputs = sdkerrors.Register(ModuleName, 2, "no outputs to send transaction")
ErrInputOutputMismatch = sdkerrors.Register(ModuleName, 3, "sum inputs != sum outputs")
ErrSendDisabled = sdkerrors.Register(ModuleName, 4, "send transactions are disabled")
ErrNoInputs = sdkerrors.Register(ModuleName, 2, "no inputs to send transaction")
ErrNoOutputs = sdkerrors.Register(ModuleName, 3, "no outputs to send transaction")
ErrInputOutputMismatch = sdkerrors.Register(ModuleName, 4, "sum inputs != sum outputs")
ErrSendDisabled = sdkerrors.Register(ModuleName, 5, "send transactions are disabled")
)
4 changes: 2 additions & 2 deletions x/crisis/internal/types/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ import (

// x/crisis module sentinel errors
var (
ErrNoSender = sdkerrors.Register(ModuleName, 1, "sender address is empty")
ErrUnknownInvariant = sdkerrors.Register(ModuleName, 2, "unknown invariant")
ErrNoSender = sdkerrors.Register(ModuleName, 2, "sender address is empty")
ErrUnknownInvariant = sdkerrors.Register(ModuleName, 3, "unknown invariant")
)
24 changes: 12 additions & 12 deletions x/distribution/types/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ import (

// x/distribution module sentinel errors
var (
ErrEmptyDelegatorAddr = sdkerrors.Register(ModuleName, 1, "delegator address is empty")
ErrEmptyWithdrawAddr = sdkerrors.Register(ModuleName, 2, "withdraw address is empty")
ErrEmptyValidatorAddr = sdkerrors.Register(ModuleName, 3, "validator address is empty")
ErrEmptyDelegationDistInfo = sdkerrors.Register(ModuleName, 4, "no delegation distribution info")
ErrNoValidatorDistInfo = sdkerrors.Register(ModuleName, 5, "no validator distribution info")
ErrNoValidatorCommission = sdkerrors.Register(ModuleName, 6, "no validator commission to withdraw")
ErrSetWithdrawAddrDisabled = sdkerrors.Register(ModuleName, 7, "set withdraw address disabled")
ErrBadDistribution = sdkerrors.Register(ModuleName, 8, "community pool does not have sufficient coins to distribute")
ErrInvalidProposalAmount = sdkerrors.Register(ModuleName, 9, "invalid community pool spend proposal amount")
ErrEmptyProposalRecipient = sdkerrors.Register(ModuleName, 10, "invalid community pool spend proposal recipient")
ErrNoValidatorExists = sdkerrors.Register(ModuleName, 11, "validator does not exist")
ErrNoDelegationExists = sdkerrors.Register(ModuleName, 12, "delegation does not exist")
ErrEmptyDelegatorAddr = sdkerrors.Register(ModuleName, 2, "delegator address is empty")
ErrEmptyWithdrawAddr = sdkerrors.Register(ModuleName, 3, "withdraw address is empty")
ErrEmptyValidatorAddr = sdkerrors.Register(ModuleName, 4, "validator address is empty")
ErrEmptyDelegationDistInfo = sdkerrors.Register(ModuleName, 5, "no delegation distribution info")
ErrNoValidatorDistInfo = sdkerrors.Register(ModuleName, 6, "no validator distribution info")
ErrNoValidatorCommission = sdkerrors.Register(ModuleName, 7, "no validator commission to withdraw")
ErrSetWithdrawAddrDisabled = sdkerrors.Register(ModuleName, 8, "set withdraw address disabled")
ErrBadDistribution = sdkerrors.Register(ModuleName, 9, "community pool does not have sufficient coins to distribute")
ErrInvalidProposalAmount = sdkerrors.Register(ModuleName, 10, "invalid community pool spend proposal amount")
ErrEmptyProposalRecipient = sdkerrors.Register(ModuleName, 11, "invalid community pool spend proposal recipient")
ErrNoValidatorExists = sdkerrors.Register(ModuleName, 12, "validator does not exist")
ErrNoDelegationExists = sdkerrors.Register(ModuleName, 13, "delegation does not exist")
)
8 changes: 4 additions & 4 deletions x/evidence/internal/types/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (

// x/evidence module sentinel errors
var (
ErrNoEvidenceHandlerExists = sdkerrors.Register(ModuleName, 1, "unregistered handler for evidence type")
ErrInvalidEvidence = sdkerrors.Register(ModuleName, 2, "invalid evidence")
ErrNoEvidenceExists = sdkerrors.Register(ModuleName, 3, "evidence does not exist")
ErrEvidenceExists = sdkerrors.Register(ModuleName, 4, "evidence already exists")
ErrNoEvidenceHandlerExists = sdkerrors.Register(ModuleName, 2, "unregistered handler for evidence type")
ErrInvalidEvidence = sdkerrors.Register(ModuleName, 3, "invalid evidence")
ErrNoEvidenceExists = sdkerrors.Register(ModuleName, 4, "evidence does not exist")
ErrEvidenceExists = sdkerrors.Register(ModuleName, 5, "evidence already exists")
)
16 changes: 8 additions & 8 deletions x/gov/types/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import (

// x/gov module sentinel errors
var (
ErrUnknownProposal = sdkerrors.Register(ModuleName, 1, "unknown proposal")
ErrInactiveProposal = sdkerrors.Register(ModuleName, 2, "inactive proposal")
ErrAlreadyActiveProposal = sdkerrors.Register(ModuleName, 3, "proposal already active")
ErrInvalidProposalContent = sdkerrors.Register(ModuleName, 4, "invalid proposal content")
ErrInvalidProposalType = sdkerrors.Register(ModuleName, 5, "invalid proposal type")
ErrInvalidVote = sdkerrors.Register(ModuleName, 6, "invalid vote option")
ErrInvalidGenesis = sdkerrors.Register(ModuleName, 7, "invalid genesis state")
ErrNoProposalHandlerExists = sdkerrors.Register(ModuleName, 8, "no handler exists for proposal type")
ErrUnknownProposal = sdkerrors.Register(ModuleName, 2, "unknown proposal")
ErrInactiveProposal = sdkerrors.Register(ModuleName, 3, "inactive proposal")
ErrAlreadyActiveProposal = sdkerrors.Register(ModuleName, 4, "proposal already active")
ErrInvalidProposalContent = sdkerrors.Register(ModuleName, 5, "invalid proposal content")
ErrInvalidProposalType = sdkerrors.Register(ModuleName, 6, "invalid proposal type")
ErrInvalidVote = sdkerrors.Register(ModuleName, 7, "invalid vote option")
ErrInvalidGenesis = sdkerrors.Register(ModuleName, 8, "invalid genesis state")
ErrNoProposalHandlerExists = sdkerrors.Register(ModuleName, 9, "no handler exists for proposal type")
)
12 changes: 6 additions & 6 deletions x/params/types/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (

// x/params module sentinel errors
var (
ErrUnknownSubspace = sdkerrors.Register(ModuleName, 1, "unknown subspace")
ErrSettingParameter = sdkerrors.Register(ModuleName, 2, "failed to set parameter")
ErrEmptyChanges = sdkerrors.Register(ModuleName, 3, "submitted parameter changes are empty")
ErrEmptySubspace = sdkerrors.Register(ModuleName, 4, "parameter subspace is empty")
ErrEmptyKey = sdkerrors.Register(ModuleName, 5, "parameter key is empty")
ErrEmptyValue = sdkerrors.Register(ModuleName, 6, "parameter value is empty")
ErrUnknownSubspace = sdkerrors.Register(ModuleName, 2, "unknown subspace")
ErrSettingParameter = sdkerrors.Register(ModuleName, 3, "failed to set parameter")
ErrEmptyChanges = sdkerrors.Register(ModuleName, 4, "submitted parameter changes are empty")
ErrEmptySubspace = sdkerrors.Register(ModuleName, 5, "parameter subspace is empty")
ErrEmptyKey = sdkerrors.Register(ModuleName, 6, "parameter key is empty")
ErrEmptyValue = sdkerrors.Register(ModuleName, 7, "parameter value is empty")
)
14 changes: 7 additions & 7 deletions x/slashing/internal/types/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import (

// x/slashing module sentinel errors
var (
ErrNoValidatorForAddress = sdkerrors.Register(ModuleName, 1, "address is not associated with any known validator")
ErrBadValidatorAddr = sdkerrors.Register(ModuleName, 2, "validator does not exist for that address")
ErrValidatorJailed = sdkerrors.Register(ModuleName, 3, "validator still jailed; cannot be unjailed")
ErrValidatorNotJailed = sdkerrors.Register(ModuleName, 4, "validator not jailed; cannot be unjailed")
ErrMissingSelfDelegation = sdkerrors.Register(ModuleName, 5, "validator has no self-delegation; cannot be unjailed")
ErrSelfDelegationTooLowToUnjail = sdkerrors.Register(ModuleName, 6, "validator's self delegation less than minimum; cannot be unjailed")
ErrNoSigningInfoFound = sdkerrors.Register(ModuleName, 7, "no validator signing info found")
ErrNoValidatorForAddress = sdkerrors.Register(ModuleName, 2, "address is not associated with any known validator")
ErrBadValidatorAddr = sdkerrors.Register(ModuleName, 3, "validator does not exist for that address")
ErrValidatorJailed = sdkerrors.Register(ModuleName, 4, "validator still jailed; cannot be unjailed")
ErrValidatorNotJailed = sdkerrors.Register(ModuleName, 5, "validator not jailed; cannot be unjailed")
ErrMissingSelfDelegation = sdkerrors.Register(ModuleName, 6, "validator has no self-delegation; cannot be unjailed")
ErrSelfDelegationTooLowToUnjail = sdkerrors.Register(ModuleName, 7, "validator's self delegation less than minimum; cannot be unjailed")
ErrNoSigningInfoFound = sdkerrors.Register(ModuleName, 8, "no validator signing info found")
)
Loading

0 comments on commit a63de30

Please sign in to comment.