Documentation ¶
Index ¶
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- type Hooks
- 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) AddPubkey(ctx context.Context, pubkey cryptotypes.PubKey) error
- 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 sdk.Context) (data *types.GenesisState)
- func (k Keeper) GetAuthority() string
- func (k Keeper) GetMissedBlockBitmapValue(ctx context.Context, addr sdk.ConsAddress, index int64) (bool, error)
- func (k Keeper) GetParams(ctx context.Context) (params types.Params, err 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) GetValidatorSigningInfo(ctx context.Context, address sdk.ConsAddress) (types.ValidatorSigningInfo, error)
- func (k Keeper) HandleValidatorSignature(ctx context.Context, addr cryptotypes.Address, power int64, ...) error
- func (k Keeper) HasValidatorSigningInfo(ctx context.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 context.Context, consAddr sdk.ConsAddress) bool
- func (k Keeper) IterateMissedBlockBitmap(ctx context.Context, addr sdk.ConsAddress, ...) error
- func (k Keeper) IterateValidatorSigningInfos(ctx context.Context, ...) 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) Logger(ctx context.Context) log.Logger
- func (k Keeper) MinSignedPerWindow(ctx context.Context) (int64, error)
- func (k Keeper) Params(ctx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Keeper) SetMissedBlockBitmapValue(ctx context.Context, addr sdk.ConsAddress, index int64, missed bool) error
- func (k Keeper) SetParams(ctx context.Context, params types.Params) error
- func (k Keeper) SetValidatorSigningInfo(ctx context.Context, address sdk.ConsAddress, info types.ValidatorSigningInfo) error
- func (k Keeper) SignedBlocksWindow(ctx context.Context) (int64, error)
- func (k Keeper) SigningInfo(ctx context.Context, req *types.QuerySigningInfoRequest) (*types.QuerySigningInfoResponse, error)
- func (k Keeper) SigningInfos(ctx context.Context, req *types.QuerySigningInfosRequest) (*types.QuerySigningInfosResponse, 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
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) 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 {
// contains filtered or unexported fields
}
Keeper of the slashing store
func NewKeeper ¶
func NewKeeper(cdc codec.BinaryCodec, legacyAmino *codec.LegacyAmino, storeService storetypes.KVStoreService, 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 ¶
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 ¶
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 adddress-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) GetValidatorSigningInfo ¶
func (k Keeper) GetValidatorSigningInfo(ctx context.Context, address sdk.ConsAddress) (types.ValidatorSigningInfo, error)
GetValidatorSigningInfo retruns the ValidatorSigningInfo for a specific validator ConsAddress. If not found it returns ErrNoSigningInfoFound, but other errors may be returned if there is an error reading from the store.
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 per block.
func (Keeper) HasValidatorSigningInfo ¶
HasValidatorSigningInfo returns if a given validator has signing information persisted.
func (Keeper) InitGenesis ¶
func (keeper Keeper) InitGenesis(ctx sdk.Context, stakingKeeper types.StakingKeeper, data *types.GenesisState)
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) IterateValidatorSigningInfos ¶
func (k Keeper) IterateValidatorSigningInfos(ctx context.Context, handler func(address sdk.ConsAddress, info types.ValidatorSigningInfo) (stop bool), ) error
IterateValidatorSigningInfos iterates over the stored ValidatorSigningInfo
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. 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 ¶
func (k Keeper) Params(ctx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
Params returns parameters of x/slashing module
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) SetParams ¶
SetParams sets the x/slashing module parameters. CONTRACT: This method performs no validation of the parameters.
func (Keeper) SetValidatorSigningInfo ¶
func (k Keeper) SetValidatorSigningInfo(ctx context.Context, address sdk.ConsAddress, info types.ValidatorSigningInfo) error
SetValidatorSigningInfo sets the validator signing info to a consensus address key
func (Keeper) SignedBlocksWindow ¶
SignedBlocksWindow - sliding window for downtime slashing
func (Keeper) SigningInfo ¶
func (k Keeper) SigningInfo(ctx context.Context, req *types.QuerySigningInfoRequest) (*types.QuerySigningInfoResponse, error)
SigningInfo returns signing-info of a specific validator.
func (Keeper) SigningInfos ¶
func (k Keeper) SigningInfos(ctx context.Context, req *types.QuerySigningInfosRequest) (*types.QuerySigningInfosResponse, error)
SigningInfos returns signing-infos of all validators.
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 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 ¶
func (k Keeper) SlashWithInfractionReason(ctx context.Context, consAddr sdk.ConsAddress, fraction sdkmath.LegacyDec, power, distributionHeight int64, infraction stakingtypes.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 intraction reason.
type Migrator ¶
type Migrator struct {
// contains filtered or unexported fields
}
Migrator is a struct for handling in-place store migrations.
func NewMigrator ¶
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.