2018-05-30 15:25:18 -07:00
|
|
|
//nolint
|
2018-05-23 13:25:56 -07:00
|
|
|
package slashing
|
|
|
|
|
|
|
|
import (
|
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Local code type
|
|
|
|
type CodeType = sdk.CodeType
|
|
|
|
|
|
|
|
const (
|
|
|
|
// Default slashing codespace
|
2018-11-16 09:12:24 -08:00
|
|
|
DefaultCodespace sdk.CodespaceType = "SLASH"
|
2018-05-28 12:38:02 -07:00
|
|
|
|
2018-08-31 12:21:12 -07:00
|
|
|
CodeInvalidValidator CodeType = 101
|
|
|
|
CodeValidatorJailed CodeType = 102
|
|
|
|
CodeValidatorNotJailed CodeType = 103
|
|
|
|
CodeMissingSelfDelegation CodeType = 104
|
2018-05-23 13:25:56 -07:00
|
|
|
)
|
|
|
|
|
2018-05-28 12:38:02 -07:00
|
|
|
func ErrNoValidatorForAddress(codespace sdk.CodespaceType) sdk.Error {
|
2018-06-26 19:00:12 -07:00
|
|
|
return sdk.NewError(codespace, CodeInvalidValidator, "that address is not associated with any known validator")
|
2018-05-28 12:38:02 -07:00
|
|
|
}
|
2018-08-31 12:21:12 -07:00
|
|
|
|
2018-05-28 12:38:02 -07:00
|
|
|
func ErrBadValidatorAddr(codespace sdk.CodespaceType) sdk.Error {
|
2018-06-26 19:00:12 -07:00
|
|
|
return sdk.NewError(codespace, CodeInvalidValidator, "validator does not exist for that address")
|
2018-05-28 12:38:02 -07:00
|
|
|
}
|
2018-08-31 12:21:12 -07:00
|
|
|
|
2018-05-28 12:38:02 -07:00
|
|
|
func ErrValidatorJailed(codespace sdk.CodespaceType) sdk.Error {
|
2018-08-22 08:56:13 -07:00
|
|
|
return sdk.NewError(codespace, CodeValidatorJailed, "validator still jailed, cannot yet be unjailed")
|
2018-05-23 13:25:56 -07:00
|
|
|
}
|
2018-08-31 12:21:12 -07:00
|
|
|
|
2018-08-22 08:56:13 -07:00
|
|
|
func ErrValidatorNotJailed(codespace sdk.CodespaceType) sdk.Error {
|
|
|
|
return sdk.NewError(codespace, CodeValidatorNotJailed, "validator not jailed, cannot be unjailed")
|
2018-07-02 22:47:40 -07:00
|
|
|
}
|
2018-08-31 12:21:12 -07:00
|
|
|
|
|
|
|
func ErrMissingSelfDelegation(codespace sdk.CodespaceType) sdk.Error {
|
|
|
|
return sdk.NewError(codespace, CodeMissingSelfDelegation, "validator has no self-delegation; cannot be unjailed")
|
|
|
|
}
|