Documentation ¶
Index ¶
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func NewQuerier(k Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier
- type Keeper
- func (k Keeper) AllEvidence(c context.Context, req *types.QueryAllEvidenceRequest) (*types.QueryAllEvidenceResponse, error)
- func (k Keeper) Evidence(c context.Context, req *types.QueryEvidenceRequest) (*types.QueryEvidenceResponse, error)
- func (k Keeper) GetAllEvidence(ctx sdk.Context) (evidence []exported.Evidence)
- func (k Keeper) GetEvidence(ctx sdk.Context, hash tmbytes.HexBytes) (exported.Evidence, bool)
- func (k Keeper) GetEvidenceHandler(evidenceRoute string) (types.Handler, error)
- func (k Keeper) HandleEquivocationEvidence(ctx sdk.Context, evidence *types.Equivocation)
- func (k Keeper) IterateEvidence(ctx sdk.Context, cb func(exported.Evidence) bool)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) MarshalEvidence(evidenceI exported.Evidence) ([]byte, error)
- func (k Keeper) MustMarshalEvidence(evidence exported.Evidence) []byte
- func (k Keeper) MustUnmarshalEvidence(bz []byte) exported.Evidence
- func (k Keeper) SetEvidence(ctx sdk.Context, evidence exported.Evidence)
- func (k *Keeper) SetRouter(rtr types.Router)
- func (k Keeper) SubmitEvidence(ctx sdk.Context, evidence exported.Evidence) error
- func (k Keeper) UnmarshalEvidence(bz []byte) (exported.Evidence, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the bank MsgServer interface for the provided Keeper.
func NewQuerier ¶
func NewQuerier(k Keeper, legacyQuerierCdc *codec.LegacyAmino) 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.BinaryCodec, storeKey storetypes.StoreKey, stakingKeeper types.StakingKeeper, slashingKeeper types.SlashingKeeper, ) *Keeper
func (Keeper) AllEvidence ¶
func (k Keeper) AllEvidence(c context.Context, req *types.QueryAllEvidenceRequest) (*types.QueryAllEvidenceResponse, error)
AllEvidence implements the Query/AllEvidence gRPC method
func (Keeper) Evidence ¶
func (k Keeper) Evidence(c context.Context, req *types.QueryEvidenceRequest) (*types.QueryEvidenceResponse, error)
Evidence implements the Query/Evidence gRPC method
func (Keeper) GetAllEvidence ¶
GetAllEvidence returns all stored Evidence objects.
func (Keeper) GetEvidence ¶
GetEvidence retrieves Evidence by hash if it exists. If no Evidence exists for the given hash, (nil, false) is returned.
func (Keeper) GetEvidenceHandler ¶
GetEvidenceHandler returns a registered Handler for a given Evidence type. If no handler exists, an error is returned.
func (Keeper) HandleEquivocationEvidence ¶
func (k Keeper) HandleEquivocationEvidence(ctx sdk.Context, evidence *types.Equivocation)
HandleEquivocationEvidence 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 ¶
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) MarshalEvidence ¶
MarshalEvidence protobuf serializes an Evidence interface
func (Keeper) MustMarshalEvidence ¶
MustMarshalEvidence attempts to encode an Evidence object and returns the raw encoded bytes. It panics on error.
func (Keeper) MustUnmarshalEvidence ¶
MustUnmarshalEvidence attempts to decode and return an Evidence object from raw encoded bytes. It panics on error.
func (Keeper) SetEvidence ¶
SetEvidence sets Evidence by hash in the module's KVStore.
func (*Keeper) SetRouter ¶
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 ¶
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.