slash

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2022 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
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
)
View Source
const (
	DefaultParamspace = types.ModuleName
)

Default parameter namespace

Variables

View Source
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

func NewHandler(keeper Keeper) sdk.Handler

NewHandler returns a handler for "slash" type messages.

func NewQuerier

func NewQuerier(keeper Keeper) sdk.Querier

NewQuerier is the module level router for state queries

func ParamKeyTable

func ParamKeyTable() params.KeyTable

ParamTable for slash module

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

func NewAppModule(k Keeper) AppModule

NewAppModule creates a new AppModule Object

func (AppModule) BeginBlock

func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock)

func (AppModule) EndBlock

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

func (AppModule) Name() string

func (AppModule) NewHandler

func (am AppModule) NewHandler() sdk.Handler

func (AppModule) NewQuerierHandler

func (am AppModule) NewQuerierHandler() sdk.Querier

func (AppModule) QuerierRoute

func (am AppModule) QuerierRoute() string

func (AppModule) RegisterInvariants

func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry)

func (AppModule) Route

func (am AppModule) Route() string

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

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

FallbackGuardReward - fraction of penalty for reward to the guard

func (Keeper) GetParams

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

Get all parameteras as types.Params

func (Keeper) GetPenalties added in v0.2.5

func (keeper Keeper) GetPenalties(ctx sdk.Context) (penalties []Penalty)

GetPenalties returns all the penalties from store

func (Keeper) GetPenalty

func (k Keeper) GetPenalty(ctx sdk.Context, nonce uint64) (penalty Penalty, found bool)

Get the entire Penalty metadata for a nonce

func (Keeper) GetPenaltyNonce added in v0.2.5

func (k Keeper) GetPenaltyNonce(ctx sdk.Context) (nonce uint64)

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

func (k Keeper) HandleDoubleSign(ctx sdk.Context, addr crypto.Address, power int64)

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

func (k Keeper) IteratePenaltys(ctx sdk.Context,
	handler func(penalty Penalty) (stop bool))

IteratePenaltys iterates over the stored penalties

func (Keeper) MinSignedPerWindow

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

MinSignedPerWindow - minimum blocks signed per window

func (Keeper) SetParams

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

set the params

func (Keeper) SetPenalty

func (k Keeper) SetPenalty(ctx sdk.Context, penalty Penalty)

Set the entire Penalty metadata for a nonce

func (Keeper) SetPenaltyNonce added in v0.2.5

func (k Keeper) SetPenaltyNonce(ctx sdk.Context, nonce uint64)

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

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, 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

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

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

SlashFractionGuardFailure - fraction of power slashed for guard failure

type MsgSignPenalty

type MsgSignPenalty = types.MsgSignPenalty

type Params

type Params = types.Params

type Penalty

type Penalty = types.Penalty

type QueryPenaltyParams

type QueryPenaltyParams = types.QueryPenaltyParams

Directories

Path Synopsis
client
cli

Jump to

Keyboard shortcuts

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