keeper

package
v1.6.43 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the slashing MsgServer interface for the provided Keeper.

func NewQuerier

func NewQuerier(k Keeper, legacyQuerierCdc *codec.Codec) sdk.Querier

NewQuerier creates a new querier for slashing clients.

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.AccAddress)

func (Hooks) AfterValidatorBeginUnbonding

func (h Hooks) AfterValidatorBeginUnbonding(_ sdk.Context, _ sdk.AccAddress, _ sdk.AccAddress)

func (Hooks) AfterValidatorBonded

func (h Hooks) AfterValidatorBonded(ctx sdk.Context, consAddr sdk.AccAddress, valAddr sdk.AccAddress)

Implements sdk.ValidatorHooks

func (Hooks) AfterValidatorCreated

func (h Hooks) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.AccAddress)

Implements sdk.ValidatorHooks

func (Hooks) AfterValidatorRemoved

func (h Hooks) AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.AccAddress, _ sdk.AccAddress)

Implements sdk.ValidatorHooks

func (Hooks) BeforeDelegationCreated

func (h Hooks) BeforeDelegationCreated(_ sdk.Context, _ sdk.AccAddress, _ sdk.AccAddress)

func (Hooks) BeforeDelegationRemoved

func (h Hooks) BeforeDelegationRemoved(_ sdk.Context, _ sdk.AccAddress, _ sdk.AccAddress)

func (Hooks) BeforeDelegationSharesModified

func (h Hooks) BeforeDelegationSharesModified(_ sdk.Context, _ sdk.AccAddress, _ sdk.AccAddress)

func (Hooks) BeforeValidatorModified

func (h Hooks) BeforeValidatorModified(_ sdk.Context, _ sdk.AccAddress)

func (Hooks) BeforeValidatorSlashed

func (h Hooks) BeforeValidatorSlashed(_ sdk.Context, _ sdk.AccAddress, _ sdk.Dec)

type Keeper

type Keeper struct {
	// contains filtered or unexported fields
}

Keeper of the slashing store

func NewKeeper

func NewKeeper(cdc *codec.Codec, key sdk.StoreKey, sk staking.StakingKeeper, paramspace types.ParamSubspace) Keeper

NewKeeper creates a slashing keeper

func (Keeper) AddPubkey

func (k Keeper) AddPubkey(ctx sdk.Context, pubkey crypto.PubKey) error

AddPubkey sets a address-pubkey relation

func (Keeper) AfterValidatorBonded

func (k Keeper) AfterValidatorBonded(ctx sdk.Context, address sdk.AccAddress, _ sdk.AccAddress)

func (Keeper) AfterValidatorCreated

func (k Keeper) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.AccAddress) error

AfterValidatorCreated adds the address-pubkey relation when a validator is created.

func (Keeper) AfterValidatorRemoved

func (k Keeper) AfterValidatorRemoved(ctx sdk.Context, address sdk.AccAddress)

AfterValidatorRemoved deletes the address-pubkey relation when a validator is removed,

func (Keeper) DowntimeJailDuration

func (k Keeper) DowntimeJailDuration(ctx sdk.Context) (res time.Duration)

DowntimeJailDuration - Downtime unbond duration

func (Keeper) GetParams

func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)

GetParams returns the total set of slashing parameters.

func (Keeper) GetPubkey

func (k Keeper) GetPubkey(ctx sdk.Context, a sdk.AccAddress) (crypto.PubKey, error)

GetPubkey returns the pubkey from the adddress-pubkey relation

func (Keeper) GetValidatorMissedBlockBitArray

func (k Keeper) GetValidatorMissedBlockBitArray(ctx sdk.Context, address sdk.AccAddress, index int64) bool

GetValidatorMissedBlockBitArray gets the bit for the missed blocks array

func (Keeper) GetValidatorMissedBlocks

func (k Keeper) GetValidatorMissedBlocks(ctx sdk.Context, address sdk.AccAddress) []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.AccAddress) (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 sdk.AccAddress, power int64, signed bool)

HandleValidatorSignature handles a validator signature, must be called once per validator per block.

func (Keeper) HasValidatorSigningInfo

func (k Keeper) HasValidatorSigningInfo(ctx sdk.Context, consAddr sdk.AccAddress) bool

HasValidatorSigningInfo returns if a given validator has signing information persited.

func (Keeper) Hooks

func (k Keeper) Hooks() Hooks

Return the wrapper struct

func (Keeper) IsTombstoned

func (k Keeper) IsTombstoned(ctx sdk.Context, consAddr sdk.AccAddress) bool

IsTombstoned returns if a given validator by consensus address is tombstoned.

func (Keeper) IterateValidatorMissedBlockBitArray

func (k Keeper) IterateValidatorMissedBlockBitArray(ctx sdk.Context,
	address sdk.AccAddress, 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.AccAddress, info types.ValidatorSigningInfo) (stop bool))

IterateValidatorSigningInfos iterates over the stored ValidatorSigningInfo

func (Keeper) Jail

func (k Keeper) Jail(ctx sdk.Context, consAddr sdk.AccAddress)

Jail attempts to jail a validator. The slash is delegated to the staking module to make the necessary validator changes.

func (Keeper) JailUntil

func (k Keeper) JailUntil(ctx sdk.Context, consAddr sdk.AccAddress, jailTime time.Time)

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) Logger

func (k Keeper) Logger(ctx sdk.Context) log.Logger

Logger returns a module-specific logger.

func (Keeper) MinSignedPerWindow

func (k Keeper) MinSignedPerWindow(ctx sdk.Context) int64

MinSignedPerWindow - minimum blocks signed per window

func (Keeper) Params

func (Keeper) SetParams

func (k Keeper) SetParams(ctx sdk.Context, params types.Params)

SetParams sets the slashing parameters to the param space.

func (Keeper) SetValidatorMissedBlockBitArray

func (k Keeper) SetValidatorMissedBlockBitArray(ctx sdk.Context, address sdk.AccAddress, 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.AccAddress, info types.ValidatorSigningInfo)

SetValidatorSigningInfo sets the validator signing info to a consensus address key

func (Keeper) SignedBlocksWindow

func (k Keeper) SignedBlocksWindow(ctx sdk.Context) (res int64)

SignedBlocksWindow - sliding window for downtime slashing

func (Keeper) Slash

func (k Keeper) Slash(ctx sdk.Context, consAddr sdk.AccAddress, 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

func (k Keeper) SlashFractionDoubleSign(ctx sdk.Context) (res sdk.Dec)

SlashFractionDoubleSign - fraction of power slashed in case of double sign

func (Keeper) SlashFractionDowntime

func (k Keeper) SlashFractionDowntime(ctx sdk.Context) (res sdk.Dec)

SlashFractionDowntime - fraction of power slashed for downtime

func (Keeper) Tombstone

func (k Keeper) Tombstone(ctx sdk.Context, consAddr sdk.AccAddress)

Tombstone attempts to tombstone a validator. It will panic if signing info for the given validator does not exist.

func (Keeper) Unjail

func (k Keeper) Unjail(ctx sdk.Context, validatorAddr sdk.AccAddress) error

Unjail calls the staking Unjail function to unjail a validator if the jailed period has concluded

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL