Documentation ¶
Index ¶
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- type Hooks
- func (h Hooks) AfterDelegationModified(_ sdk.Context, _ sdk.AccAddress, _ sdk.ValAddress) error
- func (h Hooks) AfterUnbondingInitiated(_ sdk.Context, _ uint64) error
- func (h Hooks) AfterValidatorBeginUnbonding(_ sdk.Context, _ sdk.ConsAddress, _ sdk.ValAddress) error
- func (h Hooks) AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error
- func (h Hooks) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress) error
- func (h Hooks) AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, _ sdk.ValAddress) error
- func (h Hooks) BeforeDelegationCreated(_ sdk.Context, _ sdk.AccAddress, _ sdk.ValAddress) error
- func (h Hooks) BeforeDelegationRemoved(_ sdk.Context, _ sdk.AccAddress, _ sdk.ValAddress) error
- func (h Hooks) BeforeDelegationSharesModified(_ sdk.Context, _ sdk.AccAddress, _ sdk.ValAddress) error
- func (h Hooks) BeforeTokenizeShareRecordRemoved(_ sdk.Context, _ uint64) error
- func (h Hooks) BeforeValidatorModified(_ sdk.Context, _ sdk.ValAddress) error
- func (h Hooks) BeforeValidatorSlashed(_ sdk.Context, _ sdk.ValAddress, _ sdk.Dec) error
- type Keeper
- func (k Keeper) AddPubkey(ctx sdk.Context, pubkey cryptotypes.PubKey) error
- func (k Keeper) DowntimeJailDuration(ctx sdk.Context) (res time.Duration)
- func (keeper Keeper) ExportGenesis(ctx sdk.Context) (data *types.GenesisState)
- func (k Keeper) GetAuthority() string
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetPubkey(ctx sdk.Context, a cryptotypes.Address) (cryptotypes.PubKey, error)
- func (k Keeper) GetValidatorMissedBlockBitArray(ctx sdk.Context, address sdk.ConsAddress, index int64) bool
- func (k Keeper) GetValidatorMissedBlocks(ctx sdk.Context, address sdk.ConsAddress) []types.MissedBlock
- func (k Keeper) GetValidatorSigningInfo(ctx sdk.Context, address sdk.ConsAddress) (info types.ValidatorSigningInfo, found bool)
- func (k Keeper) HandleValidatorSignature(ctx sdk.Context, addr cryptotypes.Address, power int64, signed bool)
- func (k Keeper) HasValidatorSigningInfo(ctx sdk.Context, consAddr sdk.ConsAddress) bool
- func (k Keeper) Hooks() Hooks
- func (keeper Keeper) InitGenesis(ctx sdk.Context, stakingKeeper types.StakingKeeper, data *types.GenesisState)
- 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, consAddr 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) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params) error
- 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) SigningInfo(c context.Context, req *types.QuerySigningInfoRequest) (*types.QuerySigningInfoResponse, error)
- func (k Keeper) SigningInfos(c context.Context, req *types.QuerySigningInfosRequest) (*types.QuerySigningInfosResponse, error)
- func (k Keeper) Slash(ctx sdk.Context, consAddr 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) SlashWithInfractionReason(ctx sdk.Context, consAddr sdk.ConsAddress, fraction sdk.Dec, ...)
- func (k Keeper) Tombstone(ctx sdk.Context, consAddr sdk.ConsAddress)
- func (k Keeper) Unjail(ctx sdk.Context, validatorAddr sdk.ValAddress) error
- type Migrator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMsgServerImpl ¶ added in v0.40.0
NewMsgServerImpl returns an implementation of the slashing MsgServer interface for the provided Keeper.
Types ¶
type Hooks ¶
type Hooks struct {
// contains filtered or unexported fields
}
Hooks wrapper struct for slashing keeper
func (Hooks) AfterDelegationModified ¶
func (h Hooks) AfterDelegationModified(_ sdk.Context, _ sdk.AccAddress, _ sdk.ValAddress) error
func (Hooks) AfterUnbondingInitiated ¶ added in v0.47.0
func (Hooks) AfterValidatorBeginUnbonding ¶
func (h Hooks) AfterValidatorBeginUnbonding(_ sdk.Context, _ sdk.ConsAddress, _ sdk.ValAddress) error
func (Hooks) AfterValidatorBonded ¶
func (h Hooks) AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error
AfterValidatorBonded updates the signing info start height or create a new signing info
func (Hooks) AfterValidatorCreated ¶
AfterValidatorCreated adds the address-pubkey relation when a validator is created.
func (Hooks) AfterValidatorRemoved ¶
func (h Hooks) AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, _ sdk.ValAddress) error
AfterValidatorRemoved deletes the address-pubkey relation when a validator is removed,
func (Hooks) BeforeDelegationCreated ¶
func (h Hooks) BeforeDelegationCreated(_ sdk.Context, _ sdk.AccAddress, _ sdk.ValAddress) error
func (Hooks) BeforeDelegationRemoved ¶
func (h Hooks) BeforeDelegationRemoved(_ sdk.Context, _ sdk.AccAddress, _ sdk.ValAddress) error
func (Hooks) BeforeDelegationSharesModified ¶
func (h Hooks) BeforeDelegationSharesModified(_ sdk.Context, _ sdk.AccAddress, _ sdk.ValAddress) error
func (Hooks) BeforeTokenizeShareRecordRemoved ¶
func (Hooks) BeforeValidatorModified ¶
func (Hooks) BeforeValidatorSlashed ¶
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper of the slashing store
func NewKeeper ¶
func NewKeeper(cdc codec.BinaryCodec, legacyAmino *codec.LegacyAmino, key storetypes.StoreKey, sk types.StakingKeeper, authority string) Keeper
NewKeeper creates a slashing keeper
func (Keeper) DowntimeJailDuration ¶
DowntimeJailDuration - Downtime unbond duration
func (Keeper) ExportGenesis ¶ added in v0.46.0
func (keeper Keeper) ExportGenesis(ctx sdk.Context) (data *types.GenesisState)
ExportGenesis writes the current store values to a genesis file, which can be imported again with InitGenesis
func (Keeper) GetAuthority ¶ added in v0.47.0
GetAuthority returns the x/slashing module's authority.
func (Keeper) GetPubkey ¶
func (k Keeper) GetPubkey(ctx sdk.Context, a cryptotypes.Address) (cryptotypes.PubKey, error)
GetPubkey returns the pubkey from the adddress-pubkey relation
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) GetValidatorMissedBlocks ¶ added in v0.40.0
func (k Keeper) GetValidatorMissedBlocks(ctx sdk.Context, address sdk.ConsAddress) []types.MissedBlock
GetValidatorMissedBlocks returns array of missed blocks for given validator Cons address
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 cryptotypes.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) InitGenesis ¶ added in v0.46.0
func (keeper Keeper) InitGenesis(ctx sdk.Context, stakingKeeper types.StakingKeeper, data *types.GenesisState)
InitGenesis initialize default parameters and the keeper's address to pubkey map
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, consAddr 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) Params ¶ added in v0.40.0
func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
Params returns parameters of x/slashing module
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) SigningInfo ¶ added in v0.40.0
func (k Keeper) SigningInfo(c context.Context, req *types.QuerySigningInfoRequest) (*types.QuerySigningInfoResponse, error)
SigningInfo returns signing-info of a specific validator.
func (Keeper) SigningInfos ¶ added in v0.40.0
func (k Keeper) SigningInfos(c context.Context, req *types.QuerySigningInfosRequest) (*types.QuerySigningInfosResponse, error)
SigningInfos returns signing-infos of all validators.
func (Keeper) Slash ¶
func (k Keeper) Slash(ctx sdk.Context, consAddr 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. It specifies no intraction reason.
func (Keeper) SlashFractionDoubleSign ¶
SlashFractionDoubleSign - fraction of power slashed in case of double sign
func (Keeper) SlashFractionDowntime ¶
SlashFractionDowntime - fraction of power slashed for downtime
func (Keeper) SlashWithInfractionReason ¶ added in v0.47.0
func (k Keeper) SlashWithInfractionReason(ctx sdk.Context, consAddr sdk.ConsAddress, fraction sdk.Dec, power, distributionHeight int64, infraction stakingtypes.Infraction)
SlashWithInfractionReason attempts to slash a validator. The slash is delegated to the staking module to make the necessary validator changes. It specifies an intraction reason.
type Migrator ¶ added in v0.43.0
type Migrator struct {
// contains filtered or unexported fields
}
Migrator is a struct for handling in-place store migrations.
func NewMigrator ¶ added in v0.43.0
NewMigrator returns a new Migrator.
func (Migrator) Migrate1to2 ¶ added in v0.43.0
Migrate1to2 migrates from version 1 to 2.
func (Migrator) Migrate2to3 ¶ added in v0.47.0
Migrate2to3 migrates the x/slashing module state from the consensus version 2 to version 3. Specifically, it takes the parameters that are currently stored and managed by the x/params modules and stores them directly into the x/slashing module state.