Documentation ¶
Overview ¶
nolint
Index ¶
- Constants
- Variables
- func DecodeConfirmedVoteKey(key []byte) (uint64, string)
- func ErrEvidenceExists(hash string) sdk.Error
- func ErrInvalidEvidence(msg string) sdk.Error
- func ErrNoEvidenceExists(hash string) sdk.Error
- func ErrNoEvidenceHandlerExists(route string) sdk.Error
- func GetConfirmedVoteKeyPrefix(height uint64) []byte
- func GetValidatorBehaviourBitArrayKey(behaviourName string, v sdk.ValAddress, i int64) []byte
- func GetValidatorBehaviourBitArrayPrefixKey(behaviourName string, v sdk.ValAddress) []byte
- func GetValidatorBehaviourKey(behaviourName string, v sdk.ValAddress) []byte
- func GetVoteBoxKey(voteID string) []byte
- func NewVoteBox(confirmThreshold int) exported.VoteBox
- func ParamKeyTable() params.KeyTable
- func RegisterCodec(cdc *codec.Codec)
- func ValidateGenesis(GenesisState) error
- type BehaviourParams
- type BoolVote
- type GenesisState
- type Handler
- type MsgSubmitEvidence
- type ParamSubspace
- type QueryAllEvidenceParams
- type QueryEvidenceParams
- type Router
- type StakingKeeper
- type ValidatorBehaviour
- type VoteBox
Constants ¶
const ( CodeNoEvidenceHandlerExists sdk.CodeType = 1 CodeInvalidEvidence sdk.CodeType = 2 CodeNoEvidenceExists sdk.CodeType = 3 CodeEvidenceExists sdk.CodeType = 4 )
Error codes specific to the evidence module
const ( EventTypeSubmitEvidence = "submit_evidence" AttributeValueCategory = ModuleName AttributeKeyEvidenceHash = "evidence_hash" )
evidence module event types
const ( // ModuleName is the name of the module ModuleName = "evidence" // StoreKey to be used when creating the KVStore StoreKey = ModuleName // RouterKey to be used for routing msgs RouterKey = ModuleName // QuerierRoute to be used for querierer msgs QuerierRoute = ModuleName )
const ( QueryEvidence = "evidence" QueryAllEvidence = "all_evidence" )
Querier routes for the evidence module
const (
BehaviourCountDelayBlock uint64 = 10
)
const (
DefaultParamspace = ModuleName
)
Default parameter namespace
const (
TypeMsgSubmitEvidence = "submit_evidence"
)
Message types for the evidence module
Variables ¶
var ( VoteBehaviourKey = "Vote" DsignBehaviourKey = "dsign" )
var ( EvidencePrefixKey = []byte{0x00} ValidatorBehaviourKey = []byte{0x01} ValidatorBehaviourBitArrayKey = []byte{0x02} VoteBoxKey = []byte{0x03} ConfirmedVoteKey = []byte{0x04} )
var ( KeyBehaviourWindow = []byte("BehaviourWindow") KeyMaxMisbehaviourCount = []byte("MaxMisbehaviourCount") KeyBehaviourSlashFraction = []byte("BehaviourSlashFraction") )
Parameter store keys
var AllBehaviourKeys = []string{ VoteBehaviourKey, DsignBehaviourKey, }
var ModuleCdc *codec.Codec
ModuleCdc defines the module codec
Functions ¶
func DecodeConfirmedVoteKey ¶
func ErrEvidenceExists ¶
ErrEvidenceExists returns a typed ABCI error for Evidence that already exists by hash in state.
func ErrInvalidEvidence ¶
ErrInvalidEvidence returns a typed ABCI error for invalid evidence.
func ErrNoEvidenceExists ¶
ErrNoEvidenceExists returns a typed ABCI error for Evidence that does not exist for a given hash.
func ErrNoEvidenceHandlerExists ¶
ErrNoEvidenceHandlerExists returns a typed ABCI error for an invalid evidence handler route.
func GetValidatorBehaviourBitArrayKey ¶
func GetValidatorBehaviourBitArrayKey(behaviourName string, v sdk.ValAddress, i int64) []byte
stored by *Consensus* address (not operator address)
func GetValidatorBehaviourBitArrayPrefixKey ¶
func GetValidatorBehaviourBitArrayPrefixKey(behaviourName string, v sdk.ValAddress) []byte
func GetValidatorBehaviourKey ¶
func GetValidatorBehaviourKey(behaviourName string, v sdk.ValAddress) []byte
func GetVoteBoxKey ¶
func NewVoteBox ¶
func ParamKeyTable ¶
ParamKeyTable for {{ .NameLowerCase }} module
func RegisterCodec ¶
RegisterCodec registers concrete types on codec
func ValidateGenesis ¶
func ValidateGenesis(GenesisState) error
ValidateGenesis validates the evidence genesis parameters
Types ¶
type BehaviourParams ¶
type BehaviourParams struct { BehaviourWindow int64 MaxMisbehaviourCount int64 BehaviourSlashFraction sdk.Dec }
Params - used for initializing default parameter for {{ .NameLowerCase }} at genesis
func DefaultBehaviourParams ¶
func DefaultBehaviourParams() BehaviourParams
DefaultParams defines the parameters for this module
func NewBehaviourParams ¶
func NewBehaviourParams(behaviourWindow int64, maxMisbehaviourCount int64, behaviourSlashFraction sdk.Dec) BehaviourParams
func (*BehaviourParams) ParamSetPairs ¶
func (p *BehaviourParams) ParamSetPairs() params.ParamSetPairs
ParamSetPairs - Implements params.ParamSet
func (BehaviourParams) String ¶
func (p BehaviourParams) String() string
String implements the stringer interface for Params
type GenesisState ¶
type GenesisState struct {
BehaviourParams map[string]BehaviourParams
}
GenesisState - all evidence state that must be provided at genesis
func DefaultGenesisState ¶
func DefaultGenesisState() GenesisState
func NewGenesisState ¶
func NewGenesisState(behaviourParams map[string]BehaviourParams) GenesisState
NewGenesisState creates a new GenesisState object
type Handler ¶
Handler defines an agnostic Evidence handler. The handler is responsible for executing all corresponding business logic necessary for verifying the evidence as valid. In addition, the Handler may execute any necessary slashing and potential jailing.
type MsgSubmitEvidence ¶
type MsgSubmitEvidence struct { Evidence exported.Evidence `json:"evidence" yaml:"evidence"` Submitter sdk.CUAddress `json:"submitter" yaml:"submitter"` }
MsgSubmitEvidence defines an sdk.Msg type that supports submitting arbitrary Evidence.
func NewMsgSubmitEvidence ¶
func NewMsgSubmitEvidence(e exported.Evidence, s sdk.CUAddress) MsgSubmitEvidence
func (MsgSubmitEvidence) GetSignBytes ¶
func (m MsgSubmitEvidence) GetSignBytes() []byte
GetSignBytes returns the raw bytes a signer is expected to sign when submitting a MsgSubmitEvidence message.
func (MsgSubmitEvidence) GetSigners ¶
func (m MsgSubmitEvidence) GetSigners() []sdk.CUAddress
GetSigners returns the single expected signer for a MsgSubmitEvidence.
func (MsgSubmitEvidence) Route ¶
func (m MsgSubmitEvidence) Route() string
Route returns the MsgSubmitEvidence's route.
func (MsgSubmitEvidence) Type ¶
func (m MsgSubmitEvidence) Type() string
Type returns the MsgSubmitEvidence's type.
func (MsgSubmitEvidence) ValidateBasic ¶
func (m MsgSubmitEvidence) ValidateBasic() sdk.Error
ValidateBasic performs basic (non-state-dependant) validation on a MsgSubmitEvidence.
type ParamSubspace ¶
type ParamSubspace interface { WithKeyTable(table params.KeyTable) params.Subspace Get(ctx sdk.Context, key []byte, ptr interface{}) GetParamSet(ctx sdk.Context, ps params.ParamSet) SetParamSet(ctx sdk.Context, ps params.ParamSet) GetWithSubkey(ctx sdk.Context, key, subkey []byte, ptr interface{}) GetParamSetWithSubkey(ctx sdk.Context, key []byte, ps params.ParamSet) SetParamSetWithSubkey(ctx sdk.Context, key []byte, ps params.ParamSet) }
ParamSubspace defines the expected Subspace interfacace
type QueryAllEvidenceParams ¶
type QueryAllEvidenceParams struct { Page int `json:"page" yaml:"page"` Limit int `json:"limit" yaml:"limit"` }
QueryAllEvidenceParams defines the parameters necessary for querying for all Evidence.
func NewQueryAllEvidenceParams ¶
func NewQueryAllEvidenceParams(page, limit int) QueryAllEvidenceParams
type QueryEvidenceParams ¶
type QueryEvidenceParams struct {
EvidenceHash string `json:"evidence_hash" yaml:"evidence_hash"`
}
QueryEvidenceParams defines the parameters necessary for querying Evidence.
func NewQueryEvidenceParams ¶
func NewQueryEvidenceParams(hash string) QueryEvidenceParams
type Router ¶
type Router interface { AddRoute(r string, h Handler) Router HasRoute(r string) bool GetRoute(path string) Handler Seal() Sealed() bool }
Router defines a contract for which any Evidence handling module must implement in order to route Evidence to registered Handlers.
type StakingKeeper ¶
type ValidatorBehaviour ¶
type ValidatorBehaviour struct { IndexOffset int64 `json:"index_offset" yaml:"index_offset"` // index offset into signed block bit array MisbehaviourCounter int64 `json:"missed_blocks_counter" yaml:"missed_blocks_counter"` // missed blocks counter (to avoid scanning the array every time) }
Signing info for a validator
type VoteBox ¶
type VoteBox struct { ConfirmThreshold int `json:"confirm_threshold"` VoteItems []*exported.VoteItem `json:"vote_items"` Confirmed bool `json:"confirmed"` Result exported.Vote `json:"result"` }
VoteBox is the default implement of exported.VoteBox interface. It's confirmed when over 2/3 validators vote to the same results.