Documentation ¶
Index ¶
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- type Hooks
- func (h Hooks) AfterConsensusPubKeyUpdate(ctx context.Context, oldPubKey, newPubKey cryptotypes.PubKey, _ sdk.Coin) error
- func (h Hooks) AfterDelegationModified(_ context.Context, _ sdk.AccAddress, _ sdk.ValAddress) error
- func (h Hooks) AfterUnbondingInitiated(_ context.Context, _ uint64) error
- func (h Hooks) AfterValidatorBeginUnbonding(_ context.Context, _ sdk.ConsAddress, _ sdk.ValAddress) error
- func (h Hooks) AfterValidatorBonded(ctx context.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error
- func (h Hooks) AfterValidatorCreated(ctx context.Context, valAddr sdk.ValAddress) error
- func (h Hooks) AfterValidatorRemoved(ctx context.Context, consAddr sdk.ConsAddress, _ sdk.ValAddress) error
- func (h Hooks) BeforeDelegationCreated(_ context.Context, _ sdk.AccAddress, _ sdk.ValAddress) error
- func (h Hooks) BeforeDelegationRemoved(_ context.Context, _ sdk.AccAddress, _ sdk.ValAddress) error
- func (h Hooks) BeforeDelegationSharesModified(_ context.Context, _ sdk.AccAddress, _ sdk.ValAddress) error
- func (h Hooks) BeforeValidatorModified(_ context.Context, _ sdk.ValAddress) error
- func (h Hooks) BeforeValidatorSlashed(_ context.Context, _ sdk.ValAddress, _ sdkmath.LegacyDec) error
- type Keeper
- func (k Keeper) DeleteMissedBlockBitmap(ctx context.Context, addr sdk.ConsAddress) error
- func (k Keeper) DowntimeJailDuration(ctx context.Context) (time.Duration, error)
- func (keeper Keeper) ExportGenesis(ctx context.Context) (*types.GenesisState, error)
- func (k Keeper) GetAuthority() string
- func (k Keeper) GetMissedBlockBitmapValue(ctx context.Context, addr sdk.ConsAddress, index int64) (bool, error)
- func (k Keeper) GetPubkey(ctx context.Context, a cryptotypes.Address) (cryptotypes.PubKey, error)
- func (k Keeper) GetValidatorMissedBlocks(ctx context.Context, addr sdk.ConsAddress) ([]types.MissedBlock, error)
- func (k Keeper) HandleValidatorSignature(ctx context.Context, addr cryptotypes.Address, power int64, ...) error
- func (k Keeper) HandleValidatorSignatureWithParams(ctx context.Context, params types.Params, addr cryptotypes.Address, ...) error
- func (k Keeper) HasValidatorSigningInfo(ctx context.Context, consAddr sdk.ConsAddress) bool
- func (k Keeper) Hooks() Hooks
- func (keeper Keeper) InitGenesis(ctx context.Context, stakingKeeper types.StakingKeeper, ...) error
- func (k Keeper) IsTombstoned(ctx context.Context, consAddr sdk.ConsAddress) bool
- func (k Keeper) IterateMissedBlockBitmap(ctx context.Context, addr sdk.ConsAddress, ...) error
- func (k Keeper) Jail(ctx context.Context, consAddr sdk.ConsAddress) error
- func (k Keeper) JailUntil(ctx context.Context, consAddr sdk.ConsAddress, jailTime time.Time) error
- func (k Keeper) MinSignedPerWindow(ctx context.Context) (int64, error)
- func (k Keeper) SetMissedBlockBitmapChunk(ctx context.Context, addr sdk.ConsAddress, chunkIndex int64, chunk []byte) error
- func (k Keeper) SetMissedBlockBitmapValue(ctx context.Context, addr sdk.ConsAddress, index int64, missed bool) error
- func (k Keeper) SignedBlocksWindow(ctx context.Context) (int64, error)
- func (k Keeper) Slash(ctx context.Context, consAddr sdk.ConsAddress, fraction sdkmath.LegacyDec, ...) error
- func (k Keeper) SlashFractionDoubleSign(ctx context.Context) (sdkmath.LegacyDec, error)
- func (k Keeper) SlashFractionDowntime(ctx context.Context) (sdkmath.LegacyDec, error)
- func (k Keeper) SlashWithInfractionReason(ctx context.Context, consAddr sdk.ConsAddress, fraction sdkmath.LegacyDec, ...) error
- func (k Keeper) Tombstone(ctx context.Context, consAddr sdk.ConsAddress) error
- func (k Keeper) Unjail(ctx context.Context, validatorAddr sdk.ValAddress) error
- type Migrator
- type Querier
- func (k Querier) Params(ctx context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Querier) SigningInfo(ctx context.Context, req *types.QuerySigningInfoRequest) (*types.QuerySigningInfoResponse, error)
- func (k Querier) SigningInfos(ctx context.Context, req *types.QuerySigningInfosRequest) (*types.QuerySigningInfosResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMsgServerImpl ¶
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) AfterConsensusPubKeyUpdate ¶
func (h Hooks) AfterConsensusPubKeyUpdate(ctx context.Context, oldPubKey, newPubKey cryptotypes.PubKey, _ sdk.Coin) error
AfterConsensusPubKeyUpdate handles the rotation of signing info and updates the address-pubkey relation after a consensus key update.
func (Hooks) AfterDelegationModified ¶
func (h Hooks) AfterDelegationModified(_ context.Context, _ sdk.AccAddress, _ sdk.ValAddress) error
func (Hooks) AfterUnbondingInitiated ¶
func (Hooks) AfterValidatorBeginUnbonding ¶
func (h Hooks) AfterValidatorBeginUnbonding(_ context.Context, _ sdk.ConsAddress, _ sdk.ValAddress) error
func (Hooks) AfterValidatorBonded ¶
func (h Hooks) AfterValidatorBonded(ctx context.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 context.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(_ context.Context, _ sdk.AccAddress, _ sdk.ValAddress) error
func (Hooks) BeforeDelegationRemoved ¶
func (h Hooks) BeforeDelegationRemoved(_ context.Context, _ sdk.AccAddress, _ sdk.ValAddress) error
func (Hooks) BeforeDelegationSharesModified ¶
func (h Hooks) BeforeDelegationSharesModified(_ context.Context, _ sdk.AccAddress, _ sdk.ValAddress) error
func (Hooks) BeforeValidatorModified ¶
func (Hooks) BeforeValidatorSlashed ¶
type Keeper ¶
type Keeper struct { appmodule.Environment Schema collections.Schema Params collections.Item[types.Params] // ValidatorSigningInfo key: ConsAddr | value: ValidatorSigningInfo ValidatorSigningInfo collections.Map[sdk.ConsAddress, types.ValidatorSigningInfo] // AddrPubkeyRelation key: address | value: PubKey AddrPubkeyRelation collections.Map[[]byte, cryptotypes.PubKey] // ValidatorMissedBlockBitmap key: ConsAddr | value: byte key for a validator's missed block bitmap chunk ValidatorMissedBlockBitmap collections.Map[collections.Pair[[]byte, uint64], []byte] // contains filtered or unexported fields }
Keeper of the slashing store
func NewKeeper ¶
func NewKeeper(environment appmodule.Environment, cdc codec.BinaryCodec, legacyAmino *codec.LegacyAmino, sk types.StakingKeeper, authority string) Keeper
NewKeeper creates a slashing keeper
func (Keeper) DeleteMissedBlockBitmap ¶
DeleteMissedBlockBitmap removes a validator's missed block bitmap from state.
func (Keeper) DowntimeJailDuration ¶
DowntimeJailDuration - Downtime unbond duration
func (Keeper) ExportGenesis ¶
ExportGenesis writes the current store values to a genesis file, which can be imported again with InitGenesis
func (Keeper) GetAuthority ¶
GetAuthority returns the x/slashing module's authority.
func (Keeper) GetMissedBlockBitmapValue ¶
func (k Keeper) GetMissedBlockBitmapValue(ctx context.Context, addr sdk.ConsAddress, index int64) (bool, error)
GetMissedBlockBitmapValue returns true if a validator missed signing a block at the given index and false otherwise. The index provided is assumed to be the index in the range [0, SignedBlocksWindow), which represents the bitmap where each bit represents a height, and is determined by the validator's IndexOffset modulo SignedBlocksWindow. This index is used to fetch the chunk in the bitmap and the relative bit in that chunk.
func (Keeper) GetPubkey ¶
func (k Keeper) GetPubkey(ctx context.Context, a cryptotypes.Address) (cryptotypes.PubKey, error)
GetPubkey returns the pubkey from the address-pubkey relation
func (Keeper) GetValidatorMissedBlocks ¶
func (k Keeper) GetValidatorMissedBlocks(ctx context.Context, addr sdk.ConsAddress) ([]types.MissedBlock, error)
GetValidatorMissedBlocks returns array of missed blocks for given validator.
func (Keeper) HandleValidatorSignature ¶
func (k Keeper) HandleValidatorSignature(ctx context.Context, addr cryptotypes.Address, power int64, signed comet.BlockIDFlag) error
HandleValidatorSignature handles a validator signature, must be called once per validator for each block.
func (Keeper) HandleValidatorSignatureWithParams ¶
func (k Keeper) HandleValidatorSignatureWithParams(ctx context.Context, params types.Params, addr cryptotypes.Address, power int64, signed comet.BlockIDFlag) error
HandleValidatorSignature handles a validator signature with the provided slashing module params.
func (Keeper) HasValidatorSigningInfo ¶
HasValidatorSigningInfo returns if a given validator has signing information persisted.
func (Keeper) InitGenesis ¶
func (keeper Keeper) InitGenesis(ctx context.Context, stakingKeeper types.StakingKeeper, data *types.GenesisState) error
InitGenesis initializes 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) IterateMissedBlockBitmap ¶
func (k Keeper) IterateMissedBlockBitmap(ctx context.Context, addr sdk.ConsAddress, cb func(index int64, missed bool) (stop bool)) error
IterateMissedBlockBitmap iterates over a validator's signed blocks window bitmap and performs a callback function on each index, i.e. block height, in the range [0, SignedBlocksWindow).
Note: A callback will only be executed over all bitmap chunks that exist in state.
func (Keeper) Jail ¶
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.
func (Keeper) MinSignedPerWindow ¶
MinSignedPerWindow - minimum blocks signed per window
func (Keeper) SetMissedBlockBitmapChunk ¶
func (k Keeper) SetMissedBlockBitmapChunk(ctx context.Context, addr sdk.ConsAddress, chunkIndex int64, chunk []byte) error
SetMissedBlockBitmapChunk sets the bitmap chunk at the given chunk index for a validator's missed block signing window.
func (Keeper) SetMissedBlockBitmapValue ¶
func (k Keeper) SetMissedBlockBitmapValue(ctx context.Context, addr sdk.ConsAddress, index int64, missed bool) error
SetMissedBlockBitmapValue sets, i.e. flips, a bit in the validator's missed block bitmap. When missed=true, the bit is set, otherwise it set to zero. The index provided is assumed to be the index in the range [0, SignedBlocksWindow), which represents the bitmap where each bit represents a height, and is determined by the validator's IndexOffset modulo SignedBlocksWindow. This index is used to fetch the chunk in the bitmap and the relative bit in that chunk.
func (Keeper) SignedBlocksWindow ¶
SignedBlocksWindow - sliding window for downtime slashing
func (Keeper) Slash ¶
func (k Keeper) Slash(ctx context.Context, consAddr sdk.ConsAddress, fraction sdkmath.LegacyDec, power, distributionHeight int64) error
Slash attempts to slash a validator. The slash is delegated to the staking module to make the necessary validator changes. It specifies no infraction 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 ¶
func (k Keeper) SlashWithInfractionReason(ctx context.Context, consAddr sdk.ConsAddress, fraction sdkmath.LegacyDec, power, distributionHeight int64, infraction st.Infraction) error
SlashWithInfractionReason attempts to slash a validator. The slash is delegated to the staking module to make the necessary validator changes. It specifies an infraction reason.
type Migrator ¶
type Migrator struct {
// contains filtered or unexported fields
}
Migrator is a struct for handling in-place store migrations.
func NewMigrator ¶
func NewMigrator(keeper Keeper, valCodec address.ValidatorAddressCodec) Migrator
NewMigrator returns a new Migrator.
func (Migrator) Migrate1to2 ¶
Migrate1to2 migrates from version 1 to 2.
func (Migrator) Migrate2to3 ¶
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.
type Querier ¶
type Querier struct {
Keeper
}
func NewQuerier ¶
func (Querier) Params ¶
func (k Querier) Params(ctx context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
Params returns parameters of x/slashing module
func (Querier) SigningInfo ¶
func (k Querier) SigningInfo(ctx context.Context, req *types.QuerySigningInfoRequest) (*types.QuerySigningInfoResponse, error)
SigningInfo returns signing-info of a specific validator.
func (Querier) SigningInfos ¶
func (k Querier) SigningInfos(ctx context.Context, req *types.QuerySigningInfosRequest) (*types.QuerySigningInfosResponse, error)
SigningInfos returns signing-infos of all validators.