keeper

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 14, 2023 License: Apache-2.0 Imports: 14 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 defines the evidence module's keeper. The keeper is responsible for managing persistence, state transitions and query handling for the evidence module.

func NewKeeper

func NewKeeper(
	cdc *codec.Codec, storeKey sdk.StoreKey, paramSpace params.Subspace,
	stakingKeeper types.StakingKeeper, slashingKeeper types.SlashingKeeper,
) *Keeper

func (Keeper) GetAllEvidence

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

GetAllEvidence returns all stored Evidence objects.

func (Keeper) GetEvidence

func (k Keeper) GetEvidence(ctx sdk.Context, hash tmbytes.HexBytes) (evidence exported.Evidence, found 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) GetParams

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

GetParams returns the total set of evidence parameters.

func (Keeper) HandleDoubleSign

func (k Keeper) HandleDoubleSign(ctx sdk.Context, evidence types.Equivocation)

HandleDoubleSign implements an equivocation evidence handler. Assuming the evidence is valid, the validator committing the misbehavior will be slashed, jailed and tombstoned. Once tombstoned, the validator will not be able to recover. Note, the evidence contains the block time and height at the time of the equivocation.

The evidence is considered invalid if: - the evidence is too old - the validator is unbonded or does not exist - the signing info does not exist (will panic) - is already tombstoned

TODO: Some of the invalid constraints listed above may need to be reconsidered in the case of a lunatic attack.

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

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

MaxEvidenceAge returns the maximum age for submitted evidence.

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

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

SetParams sets the evidence parameters to the param space.

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

func (k Keeper) SubmitEvidence(ctx sdk.Context, evidence exported.Evidence) 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.

Jump to

Keyboard shortcuts

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