cosmos-sdk: github.com/cosmos/cosmos-sdk/x/slashing/keeper Index | Files

package keeper

import "github.com/cosmos/cosmos-sdk/x/slashing/keeper"

Index

Package Files

grpc_query.go hooks.go infractions.go keeper.go params.go querier.go signing_info.go test_common.go unjail.go

Variables

var (
    InitTokens = sdk.TokensFromConsensusPower(200)
)

func NewQuerier Uses

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

NewQuerier creates a new querier for slashing clients.

func NewTestMsgCreateValidator Uses

func NewTestMsgCreateValidator(address sdk.ValAddress, pubKey crypto.PubKey, amt sdk.Int) *stakingtypes.MsgCreateValidator

func NewTestMsgDelegate Uses

func NewTestMsgDelegate(delAddr sdk.AccAddress, valAddr sdk.ValAddress, delAmount sdk.Int) *stakingtypes.MsgDelegate

func TestParams Uses

func TestParams() types.Params

Have to change these parameters for tests lest the tests take forever

type Hooks Uses

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

Hooks wrapper struct for slashing keeper

func (Hooks) AfterDelegationModified Uses

func (h Hooks) AfterDelegationModified(_ sdk.Context, _ sdk.AccAddress, _ sdk.ValAddress)

func (Hooks) AfterValidatorBeginUnbonding Uses

func (h Hooks) AfterValidatorBeginUnbonding(_ sdk.Context, _ sdk.ConsAddress, _ sdk.ValAddress)

func (Hooks) AfterValidatorBonded Uses

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

Implements sdk.ValidatorHooks

func (Hooks) AfterValidatorCreated Uses

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

Implements sdk.ValidatorHooks

func (Hooks) AfterValidatorRemoved Uses

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

Implements sdk.ValidatorHooks

func (Hooks) BeforeDelegationCreated Uses

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

func (Hooks) BeforeDelegationRemoved Uses

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

func (Hooks) BeforeDelegationSharesModified Uses

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

func (Hooks) BeforeValidatorModified Uses

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

func (Hooks) BeforeValidatorSlashed Uses

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

type Keeper Uses

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

Keeper of the slashing store

func NewKeeper Uses

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

NewKeeper creates a slashing keeper

func (Keeper) AddPubkey Uses

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

AddPubkey sets a address-pubkey relation

func (Keeper) AfterValidatorBonded Uses

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

func (Keeper) AfterValidatorCreated Uses

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

When a validator is created, add the address-pubkey relation.

func (Keeper) AfterValidatorRemoved Uses

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

When a validator is removed, delete the address-pubkey relation.

func (Keeper) DowntimeJailDuration Uses

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

DowntimeJailDuration - Downtime unbond duration

func (Keeper) GetParams Uses

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

GetParams returns the total set of slashing parameters.

func (Keeper) GetPubkey Uses

func (k Keeper) GetPubkey(ctx sdk.Context, address crypto.Address) (crypto.PubKey, error)

GetPubkey returns the pubkey from the adddress-pubkey relation

func (Keeper) GetValidatorMissedBlockBitArray Uses

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 Uses

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 Uses

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 Uses

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 Uses

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

HasValidatorSigningInfo returns if a given validator has signing information persited.

func (Keeper) Hooks Uses

func (k Keeper) Hooks() Hooks

Return the wrapper struct

func (Keeper) IsTombstoned Uses

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

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

func (Keeper) IterateValidatorMissedBlockBitArray Uses

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 Uses

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 Uses

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 Uses

func (k Keeper) JailUntil(ctx sdk.Context, consAddr sdk.ConsAddress, 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 Uses

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

Logger returns a module-specific logger.

func (Keeper) MinSignedPerWindow Uses

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

MinSignedPerWindow - minimum blocks signed per window

func (Keeper) Params Uses

func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)

func (Keeper) SetParams Uses

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

SetParams sets the slashing parameters to the param space.

func (Keeper) SetValidatorMissedBlockBitArray Uses

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 Uses

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 Uses

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

SignedBlocksWindow - sliding window for downtime slashing

func (Keeper) SigningInfo Uses

func (k Keeper) SigningInfo(c context.Context, req *types.QuerySigningInfoRequest) (*types.QuerySigningInfoResponse, error)

func (Keeper) SigningInfos Uses

func (k Keeper) SigningInfos(c context.Context, req *types.QuerySigningInfosRequest) (*types.QuerySigningInfosResponse, error)

func (Keeper) Slash Uses

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.

func (Keeper) SlashFractionDoubleSign Uses

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

SlashFractionDoubleSign - fraction of power slashed in case of double sign

func (Keeper) SlashFractionDowntime Uses

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

SlashFractionDowntime - fraction of power slashed for downtime

func (Keeper) Tombstone Uses

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

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

func (Keeper) Unjail Uses

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

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

Package keeper imports 17 packages (graph) and is imported by 3 packages. Updated 2020-08-05. Refresh now. Tools for package owners.