slashing

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2020 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Overview

nolint autogenerated code using github.com/rigelrozanski/multitool aliases generated for the following subdirectories: ALIASGEN: github.com/Dipper-Labs/Dipper-Protocol/app/v0/slashing/types

nolint

Index

Constants

View Source
const (
	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
)
View Source
const (
	SignedBlocksWindow      = "signed_blocks_window"
	MinSignedPerWindow      = "min_signed_per_window"
	DowntimeJailDuration    = "downtime_jail_duration"
	SlashFractionDoubleSign = "slash_fraction_double_sign"
	SlashFractionDowntime   = "slash_fraction_downtime"
)

Simulation parameter constants

View Source
const (
	OpWeightMsgUnjail = "op_weight_msg_unjail"
)

Simulation operation weights constants

Variables

View Source
var (
	// functions aliases
	RegisterCodec                            = types.RegisterCodec
	ErrNoValidatorForAddress                 = types.ErrNoValidatorForAddress
	ErrBadValidatorAddr                      = types.ErrBadValidatorAddr
	ErrValidatorJailed                       = types.ErrValidatorJailed
	ErrValidatorNotJailed                    = types.ErrValidatorNotJailed
	ErrDelegatorExceedMaxLever               = types.ErrDelegatorExceedMaxLever
	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 GenDowntimeJailDuration

func GenDowntimeJailDuration(r *rand.Rand) time.Duration

GenDowntimeJailDuration randomized DowntimeJailDuration

func GenMinSignedPerWindow

func GenMinSignedPerWindow(r *rand.Rand) sdk.Dec

GenMinSignedPerWindow randomized MinSignedPerWindow

func GenSignedBlocksWindow

func GenSignedBlocksWindow(r *rand.Rand) int64

GenSignedBlocksWindow randomized SignedBlocksWindow

func GenSlashFractionDoubleSign

func GenSlashFractionDoubleSign(r *rand.Rand) sdk.Dec

GenSlashFractionDoubleSign randomized SlashFractionDoubleSign

func GenSlashFractionDowntime

func GenSlashFractionDowntime(r *rand.Rand) sdk.Dec

GenSlashFractionDowntime randomized SlashFractionDowntime

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.

func NewTestMsgCreateValidator

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

func ParamChanges

func ParamChanges(r *rand.Rand) []simtypes.ParamChange

ParamChanges defines the parameters that can be modified by param change proposals on the simulation

func RandomizedGenState

func RandomizedGenState(simState *module.SimulationState)

RandomizedGenState generates a random GenesisState for slashing

func SimulateMsgUnjail

func SimulateMsgUnjail(
	ak AccountKeeper,
	k Keeper,
	sk stakingkeeper.Keeper) simtypes.Operation

SimulateMsgUnjail generates a MsgUnjail with random values nolint: interfacer

func WeightedOperations

func WeightedOperations(
	appParams simtypes.AppParams,
	cdc *codec.Codec,
	ak AccountKeeper,
	k Keeper,
	sk stakingkeeper.Keeper) simulation.WeightedOperations

WeightedOperations returns all the operations from the module with their respective weights

Types

type AccountKeeper

type AccountKeeper interface {
	GetAccount(ctx sdk.Context, addr sdk.AccAddress) exported.Account
}

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

func (am AppModule) GenerateGenesisState(simState *module.SimulationState)

for simulation

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

func (am AppModule) ProposalContents(simState module.SimulationState) []simtypes.WeightedProposalContent

func (AppModule) QuerierRoute

func (AppModule) QuerierRoute() string

module querier route name

func (AppModule) RandomizedParams

func (am AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange

func (AppModule) RegisterInvariants

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

register invariants

func (AppModule) Route

func (AppModule) Route() string

module message route name

func (AppModule) WeightedOperations

func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation

func (*AppModule) WithAccountKeeper

func (am *AppModule) WithAccountKeeper(ak AccountKeeper) *AppModule

func (*AppModule) WithStakingKeeper

func (am *AppModule) WithStakingKeeper(sk stakingkeeper.Keeper) *AppModule

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

GetQueryCmd returns the root query command for the slashing 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 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)

AfterDelegationModified - unused hooks

func (Hooks) AfterValidatorBeginUnbonding

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

AfterValidatorBeginUnbonding - unused hooks

func (Hooks) AfterValidatorBonded

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

AfterValidatorBonded - Implements sdk.ValidatorHooks

func (Hooks) AfterValidatorCreated

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

AfterValidatorCreated - Implements sdk.ValidatorHooks

func (Hooks) AfterValidatorRemoved

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

AfterValidatorRemoved - Implements sdk.ValidatorHooks

func (Hooks) BeforeDelegationCreated

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

BeforeDelegationCreated - unused hooks

func (Hooks) BeforeDelegationRemoved

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

BeforeDelegationRemoved - unused hooks

func (Hooks) BeforeDelegationSharesModified

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

BeforeDelegationSharesModified - unused hooks

func (Hooks) BeforeValidatorModified

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

BeforeValidatorModified - unused hooks

func (Hooks) BeforeValidatorSlashed

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

BeforeValidatorSlashed - unused hooks

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

NewKeeper creates a slashing keeper

func (Keeper) AfterValidatorBonded

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

AfterValidatorBonded - call hook if registered

func (Keeper) AfterValidatorCreated

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

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

func (Keeper) AfterValidatorRemoved

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

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

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

func (k Keeper) GetValidatorSigningInfo(ctx sdk.Context, address sdk.ConsAddress) (info types.ValidatorSigningInfo, found bool)

Stored by *validator* address (not operator address)

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

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

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