Documentation ¶
Index ¶
- Constants
- Variables
- func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, k Keeper)
- func InitGenesis(ctx sdk.Context, keeper Keeper, data GenesisState) []abci.ValidatorUpdate
- func NewHandler(keeper Keeper) sdk.Handler
- func NewQuerier(keeper Keeper) sdk.Querier
- func ParamKeyTable() params.KeyTable
- func ValidateGenesis(data GenesisState) error
- type AccountAmtPair
- type AccountFractionPair
- type AppModule
- func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock)
- func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate
- func (am AppModule) ExportGenesis(ctx sdk.Context) json.RawMessage
- func (am AppModule) InitGenesis(ctx sdk.Context, data json.RawMessage) []abci.ValidatorUpdate
- func (AppModule) Name() string
- func (am AppModule) NewHandler() sdk.Handler
- func (am AppModule) NewQuerierHandler() sdk.Querier
- func (am AppModule) QuerierRoute() string
- func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry)
- func (am AppModule) Route() string
- type AppModuleBasic
- func (AppModuleBasic) DefaultGenesis() json.RawMessage
- func (AppModuleBasic) GetQueryCmd(cdc *codec.Codec) *cobra.Command
- func (AppModuleBasic) GetTxCmd(cdc *codec.Codec) *cobra.Command
- func (AppModuleBasic) Name() string
- func (AppModuleBasic) RegisterCodec(cdc *codec.Codec)
- func (AppModuleBasic) RegisterRESTRoutes(ctx context.CLIContext, rtr *mux.Router)
- func (AppModuleBasic) ValidateGenesis(bz json.RawMessage) error
- type GenesisState
- type Keeper
- func (k Keeper) ClearValidatorMissedBlockBitArray(ctx sdk.Context, address sdk.ConsAddress)
- func (k Keeper) FallbackGuardReward(ctx sdk.Context) (res sdk.Dec)
- func (k Keeper) GetParams(ctx sdk.Context) types.Params
- func (keeper Keeper) GetPenalties(ctx sdk.Context) (penalties []Penalty)
- func (k Keeper) GetPenalty(ctx sdk.Context, nonce uint64) (penalty Penalty, found bool)
- func (k Keeper) GetPenaltyNonce(ctx sdk.Context) (nonce uint64)
- func (k Keeper) GetValidatorMissedBlockBitArray(ctx sdk.Context, address sdk.ConsAddress, index int64) (missed bool)
- func (k Keeper) GetValidatorSigningInfo(ctx sdk.Context, address sdk.ConsAddress) (info slashing.ValidatorSigningInfo, found bool)
- func (k Keeper) HandleDoubleSign(ctx sdk.Context, addr crypto.Address, power int64)
- func (k Keeper) HandleGuardFailure(ctx sdk.Context, beneficiaryAddr, failedAddr sdk.AccAddress)
- func (k Keeper) HandleProposalDepositBurn(ctx sdk.Context, depositor sdk.AccAddress, amount sdk.Int)
- func (k Keeper) HandleValidatorSignature(ctx sdk.Context, addr crypto.Address, power int64, signed bool)
- func (k Keeper) IteratePenaltys(ctx sdk.Context, handler func(penalty Penalty) (stop bool))
- func (k Keeper) MinSignedPerWindow(ctx sdk.Context) (res sdk.Dec)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) SetPenalty(ctx sdk.Context, penalty Penalty)
- func (k Keeper) SetPenaltyNonce(ctx sdk.Context, nonce uint64)
- func (k Keeper) SetValidatorMissedBlockBitArray(ctx sdk.Context, address sdk.ConsAddress, index int64, missed bool)
- func (k Keeper) SetValidatorSigningInfo(ctx sdk.Context, info slashing.ValidatorSigningInfo)
- func (k Keeper) SignedBlocksWindow(ctx sdk.Context) (res int64)
- func (k Keeper) Slash(ctx sdk.Context, reason string, failedValidator staking.Validator, ...)
- func (k Keeper) SlashFractionDoubleSign(ctx sdk.Context) (res sdk.Dec)
- func (k Keeper) SlashFractionDowntime(ctx sdk.Context) (res sdk.Dec)
- func (k Keeper) SlashFractionGuardFailure(ctx sdk.Context) (res sdk.Dec)
- type MsgSignPenalty
- type Params
- type Penalty
- type QueryPenaltyParams
Constants ¶
const ( ModuleName = types.ModuleName RouterKey = types.RouterKey StoreKey = types.StoreKey QueryPenalty = types.QueryPenalty QueryParameters = types.QueryParameters AttributeKeyNonce = types.AttributeKeyNonce AttributeValueGuardFailure = types.AttributeValueGuardFailure AttributeValueDepositBurn = types.AttributeValueDepositBurn )
const (
DefaultParamspace = types.ModuleName
)
Default parameter namespace
Variables ¶
var ( ModuleCdc = types.ModuleCdc RegisterCodec = types.RegisterCodec NewAccountAmtPair = types.NewAccountAmtPair NewAccountFractionPair = types.NewAccountFractionPair NewPenalty = types.NewPenalty NewQueryPenaltyParams = types.NewQueryPenaltyParams NewMsgSignPenalty = types.NewMsgSignPenalty ActionPenalty = types.ActionPenalty EventTypeSlash = slashing.EventTypeSlash PenaltyNonceKey = types.PenaltyNonceKey GetPenaltyKey = types.GetPenaltyKey PenaltyKeyPrefix = types.PenaltyKeyPrefix CLIQueryPenalty = cli.QueryPenalty CLIQueryPenaltyRequest = cli.QueryPenaltyRequest DefaultParams = types.DefaultParams )
Functions ¶
func BeginBlocker ¶
func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, k Keeper)
BeginBlocker check for infraction evidence or downtime of validators on every begin block
func InitGenesis ¶
func InitGenesis(ctx sdk.Context, keeper Keeper, data GenesisState) []abci.ValidatorUpdate
func NewHandler ¶
NewHandler returns a handler for "slash" type messages.
func NewQuerier ¶
NewQuerier is the module level router for state queries
func ValidateGenesis ¶
func ValidateGenesis(data GenesisState) error
Types ¶
type AccountAmtPair ¶
type AccountAmtPair = types.AccountAmtPair
type AccountFractionPair ¶
type AccountFractionPair = types.AccountFractionPair
type AppModule ¶
type AppModule struct { AppModuleBasic // contains filtered or unexported fields }
func NewAppModule ¶
NewAppModule creates a new AppModule Object
func (AppModule) BeginBlock ¶
func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock)
func (AppModule) EndBlock ¶
func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate
func (AppModule) ExportGenesis ¶
func (am AppModule) ExportGenesis(ctx sdk.Context) json.RawMessage
func (AppModule) InitGenesis ¶
func (am AppModule) InitGenesis(ctx sdk.Context, data json.RawMessage) []abci.ValidatorUpdate
func (AppModule) NewHandler ¶
func (AppModule) NewQuerierHandler ¶
func (AppModule) QuerierRoute ¶
func (AppModule) RegisterInvariants ¶
func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry)
type AppModuleBasic ¶
type AppModuleBasic struct{}
app module Basics object
func (AppModuleBasic) DefaultGenesis ¶
func (AppModuleBasic) DefaultGenesis() json.RawMessage
func (AppModuleBasic) GetQueryCmd ¶
func (AppModuleBasic) GetQueryCmd(cdc *codec.Codec) *cobra.Command
Get the root query command of this module
func (AppModuleBasic) GetTxCmd ¶
func (AppModuleBasic) GetTxCmd(cdc *codec.Codec) *cobra.Command
Get the root tx command of this module
func (AppModuleBasic) Name ¶
func (AppModuleBasic) Name() string
func (AppModuleBasic) RegisterCodec ¶
func (AppModuleBasic) RegisterCodec(cdc *codec.Codec)
func (AppModuleBasic) RegisterRESTRoutes ¶
func (AppModuleBasic) RegisterRESTRoutes(ctx context.CLIContext, rtr *mux.Router)
Register rest routes
func (AppModuleBasic) ValidateGenesis ¶
func (AppModuleBasic) ValidateGenesis(bz json.RawMessage) error
Validation check of the Genesis
type GenesisState ¶
type GenesisState struct { Params Params `json:"params" yaml:"params"` Penalties []Penalty `json:"penalties" yaml:"penalties"` PenaltyNonce uint64 `json:"penalty_nonce" yaml:"penalty_nonce"` }
func DefaultGenesisState ¶
func DefaultGenesisState() GenesisState
func ExportGenesis ¶
func ExportGenesis(ctx sdk.Context, keeper Keeper) GenesisState
func NewGenesisState ¶
func NewGenesisState(params Params) GenesisState
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper maintains the link to data storage and exposes getter/setter methods for the various parts of the state machine
func NewKeeper ¶
func NewKeeper(storeKey sdk.StoreKey, cdc *codec.Codec, validatorKeeper validator.Keeper, paramstore params.Subspace) Keeper
NewKeeper creates new instances of the slash Keeper
func (Keeper) ClearValidatorMissedBlockBitArray ¶
func (k Keeper) ClearValidatorMissedBlockBitArray(ctx sdk.Context, address sdk.ConsAddress)
Stored by *validator consensus* address (not account address)
func (Keeper) FallbackGuardReward ¶
FallbackGuardReward - fraction of penalty for reward to the guard
func (Keeper) GetPenalties ¶ added in v0.2.5
GetPenalties returns all the penalties from store
func (Keeper) GetPenalty ¶
Get the entire Penalty metadata for a nonce
func (Keeper) GetPenaltyNonce ¶ added in v0.2.5
Get the next Penalty nonce
func (Keeper) GetValidatorMissedBlockBitArray ¶
func (k Keeper) GetValidatorMissedBlockBitArray(ctx sdk.Context, address sdk.ConsAddress, index int64) (missed bool)
Stored by *validator consensus* address (not account address)
func (Keeper) GetValidatorSigningInfo ¶
func (k Keeper) GetValidatorSigningInfo(ctx sdk.Context, address sdk.ConsAddress) (info slashing.ValidatorSigningInfo, found bool)
Stored by *validator consensus* address (not account address)
func (Keeper) HandleDoubleSign ¶
HandleDoubleSign handles a validator signing two blocks at the same height. power: power of the double-signing validator at the height of infraction
func (Keeper) HandleGuardFailure ¶
func (k Keeper) HandleGuardFailure(ctx sdk.Context, beneficiaryAddr, failedAddr sdk.AccAddress)
HandleGuardFailure handles a validator fails to guard state.
func (Keeper) HandleProposalDepositBurn ¶ added in v0.2.0
func (k Keeper) HandleProposalDepositBurn(ctx sdk.Context, depositor sdk.AccAddress, amount sdk.Int)
HandleProposalDepositBurn handles a depositor supports refused proposal.
func (Keeper) HandleValidatorSignature ¶
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) IteratePenaltys ¶ added in v0.2.5
IteratePenaltys iterates over the stored penalties
func (Keeper) MinSignedPerWindow ¶
MinSignedPerWindow - minimum blocks signed per window
func (Keeper) SetPenalty ¶
Set the entire Penalty metadata for a nonce
func (Keeper) SetPenaltyNonce ¶ added in v0.2.5
Set the penalty nonce
func (Keeper) SetValidatorMissedBlockBitArray ¶
func (k Keeper) SetValidatorMissedBlockBitArray(ctx sdk.Context, address sdk.ConsAddress, index int64, missed bool)
Stored by *validator consensus* address (not account address)
func (Keeper) SetValidatorSigningInfo ¶
func (k Keeper) SetValidatorSigningInfo(ctx sdk.Context, info slashing.ValidatorSigningInfo)
Stored by *validator consensus* address (not account address)
func (Keeper) SignedBlocksWindow ¶
SignedBlocksWindow - sliding window for downtime slashing
func (Keeper) Slash ¶
func (k Keeper) Slash(ctx sdk.Context, reason string, failedValidator staking.Validator, slashAmount sdk.Int, beneficiaries []AccountFractionPair)
Slash a validator for an infraction Find the contributing stake and burn the specified slashFactor of it
func (Keeper) SlashFractionDoubleSign ¶
SlashFractionDoubleSign - fraction of power slashed in case of double sign
func (Keeper) SlashFractionDowntime ¶
SlashFractionDowntime - fraction of power slashed for downtime
type MsgSignPenalty ¶
type MsgSignPenalty = types.MsgSignPenalty
type QueryPenaltyParams ¶
type QueryPenaltyParams = types.QueryPenaltyParams