Documentation ¶
Overview ¶
nolint
Index ¶
- Variables
- func NewQuerier(k Keeper) sdk.Querier
- func NewTestMsgCreateValidator(acc chaintype.AccountID, pubKey crypto.PubKey, amt sdk.Int) external.StakingMsgCreateValidator
- func NewTestMsgDelegate(delAddr chaintype.AccountID, valAddr chaintype.AccountID, delAmount sdk.Int) external.StakingMsgDelegate
- func TestParams() types.Params
- type Hooks
- func (h Hooks) AfterDelegationModified(_ sdk.Context, _ types.AccountID, _ types.AccountID)
- func (h Hooks) AfterValidatorBeginUnbonding(_ sdk.Context, _ sdk.ConsAddress, _ types.AccountID)
- func (h Hooks) AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr types.AccountID)
- func (h Hooks) AfterValidatorCreated(ctx sdk.Context, valAddr types.AccountID)
- func (h Hooks) AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, _ types.AccountID)
- func (h Hooks) BeforeDelegationCreated(_ sdk.Context, _ types.AccountID, _ types.AccountID)
- func (h Hooks) BeforeDelegationRemoved(_ sdk.Context, _ types.AccountID, _ types.AccountID)
- func (h Hooks) BeforeDelegationSharesModified(_ sdk.Context, _ types.AccountID, _ types.AccountID)
- func (h Hooks) BeforeValidatorModified(_ sdk.Context, _ types.AccountID)
- func (h Hooks) BeforeValidatorSlashed(_ sdk.Context, _ types.AccountID, _ sdk.Dec)
- type Keeper
- func (k Keeper) AddPubkey(ctx sdk.Context, pubkey crypto.PubKey)
- func (k Keeper) AfterValidatorBonded(ctx sdk.Context, acc sdk.ConsAddress, _ types.AccountID)
- func (k Keeper) AfterValidatorCreated(ctx sdk.Context, valAddr types.AccountID)
- func (k Keeper) AfterValidatorRemoved(ctx sdk.Context, address sdk.ConsAddress)
- func (k Keeper) DowntimeJailDuration(ctx sdk.Context) (res time.Duration)
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetPubkey(ctx sdk.Context, address crypto.Address) (crypto.PubKey, error)
- func (k Keeper) GetValidatorMissedBlockBitArray(ctx sdk.Context, address sdk.ConsAddress, index int64) bool
- func (k Keeper) GetValidatorSigningInfo(ctx sdk.Context, address sdk.ConsAddress) (info types.ValidatorSigningInfo, found bool)
- func (k Keeper) HandleValidatorSignature(ctx sdk.Context, addr crypto.Address, power int64, signed bool)
- func (k Keeper) HasValidatorSigningInfo(ctx sdk.Context, consAddr sdk.ConsAddress) bool
- func (k Keeper) Hooks() Hooks
- func (k Keeper) IsTombstoned(ctx sdk.Context, consAddr sdk.ConsAddress) bool
- func (k Keeper) IterateValidatorMissedBlockBitArray(ctx sdk.Context, address sdk.ConsAddress, ...)
- func (k Keeper) IterateValidatorSigningInfos(ctx sdk.Context, ...)
- func (k Keeper) Jail(ctx sdk.Context, consAcc sdk.ConsAddress)
- func (k Keeper) JailUntil(ctx sdk.Context, consAddr sdk.ConsAddress, jailTime time.Time)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) MinSignedPerWindow(ctx sdk.Context) int64
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) SetValidatorMissedBlockBitArray(ctx sdk.Context, address sdk.ConsAddress, index int64, missed bool)
- func (k Keeper) SetValidatorSigningInfo(ctx sdk.Context, address sdk.ConsAddress, info types.ValidatorSigningInfo)
- func (k Keeper) SignedBlocksWindow(ctx sdk.Context) (res int64)
- func (k Keeper) Slash(ctx sdk.Context, consAcc sdk.ConsAddress, fraction sdk.Dec, ...)
- func (k Keeper) SlashFractionDoubleSign(ctx sdk.Context) (res sdk.Dec)
- func (k Keeper) SlashFractionDowntime(ctx sdk.Context) (res sdk.Dec)
- func (k Keeper) Tombstone(ctx sdk.Context, consAddr sdk.ConsAddress)
- func (k Keeper) Unjail(ctx sdk.Context, valAccountID types.AccountID) error
Constants ¶
This section is empty.
Variables ¶
var (
InitTokens = external.TokensFromConsensusPower(200)
)
Functions ¶
func NewQuerier ¶
NewQuerier creates a new querier for slashing clients.
func NewTestMsgDelegate ¶
func TestParams ¶
Have to change these parameters for tests lest the tests take forever
Types ¶
type Hooks ¶
type Hooks struct {
// contains filtered or unexported fields
}
Hooks wrapper struct for slashing keeper
func (Hooks) AfterDelegationModified ¶
func (Hooks) AfterValidatorBeginUnbonding ¶
nolint - unused hooks
func (Hooks) AfterValidatorBonded ¶
func (h Hooks) AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr types.AccountID)
Implements sdk.ValidatorHooks
func (Hooks) AfterValidatorCreated ¶
Implements sdk.ValidatorHooks
func (Hooks) AfterValidatorRemoved ¶
Implements sdk.ValidatorHooks
func (Hooks) BeforeDelegationCreated ¶
func (Hooks) BeforeDelegationRemoved ¶
func (Hooks) BeforeDelegationSharesModified ¶
func (Hooks) BeforeValidatorModified ¶
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper of the slashing store
func NewKeeper ¶
func NewKeeper(cdc codec.Marshaler, key sdk.StoreKey, sk types.StakingKeeper, paramspace types.ParamSubspace) Keeper
NewKeeper creates a slashing keeper
func (Keeper) AfterValidatorBonded ¶
func (Keeper) AfterValidatorCreated ¶
When a validator is created, add the address-pubkey relation.
func (Keeper) AfterValidatorRemoved ¶
func (k Keeper) AfterValidatorRemoved(ctx sdk.Context, address sdk.ConsAddress)
When a validator is removed, delete the address-pubkey relation.
func (Keeper) DowntimeJailDuration ¶
DowntimeJailDuration - Downtime unbond duration
func (Keeper) GetValidatorMissedBlockBitArray ¶
func (k Keeper) GetValidatorMissedBlockBitArray(ctx sdk.Context, address sdk.ConsAddress, index int64) bool
GetValidatorMissedBlockBitArray gets the bit for the missed blocks array
func (Keeper) GetValidatorSigningInfo ¶
func (k Keeper) GetValidatorSigningInfo(ctx sdk.Context, address sdk.ConsAddress) (info types.ValidatorSigningInfo, found bool)
GetValidatorSigningInfo retruns the ValidatorSigningInfo for a specific validator ConsAddress
func (Keeper) HandleValidatorSignature ¶
func (k Keeper) HandleValidatorSignature(ctx sdk.Context, addr crypto.Address, power int64, signed bool)
HandleValidatorSignature handles a validator signature, must be called once per validator per block.
func (Keeper) HasValidatorSigningInfo ¶
HasValidatorSigningInfo returns if a given validator has signing information persited.
func (Keeper) IsTombstoned ¶
IsTombstoned returns if a given validator by consensus address is tombstoned.
func (Keeper) IterateValidatorMissedBlockBitArray ¶
func (k Keeper) IterateValidatorMissedBlockBitArray(ctx sdk.Context, address sdk.ConsAddress, handler func(index int64, missed bool) (stop bool))
IterateValidatorMissedBlockBitArray iterates over the signed blocks window and performs a callback function
func (Keeper) IterateValidatorSigningInfos ¶
func (k Keeper) IterateValidatorSigningInfos(ctx sdk.Context, handler func(address sdk.ConsAddress, info types.ValidatorSigningInfo) (stop bool))
IterateValidatorSigningInfos iterates over the stored ValidatorSigningInfo
func (Keeper) Jail ¶
func (k Keeper) Jail(ctx sdk.Context, consAcc sdk.ConsAddress)
Jail attempts to jail a validator. The slash is delegated to the staking module to make the necessary validator changes.
func (Keeper) JailUntil ¶
JailUntil attempts to set a validator's JailedUntil attribute in its signing info. It will panic if the signing info does not exist for the validator.
func (Keeper) MinSignedPerWindow ¶
MinSignedPerWindow - minimum blocks signed per window
func (Keeper) SetValidatorMissedBlockBitArray ¶
func (k Keeper) SetValidatorMissedBlockBitArray(ctx sdk.Context, address sdk.ConsAddress, index int64, missed bool)
SetValidatorMissedBlockBitArray sets the bit that checks if the validator has missed a block in the current window
func (Keeper) SetValidatorSigningInfo ¶
func (k Keeper) SetValidatorSigningInfo(ctx sdk.Context, address sdk.ConsAddress, info types.ValidatorSigningInfo)
SetValidatorSigningInfo sets the validator signing info to a consensus address key
func (Keeper) SignedBlocksWindow ¶
SignedBlocksWindow - sliding window for downtime slashing
func (Keeper) Slash ¶
func (k Keeper) Slash(ctx sdk.Context, consAcc sdk.ConsAddress, fraction sdk.Dec, power, distributionHeight int64)
Slash attempts to slash a validator. The slash is delegated to the staking module to make the necessary validator changes.
func (Keeper) SlashFractionDoubleSign ¶
SlashFractionDoubleSign - fraction of power slashed in case of double sign
func (Keeper) SlashFractionDowntime ¶
SlashFractionDowntime - fraction of power slashed for downtime