keeper

package
v0.9.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewQuerier

func NewQuerier(k Keeper) sdk.Querier

Types

type Keeper

type Keeper struct {
	// contains filtered or unexported fields
}

Keeper of the evidence store

func NewKeeper

func NewKeeper(cdc *codec.Codec, key sdk.StoreKey, paramSpace types.ParamSubspace, stakingKeeper types.StakingKeeper) Keeper

NewKeeper creates a evidence keeper

func (*Keeper) BehaviourSlashFraction

func (k *Keeper) BehaviourSlashFraction(ctx sdk.Context, behaviourName string) (res sdk.Dec)

func (*Keeper) BehaviourWindow

func (k *Keeper) BehaviourWindow(ctx sdk.Context, behaviourName string) (res int64)

func (Keeper) GetAllEvidence

func (k Keeper) GetAllEvidence(ctx sdk.Context) (evidence []exported.Evidence)

GetAllEvidence returns all stored Evidence objects.

func (Keeper) GetBehaviourParams

func (k Keeper) GetBehaviourParams(ctx sdk.Context, behaviourName string) (params types.BehaviourParams)

func (Keeper) GetEvidence

func (k Keeper) GetEvidence(ctx sdk.Context, hash tmbytes.HexBytes) (exported.Evidence, bool)

GetEvidence retrieves Evidence by hash if it exists. If no Evidence exists for the given hash, (nil, false) is returned.

func (Keeper) GetEvidenceHandler

func (k Keeper) GetEvidenceHandler(evidenceRoute string) (types.Handler, error)

GetEvidenceHandler returns a registered Handler for a given Evidence type. If no handler exists, an error is returned.

func (Keeper) GetValidatorBehaviour

func (k Keeper) GetValidatorBehaviour(ctx sdk.Context, behaviourName string, address sdk.ValAddress) (validatorBehaviour types.ValidatorBehaviour)

func (Keeper) GetValidatorBehaviourBitArray

func (k Keeper) GetValidatorBehaviourBitArray(ctx sdk.Context, behaviourName string, address sdk.ValAddress, index int64) (mis bool)

func (Keeper) HandleBehaviour

func (k Keeper) HandleBehaviour(ctx sdk.Context, behaviourKey string, validator sdk.ValAddress, height uint64, normal bool)

func (Keeper) IterateEvidence

func (k Keeper) IterateEvidence(ctx sdk.Context, cb func(exported.Evidence) bool)

IterateEvidence provides an interator over all stored Evidence objects. For each Evidence object, cb will be called. If the cb returns true, the iterator will close and stop.

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (Keeper) MarshalEvidence

func (k Keeper) MarshalEvidence(evidenceI exported.Evidence) ([]byte, error)

MarshalEvidence marshals an Evidence interface. If the given type implements the Marshaler interface, it is treated as a Proto-defined message and serialized that way. Otherwise, it falls back on the internal Amino codec.

func (*Keeper) MaxMisbehaviourCount

func (k *Keeper) MaxMisbehaviourCount(ctx sdk.Context, behaviourName string) (res int64)

func (Keeper) MustMarshalEvidence

func (k Keeper) MustMarshalEvidence(evidence exported.Evidence) []byte

MustMarshalEvidence attempts to encode an Evidence object and returns the raw encoded bytes. It panics on error.

func (Keeper) MustUnmarshalEvidence

func (k Keeper) MustUnmarshalEvidence(bz []byte) exported.Evidence

MustUnmarshalEvidence attempts to decode and return an Evidence object from raw encoded bytes. It panics on error.

func (Keeper) RecordMisbehaviourVoter

func (k Keeper) RecordMisbehaviourVoter(ctx sdk.Context)

func (Keeper) SetBehaviourParams

func (k Keeper) SetBehaviourParams(ctx sdk.Context, behaviourName string, params types.BehaviourParams)

func (Keeper) SetEvidence

func (k Keeper) SetEvidence(ctx sdk.Context, evidence exported.Evidence)

SetEvidence sets Evidence by hash in the module's KVStore.

func (*Keeper) SetRouter

func (k *Keeper) SetRouter(rtr types.Router)

SetRouter sets the Evidence Handler router for the x/evidence module. Note, we allow the ability to set the router after the Keeper is constructed as a given Handler may need access the Keeper before being constructed. The router may only be set once and will be sealed if it's not already sealed.

func (Keeper) SetValidatorBehaviour

func (k Keeper) SetValidatorBehaviour(ctx sdk.Context, behaviourName string, address sdk.ValAddress, behavior types.ValidatorBehaviour)

func (*Keeper) SetValidatorBehaviourBitArray

func (k *Keeper) SetValidatorBehaviourBitArray(ctx sdk.Context, behaviourName string, address sdk.ValAddress, index int64, mis bool)

func (Keeper) SubmitEvidence

func (k Keeper) SubmitEvidence(ctx sdk.Context, evidence exported.Evidence) sdk.Error

SubmitEvidence attempts to match evidence against the keepers router and execute the corresponding registered Evidence Handler. An error is returned if no registered Handler exists or if the Handler fails. Otherwise, the evidence is persisted.

func (Keeper) UnmarshalEvidence

func (k Keeper) UnmarshalEvidence(bz []byte) (exported.Evidence, error)

UnmarshalEvidence returns an Evidence interface from raw encoded evidence bytes of a Proto-based Evidence type. An error is returned upon decoding failure.

func (Keeper) Vote

func (k Keeper) Vote(ctx sdk.Context, voteID string, voter sdk.CUAddress, vote exported.Vote, height uint64) (bool, bool, []*exported.VoteItem)

func (Keeper) VoteWithCustomBox

func (k Keeper) VoteWithCustomBox(ctx sdk.Context, voteID string, voter sdk.CUAddress, vote exported.Vote, height uint64, newVoteBox exported.NewVoteBox) (bool, bool, []*exported.VoteItem)

Jump to

Keyboard shortcuts

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