slashing

package
v1.0.15 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

nolint autogenerated code using github.com/rigelrozanski/multitool aliases generated for the following subdirectories: ALIASGEN: github.com/netcloth/netcloth-chain/modules/slashing/types

nolint

Index

Constants

View Source
const (
	DefaultCodespace            = types.DefaultCodespace
	CodeInvalidValidator        = types.CodeInvalidValidator
	CodeValidatorJailed         = types.CodeValidatorJailed
	CodeValidatorNotJailed      = types.CodeValidatorNotJailed
	CodeMissingSelfDelegation   = types.CodeMissingSelfDelegation
	CodeSelfDelegationTooLow    = types.CodeSelfDelegationTooLow
	CodeMissingSigningInfo      = types.CodeMissingSigningInfo
	ModuleName                  = types.ModuleName
	StoreKey                    = types.StoreKey
	RouterKey                   = types.RouterKey
	QuerierRoute                = types.QuerierRoute
	QueryParameters             = types.QueryParameters
	QuerySigningInfo            = types.QuerySigningInfo
	QuerySigningInfos           = types.QuerySigningInfos
	DefaultParamspace           = types.DefaultParamspace
	DefaultMaxEvidenceAge       = types.DefaultMaxEvidenceAge
	DefaultSignedBlocksWindow   = types.DefaultSignedBlocksWindow
	DefaultDowntimeJailDuration = types.DefaultDowntimeJailDuration
)

Variables

View Source
var (
	// functions aliases
	RegisterCodec                            = types.RegisterCodec
	ErrNoValidatorForAddress                 = types.ErrNoValidatorForAddress
	ErrBadValidatorAddr                      = types.ErrBadValidatorAddr
	ErrValidatorJailed                       = types.ErrValidatorJailed
	ErrValidatorNotJailed                    = types.ErrValidatorNotJailed
	ErrMissingSelfDelegation                 = types.ErrMissingSelfDelegation
	ErrSelfDelegationTooLowToUnjail          = types.ErrSelfDelegationTooLowToUnjail
	ErrNoSigningInfoFound                    = types.ErrNoSigningInfoFound
	NewGenesisState                          = types.NewGenesisState
	DefaultGenesisState                      = types.DefaultGenesisState
	ValidateGenesis                          = types.ValidateGenesis
	GetValidatorSigningInfoKey               = types.GetValidatorSigningInfoKey
	GetValidatorSigningInfoAddress           = types.GetValidatorSigningInfoAddress
	GetValidatorMissedBlockBitArrayPrefixKey = types.GetValidatorMissedBlockBitArrayPrefixKey
	GetValidatorMissedBlockBitArrayKey       = types.GetValidatorMissedBlockBitArrayKey
	GetAddrPubkeyRelationKey                 = types.GetAddrPubkeyRelationKey
	NewMsgUnjail                             = types.NewMsgUnjail
	ParamKeyTable                            = types.ParamKeyTable
	NewParams                                = types.NewParams
	DefaultParams                            = types.DefaultParams
	NewQuerySigningInfoParams                = types.NewQuerySigningInfoParams
	NewQuerySigningInfosParams               = types.NewQuerySigningInfosParams
	NewValidatorSigningInfo                  = types.NewValidatorSigningInfo

	// variable aliases
	ModuleCdc                       = types.ModuleCdc
	ValidatorSigningInfoKey         = types.ValidatorSigningInfoKey
	ValidatorMissedBlockBitArrayKey = types.ValidatorMissedBlockBitArrayKey
	AddrPubkeyRelationKey           = types.AddrPubkeyRelationKey
	DoubleSignJailEndTime           = types.DoubleSignJailEndTime
	DefaultMinSignedPerWindow       = types.DefaultMinSignedPerWindow
	DefaultSlashFractionDoubleSign  = types.DefaultSlashFractionDoubleSign
	DefaultSlashFractionDowntime    = types.DefaultSlashFractionDowntime
	KeyMaxEvidenceAge               = types.KeyMaxEvidenceAge
	KeySignedBlocksWindow           = types.KeySignedBlocksWindow
	KeyMinSignedPerWindow           = types.KeyMinSignedPerWindow
	KeyDowntimeJailDuration         = types.KeyDowntimeJailDuration
	KeySlashFractionDoubleSign      = types.KeySlashFractionDoubleSign
	KeySlashFractionDowntime        = types.KeySlashFractionDowntime
)

Functions

func BeginBlocker

func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, sk Keeper)

slashing begin block functionality

func ExportGenesis

func ExportGenesis(ctx sdk.Context, keeper Keeper) (data types.GenesisState)

ExportGenesis writes the current store values to a genesis file, which can be imported again with InitGenesis

func InitGenesis

func InitGenesis(ctx sdk.Context, keeper Keeper, stakingKeeper types.StakingKeeper, data types.GenesisState)

InitGenesis initialize default parameters and the keeper's address to pubkey map

func NewHandler

func NewHandler(k Keeper) sdk.Handler

func NewQuerier

func NewQuerier(k Keeper) sdk.Querier

NewQuerier creates a new querier for slashing clients.

Types

type AppModule

type AppModule struct {
	AppModuleBasic
	// contains filtered or unexported fields
}

___________________________ app module

func NewAppModule

func NewAppModule(keeper Keeper, stakingKeeper types.StakingKeeper) AppModule

NewAppModule creates a new AppModule object

func (AppModule) BeginBlock

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

module begin-block

func (AppModule) EndBlock

module end-block

func (AppModule) ExportGenesis

func (am AppModule) ExportGenesis(ctx sdk.Context) json.RawMessage

module export genesis

func (AppModule) InitGenesis

func (am AppModule) InitGenesis(ctx sdk.Context, data json.RawMessage) []abci.ValidatorUpdate

module init-genesis

func (AppModule) Name

func (AppModule) Name() string

module name

func (AppModule) NewHandler

func (am AppModule) NewHandler() sdk.Handler

module handler

func (AppModule) NewQuerierHandler

func (am AppModule) NewQuerierHandler() sdk.Querier

module querier

func (AppModule) QuerierRoute

func (AppModule) QuerierRoute() string

module querier route name

func (AppModule) RegisterInvariants

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

register invariants

func (AppModule) Route

func (AppModule) Route() string

module message route name

type AppModuleBasic

type AppModuleBasic struct{}

app module basics object

func (AppModuleBasic) DefaultGenesis

func (AppModuleBasic) DefaultGenesis() json.RawMessage

default genesis state

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

module name

func (AppModuleBasic) RegisterCodec

func (AppModuleBasic) RegisterCodec(cdc *codec.Codec)

register module 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

module validate genesis

type CodeType

type CodeType = types.CodeType

type GenesisState

type GenesisState = types.GenesisState

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

func (Hooks) AfterValidatorBeginUnbonding

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

nolint - unused hooks

func (Hooks) AfterValidatorBonded

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

Implements sdk.ValidatorHooks

func (Hooks) AfterValidatorCreated

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

Implements sdk.ValidatorHooks

func (Hooks) AfterValidatorRemoved

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

Implements sdk.ValidatorHooks

func (Hooks) BeforeDelegationCreated

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

func (Hooks) BeforeDelegationRemoved

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

func (Hooks) BeforeDelegationSharesModified

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

func (Hooks) BeforeValidatorModified

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

func (Hooks) BeforeValidatorSlashed

func (h Hooks) BeforeValidatorSlashed(_ sdk.Context, _ sdk.ValAddress, _ 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 types.StakingKeeper, paramspace params.Subspace, codespace sdk.CodespaceType) Keeper

NewKeeper creates a slashing keeper

func (Keeper) AfterValidatorBonded

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

func (Keeper) AfterValidatorCreated

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

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

func (Keeper) AfterValidatorRemoved

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

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

func (Keeper) DowntimeJailDuration

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

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

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

handle a validator signing two blocks at the same height power: power of the double-signing validator at the height of infraction

func (Keeper) HandleValidatorSignature

func (k Keeper) HandleValidatorSignature(ctx sdk.Context, addr crypto.Address, power int64, signed bool)

handle a validator signature, must be called once per validator per block TODO refactor to take in a consensus address, additionally should maybe just take in the pubkey too

func (Keeper) Hooks

func (k Keeper) Hooks() Hooks

Return the wrapper struct

func (Keeper) IterateValidatorMissedBlockBitArray

func (k Keeper) IterateValidatorMissedBlockBitArray(ctx sdk.Context,
	address sdk.ConsAddress, handler func(index int64, missed bool) (stop bool))

Stored by *validator* address (not operator address)

func (Keeper) IterateValidatorSigningInfos

func (k Keeper) IterateValidatorSigningInfos(ctx sdk.Context,
	handler func(address sdk.ConsAddress, info types.ValidatorSigningInfo) (stop bool))

Stored by *validator* address (not operator address)

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (Keeper) MaxEvidenceAge

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

MaxEvidenceAge - max age for evidence

func (Keeper) MinSignedPerWindow

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

Downtime slashing threshold

func (Keeper) SetValidatorSigningInfo

func (k Keeper) SetValidatorSigningInfo(ctx sdk.Context, address sdk.ConsAddress, info types.ValidatorSigningInfo)

Stored by *validator* address (not operator address)

func (Keeper) SignedBlocksWindow

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

SignedBlocksWindow - sliding window for downtime slashing

func (Keeper) SlashFractionDoubleSign

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

SlashFractionDoubleSign

func (Keeper) SlashFractionDowntime

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

SlashFractionDowntime

type MissedBlock

type MissedBlock = types.MissedBlock

type MsgUnjail

type MsgUnjail = types.MsgUnjail

type Params

type Params = types.Params

type QuerySigningInfoParams

type QuerySigningInfoParams = types.QuerySigningInfoParams

type QuerySigningInfosParams

type QuerySigningInfosParams = types.QuerySigningInfosParams

type ValidatorSigningInfo

type ValidatorSigningInfo = types.ValidatorSigningInfo

Directories

Path Synopsis
client
cli
nolint
nolint

Jump to

Keyboard shortcuts

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