Merge PR #5665: Bump Module ABCI Error Codes

This commit is contained in:
Alexander Bezobchuk 2020-02-18 14:43:00 +01:00 committed by GitHub
parent 794a496892
commit a63de303b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 97 additions and 96 deletions

View File

@ -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)

View File

@ -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")
)

View File

@ -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")
)

View File

@ -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")
)

View File

@ -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")
)

View File

@ -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")
)

View File

@ -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")
)

View File

@ -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")
)

View File

@ -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")
)

View File

@ -11,50 +11,50 @@ import (
//
// REF: https://github.com/cosmos/cosmos-sdk/issues/5450
var (
ErrEmptyValidatorAddr = sdkerrors.Register(ModuleName, 1, "empty validator address")
ErrBadValidatorAddr = sdkerrors.Register(ModuleName, 2, "validator address is invalid")
ErrNoValidatorFound = sdkerrors.Register(ModuleName, 3, "validator does not exist")
ErrValidatorOwnerExists = sdkerrors.Register(ModuleName, 4, "validator already exist for this operator address; must use new validator operator address")
ErrValidatorPubKeyExists = sdkerrors.Register(ModuleName, 5, "validator already exist for this pubkey; must use new validator pubkey")
ErrValidatorPubKeyTypeNotSupported = sdkerrors.Register(ModuleName, 6, "validator pubkey type is not supported")
ErrValidatorJailed = sdkerrors.Register(ModuleName, 7, "validator for this address is currently jailed")
ErrBadRemoveValidator = sdkerrors.Register(ModuleName, 8, "failed to remove validator")
ErrCommissionNegative = sdkerrors.Register(ModuleName, 9, "commission must be positive")
ErrCommissionHuge = sdkerrors.Register(ModuleName, 10, "commission cannot be more than 100%")
ErrCommissionGTMaxRate = sdkerrors.Register(ModuleName, 11, "commission cannot be more than the max rate")
ErrCommissionUpdateTime = sdkerrors.Register(ModuleName, 12, "commission cannot be changed more than once in 24h")
ErrCommissionChangeRateNegative = sdkerrors.Register(ModuleName, 13, "commission change rate must be positive")
ErrCommissionChangeRateGTMaxRate = sdkerrors.Register(ModuleName, 14, "commission change rate cannot be more than the max rate")
ErrCommissionGTMaxChangeRate = sdkerrors.Register(ModuleName, 15, "commission cannot be changed more than max change rate")
ErrSelfDelegationBelowMinimum = sdkerrors.Register(ModuleName, 16, "validator's self delegation must be greater than their minimum self delegation")
ErrMinSelfDelegationInvalid = sdkerrors.Register(ModuleName, 17, "minimum self delegation must be a positive integer")
ErrMinSelfDelegationDecreased = sdkerrors.Register(ModuleName, 18, "minimum self delegation cannot be decrease")
ErrEmptyDelegatorAddr = sdkerrors.Register(ModuleName, 19, "empty delegator address")
ErrBadDenom = sdkerrors.Register(ModuleName, 20, "invalid coin denomination")
ErrBadDelegationAddr = sdkerrors.Register(ModuleName, 21, "invalid address for (address, validator) tuple")
ErrBadDelegationAmount = sdkerrors.Register(ModuleName, 22, "invalid delegation amount")
ErrNoDelegation = sdkerrors.Register(ModuleName, 23, "no delegation for (address, validator) tuple")
ErrBadDelegatorAddr = sdkerrors.Register(ModuleName, 24, "delegator does not exist with address")
ErrNoDelegatorForAddress = sdkerrors.Register(ModuleName, 25, "delegator does not contain delegation")
ErrInsufficientShares = sdkerrors.Register(ModuleName, 26, "insufficient delegation shares")
ErrDelegationValidatorEmpty = sdkerrors.Register(ModuleName, 27, "cannot delegate to an empty validator")
ErrNotEnoughDelegationShares = sdkerrors.Register(ModuleName, 28, "not enough delegation shares")
ErrBadSharesAmount = sdkerrors.Register(ModuleName, 29, "invalid shares amount")
ErrBadSharesPercent = sdkerrors.Register(ModuleName, 30, "Invalid shares percent")
ErrNotMature = sdkerrors.Register(ModuleName, 31, "entry not mature")
ErrNoUnbondingDelegation = sdkerrors.Register(ModuleName, 32, "no unbonding delegation found")
ErrMaxUnbondingDelegationEntries = sdkerrors.Register(ModuleName, 33, "too many unbonding delegation entries for (delegator, validator) tuple")
ErrBadRedelegationAddr = sdkerrors.Register(ModuleName, 34, "invalid address for (address, src-validator, dst-validator) tuple")
ErrNoRedelegation = sdkerrors.Register(ModuleName, 35, "no redelegation found")
ErrSelfRedelegation = sdkerrors.Register(ModuleName, 36, "cannot redelegate to the same validator")
ErrTinyRedelegationAmount = sdkerrors.Register(ModuleName, 37, "too few tokens to redelegate (truncates to zero tokens)")
ErrBadRedelegationDst = sdkerrors.Register(ModuleName, 38, "redelegation destination validator not found")
ErrTransitiveRedelegation = sdkerrors.Register(ModuleName, 39, "redelegation to this validator already in progress; first redelegation to this validator must complete before next redelegation")
ErrMaxRedelegationEntries = sdkerrors.Register(ModuleName, 40, "too many redelegation entries for (delegator, src-validator, dst-validator) tuple")
ErrDelegatorShareExRateInvalid = sdkerrors.Register(ModuleName, 41, "cannot delegate to validators with invalid (zero) ex-rate")
ErrBothShareMsgsGiven = sdkerrors.Register(ModuleName, 42, "both shares amount and shares percent provided")
ErrNeitherShareMsgsGiven = sdkerrors.Register(ModuleName, 43, "neither shares amount nor shares percent provided")
ErrInvalidHistoricalInfo = sdkerrors.Register(ModuleName, 44, "invalid historical info")
ErrNoHistoricalInfo = sdkerrors.Register(ModuleName, 45, "no historical info found")
ErrEmptyValidatorPubKey = sdkerrors.Register(ModuleName, 46, "empty validator public key")
ErrEmptyValidatorAddr = sdkerrors.Register(ModuleName, 2, "empty validator address")
ErrBadValidatorAddr = sdkerrors.Register(ModuleName, 3, "validator address is invalid")
ErrNoValidatorFound = sdkerrors.Register(ModuleName, 4, "validator does not exist")
ErrValidatorOwnerExists = sdkerrors.Register(ModuleName, 5, "validator already exist for this operator address; must use new validator operator address")
ErrValidatorPubKeyExists = sdkerrors.Register(ModuleName, 6, "validator already exist for this pubkey; must use new validator pubkey")
ErrValidatorPubKeyTypeNotSupported = sdkerrors.Register(ModuleName, 7, "validator pubkey type is not supported")
ErrValidatorJailed = sdkerrors.Register(ModuleName, 8, "validator for this address is currently jailed")
ErrBadRemoveValidator = sdkerrors.Register(ModuleName, 9, "failed to remove validator")
ErrCommissionNegative = sdkerrors.Register(ModuleName, 10, "commission must be positive")
ErrCommissionHuge = sdkerrors.Register(ModuleName, 11, "commission cannot be more than 100%")
ErrCommissionGTMaxRate = sdkerrors.Register(ModuleName, 12, "commission cannot be more than the max rate")
ErrCommissionUpdateTime = sdkerrors.Register(ModuleName, 13, "commission cannot be changed more than once in 24h")
ErrCommissionChangeRateNegative = sdkerrors.Register(ModuleName, 14, "commission change rate must be positive")
ErrCommissionChangeRateGTMaxRate = sdkerrors.Register(ModuleName, 15, "commission change rate cannot be more than the max rate")
ErrCommissionGTMaxChangeRate = sdkerrors.Register(ModuleName, 16, "commission cannot be changed more than max change rate")
ErrSelfDelegationBelowMinimum = sdkerrors.Register(ModuleName, 17, "validator's self delegation must be greater than their minimum self delegation")
ErrMinSelfDelegationInvalid = sdkerrors.Register(ModuleName, 18, "minimum self delegation must be a positive integer")
ErrMinSelfDelegationDecreased = sdkerrors.Register(ModuleName, 19, "minimum self delegation cannot be decrease")
ErrEmptyDelegatorAddr = sdkerrors.Register(ModuleName, 20, "empty delegator address")
ErrBadDenom = sdkerrors.Register(ModuleName, 21, "invalid coin denomination")
ErrBadDelegationAddr = sdkerrors.Register(ModuleName, 22, "invalid address for (address, validator) tuple")
ErrBadDelegationAmount = sdkerrors.Register(ModuleName, 23, "invalid delegation amount")
ErrNoDelegation = sdkerrors.Register(ModuleName, 24, "no delegation for (address, validator) tuple")
ErrBadDelegatorAddr = sdkerrors.Register(ModuleName, 25, "delegator does not exist with address")
ErrNoDelegatorForAddress = sdkerrors.Register(ModuleName, 26, "delegator does not contain delegation")
ErrInsufficientShares = sdkerrors.Register(ModuleName, 27, "insufficient delegation shares")
ErrDelegationValidatorEmpty = sdkerrors.Register(ModuleName, 28, "cannot delegate to an empty validator")
ErrNotEnoughDelegationShares = sdkerrors.Register(ModuleName, 29, "not enough delegation shares")
ErrBadSharesAmount = sdkerrors.Register(ModuleName, 30, "invalid shares amount")
ErrBadSharesPercent = sdkerrors.Register(ModuleName, 31, "Invalid shares percent")
ErrNotMature = sdkerrors.Register(ModuleName, 32, "entry not mature")
ErrNoUnbondingDelegation = sdkerrors.Register(ModuleName, 33, "no unbonding delegation found")
ErrMaxUnbondingDelegationEntries = sdkerrors.Register(ModuleName, 34, "too many unbonding delegation entries for (delegator, validator) tuple")
ErrBadRedelegationAddr = sdkerrors.Register(ModuleName, 35, "invalid address for (address, src-validator, dst-validator) tuple")
ErrNoRedelegation = sdkerrors.Register(ModuleName, 36, "no redelegation found")
ErrSelfRedelegation = sdkerrors.Register(ModuleName, 37, "cannot redelegate to the same validator")
ErrTinyRedelegationAmount = sdkerrors.Register(ModuleName, 38, "too few tokens to redelegate (truncates to zero tokens)")
ErrBadRedelegationDst = sdkerrors.Register(ModuleName, 39, "redelegation destination validator not found")
ErrTransitiveRedelegation = sdkerrors.Register(ModuleName, 40, "redelegation to this validator already in progress; first redelegation to this validator must complete before next redelegation")
ErrMaxRedelegationEntries = sdkerrors.Register(ModuleName, 41, "too many redelegation entries for (delegator, src-validator, dst-validator) tuple")
ErrDelegatorShareExRateInvalid = sdkerrors.Register(ModuleName, 42, "cannot delegate to validators with invalid (zero) ex-rate")
ErrBothShareMsgsGiven = sdkerrors.Register(ModuleName, 43, "both shares amount and shares percent provided")
ErrNeitherShareMsgsGiven = sdkerrors.Register(ModuleName, 44, "neither shares amount nor shares percent provided")
ErrInvalidHistoricalInfo = sdkerrors.Register(ModuleName, 45, "invalid historical info")
ErrNoHistoricalInfo = sdkerrors.Register(ModuleName, 46, "no historical info found")
ErrEmptyValidatorPubKey = sdkerrors.Register(ModuleName, 47, "empty validator public key")
)