Documentation ¶
Overview ¶
nolint
Index ¶
- Constants
- func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, sk Keeper) (tags sdk.Tags)
- func ErrBadValidatorAddr(codespace sdk.CodespaceType) sdk.Error
- func ErrNoValidatorForAddress(codespace sdk.CodespaceType) sdk.Error
- func ErrValidatorJailed(codespace sdk.CodespaceType) sdk.Error
- func ErrValidatorNotRevoked(codespace sdk.CodespaceType) sdk.Error
- func GetValidatorSigningBitArrayKey(v sdk.ValAddress, i int64) []byte
- func GetValidatorSigningInfoKey(v sdk.ValAddress) []byte
- func InitGenesis(ctx sdk.Context, keeper Keeper, data types.GenesisState)
- func NewHandler(k Keeper) sdk.Handler
- func RegisterWire(cdc *wire.Codec)
- type CodeType
- type Keeper
- func (k Keeper) AddValidators(ctx sdk.Context, vals []abci.Validator)
- func (k Keeper) DoubleSignUnbondDuration(ctx sdk.Context) time.Duration
- func (k Keeper) DowntimeUnbondDuration(ctx sdk.Context) time.Duration
- func (k Keeper) MaxEvidenceAge(ctx sdk.Context) time.Duration
- func (k Keeper) MinSignedPerWindow(ctx sdk.Context) int64
- func (k Keeper) SignedBlocksWindow(ctx sdk.Context) int64
- func (k Keeper) SlashFractionDoubleSign(ctx sdk.Context) sdk.Rat
- func (k Keeper) SlashFractionDowntime(ctx sdk.Context) sdk.Rat
- type MsgUnrevoke
- type ValidatorSigningInfo
Constants ¶
const ( MaxEvidenceAgeKey = "slashing/MaxEvidenceAge" SignedBlocksWindowKey = "slashing/SignedBlocksWindow" MinSignedPerWindowKey = "slashing/MinSignedPerWindow" DoubleSignUnbondDurationKey = "slashing/DoubleSignUnbondDuration" DowntimeUnbondDurationKey = "slashing/DowntimeUnbondDuration" SlashFractionDoubleSignKey = "slashing/SlashFractionDoubleSign" SlashFractionDowntimeKey = "slashing/SlashFractionDowntime" )
nolint
const MsgType = "slashing"
name to identify transaction types
Variables ¶
This section is empty.
Functions ¶
func BeginBlocker ¶
slashing begin block functionality
func ErrBadValidatorAddr ¶
func ErrBadValidatorAddr(codespace sdk.CodespaceType) sdk.Error
func ErrNoValidatorForAddress ¶
func ErrNoValidatorForAddress(codespace sdk.CodespaceType) sdk.Error
func ErrValidatorJailed ¶
func ErrValidatorJailed(codespace sdk.CodespaceType) sdk.Error
func ErrValidatorNotRevoked ¶
func ErrValidatorNotRevoked(codespace sdk.CodespaceType) sdk.Error
func GetValidatorSigningBitArrayKey ¶
func GetValidatorSigningBitArrayKey(v sdk.ValAddress, i int64) []byte
Stored by *validator* address (not owner address)
func GetValidatorSigningInfoKey ¶
func GetValidatorSigningInfoKey(v sdk.ValAddress) []byte
Stored by *validator* address (not owner address)
func InitGenesis ¶
func InitGenesis(ctx sdk.Context, keeper Keeper, data types.GenesisState)
InitGenesis initializes the keeper's address to pubkey map.
func NewHandler ¶
Types ¶
type CodeType ¶
Local code type
const ( // Default slashing codespace DefaultCodespace sdk.CodespaceType = 10 CodeInvalidValidator CodeType = 101 CodeValidatorJailed CodeType = 102 CodeValidatorNotRevoked CodeType = 103 )
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper of the slashing store
func NewKeeper ¶
func NewKeeper(cdc *wire.Codec, key sdk.StoreKey, vs sdk.ValidatorSet, params params.Getter, codespace sdk.CodespaceType) Keeper
NewKeeper creates a slashing keeper
func (Keeper) AddValidators ¶
AddValidators adds the validators to the keepers validator addr to pubkey mapping.
func (Keeper) DoubleSignUnbondDuration ¶
Double-sign unbond duration
func (Keeper) DowntimeUnbondDuration ¶
Downtime unbond duration
func (Keeper) MaxEvidenceAge ¶
MaxEvidenceAge - Max age for evidence - 21 days (3 weeks) MaxEvidenceAge = 60 * 60 * 24 * 7 * 3
func (Keeper) MinSignedPerWindow ¶
Downtime slashing thershold - default 50%
func (Keeper) SignedBlocksWindow ¶
SignedBlocksWindow - sliding window for downtime slashing
func (Keeper) SlashFractionDoubleSign ¶
SlashFractionDoubleSign - currently default 5%
type MsgUnrevoke ¶
type MsgUnrevoke struct {
ValidatorAddr sdk.AccAddress `json:"address"` // address of the validator owner
}
MsgUnrevoke - struct for unrevoking revoked validator
func NewMsgUnrevoke ¶
func NewMsgUnrevoke(validatorAddr sdk.AccAddress) MsgUnrevoke
func (MsgUnrevoke) GetSignBytes ¶
func (msg MsgUnrevoke) GetSignBytes() []byte
get the bytes for the message signer to sign on
func (MsgUnrevoke) GetSigners ¶
func (msg MsgUnrevoke) GetSigners() []sdk.AccAddress
func (MsgUnrevoke) ValidateBasic ¶
func (msg MsgUnrevoke) ValidateBasic() sdk.Error
quick validity check
type ValidatorSigningInfo ¶
type ValidatorSigningInfo struct { StartHeight int64 `json:"start_height"` // height at which validator was first a candidate OR was unrevoked IndexOffset int64 `json:"index_offset"` // index offset into signed block bit array JailedUntil time.Time `json:"jailed_until"` // timestamp validator cannot be unrevoked until SignedBlocksCounter int64 `json:"signed_blocks_counter"` // signed blocks counter (to avoid scanning the array every time) }
Signing info for a validator
func NewValidatorSigningInfo ¶
func NewValidatorSigningInfo(startHeight int64, indexOffset int64, jailedUntil time.Time, signedBlocksCounter int64) ValidatorSigningInfo
Construct a new `ValidatorSigningInfo` struct
func (ValidatorSigningInfo) HumanReadableString ¶
func (i ValidatorSigningInfo) HumanReadableString() string
Return human readable signing info