cosmos-sdk: Index | Files | Directories

package evidence

import ""

Package evidence implements a Cosmos SDK module, per ADR 009, that allows for the submission and handling of arbitrary evidence of misbehavior.

All concrete evidence types must implement the Evidence interface contract. Submitted evidence is first routed through the evidence module's Router in which it attempts to find a corresponding Handler for that specific evidence type. Each evidence type must have a Handler registered with the evidence module's keeper in order for it to be successfully executed.

Each corresponding handler must also fulfill the Handler interface contract. The Handler for a given Evidence type can perform any arbitrary state transitions such as slashing, jailing, and tombstoning. This provides developers with great flexibility in designing evidence handling.

A full setup of the evidence module may look something as follows:

ModuleBasics = module.NewBasicManager(
  // ...,

// First, create the keeper's subspace for parameters and the keeper itself.
evidenceParamspace := app.ParamsKeeper.Subspace(evidence.ModuleName)
evidenceKeeper := evidence.NewKeeper(
  app.cdc, keys[evidence.StoreKey], evidenceParamspace, evidence.DefaultCodespace,

// Second, create the evidence Handler and register all desired routes.
evidenceRouter := evidence.NewRouter().
  AddRoute(evidenceRoute, evidenceHandler).
  AddRoute(..., ...)

evidenceKeeper.SetRouter(evidenceRouter) = module.NewManager(
  // ...

// Remaining application bootstrapping...


Package Files

abci.go doc.go genesis.go handler.go module.go

func BeginBlocker Uses

func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, k keeper.Keeper)

BeginBlocker iterates through and handles any newly discovered evidence of misbehavior submitted by Tendermint. Currently, only equivocation is handled.

func ExportGenesis Uses

func ExportGenesis(ctx sdk.Context, k keeper.Keeper) types.GenesisState

ExportGenesis returns the evidence module's exported genesis.

func InitGenesis Uses

func InitGenesis(ctx sdk.Context, k keeper.Keeper, gs types.GenesisState)

InitGenesis initializes the evidence module's state from a provided genesis state.

func NewHandler Uses

func NewHandler(k keeper.Keeper) sdk.Handler

type AppModule Uses

type AppModule struct {
    // contains filtered or unexported fields

AppModule implements the AppModule interface for the evidence module.

func NewAppModule Uses

func NewAppModule(keeper keeper.Keeper) AppModule

func (AppModule) BeginBlock Uses

func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock)

BeginBlock executes all ABCI BeginBlock logic respective to the evidence module.

func (AppModule) EndBlock Uses

func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate

EndBlock executes all ABCI EndBlock logic respective to the evidence module. It returns no validator updates.

func (AppModule) ExportGenesis Uses

func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONMarshaler) json.RawMessage

ExportGenesis returns the evidence module's exported genesis state as raw JSON bytes.

func (AppModule) GenerateGenesisState Uses

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

GenerateGenesisState creates a randomized GenState of the evidence module.

func (AppModule) InitGenesis Uses

func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONMarshaler, bz json.RawMessage) []abci.ValidatorUpdate

InitGenesis performs the evidence module's genesis initialization It returns no validator updates.

func (AppModule) LegacyQuerierHandler Uses

func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc codec.JSONMarshaler) sdk.Querier

LegacyQuerierHandler returns the evidence module's Querier.

func (AppModule) Name Uses

func (am AppModule) Name() string

Name returns the evidence module's name.

func (AppModule) ProposalContents Uses

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

ProposalContents returns all the evidence content functions used to simulate governance proposals.

func (AppModule) QuerierRoute Uses

func (AppModule) QuerierRoute() string

QuerierRoute returns the evidence module's query routing key.

func (AppModule) RandomizedParams Uses

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

RandomizedParams creates randomized evidence param changes for the simulator.

func (AppModule) RegisterInvariants Uses

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

RegisterInvariants registers the evidence module's invariants.

func (AppModule) RegisterQueryService Uses

func (am AppModule) RegisterQueryService(server grpc.Server)

RegisterQueryService registers a GRPC query service to respond to the module-specific GRPC queries.

func (AppModule) RegisterStoreDecoder Uses

func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry)

RegisterStoreDecoder registers a decoder for evidence module's types

func (AppModule) Route Uses

func (am AppModule) Route() sdk.Route

Route returns the evidence module's message routing key.

func (AppModule) WeightedOperations Uses

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

WeightedOperations returns the all the gov module operations with their respective weights.

type AppModuleBasic Uses

type AppModuleBasic struct {
    // contains filtered or unexported fields

AppModuleBasic implements the AppModuleBasic interface for the evidence module.

func NewAppModuleBasic Uses

func NewAppModuleBasic(evidenceHandlers ...eviclient.EvidenceHandler) AppModuleBasic

NewAppModuleBasic crates a AppModuleBasic without the codec.

func (AppModuleBasic) DefaultGenesis Uses

func (AppModuleBasic) DefaultGenesis(cdc codec.JSONMarshaler) json.RawMessage

DefaultGenesis returns the evidence module's default genesis state.

func (AppModuleBasic) GetQueryCmd Uses

func (AppModuleBasic) GetQueryCmd() *cobra.Command

GetQueryCmd returns the evidence module's root query command.

func (AppModuleBasic) GetTxCmd Uses

func (a AppModuleBasic) GetTxCmd() *cobra.Command

GetTxCmd returns the evidence module's root tx command.

func (AppModuleBasic) Name Uses

func (AppModuleBasic) Name() string

Name returns the evidence module's name.

func (AppModuleBasic) RegisterCodec Uses

func (AppModuleBasic) RegisterCodec(cdc *codec.Codec)

RegisterCodec registers the evidence module's types to the provided codec.

func (AppModuleBasic) RegisterInterfaces Uses

func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry)

func (AppModuleBasic) RegisterRESTRoutes Uses

func (a AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router)

RegisterRESTRoutes registers the evidence module's REST service handlers.

func (AppModuleBasic) ValidateGenesis Uses

func (AppModuleBasic) ValidateGenesis(cdc codec.JSONMarshaler, config client.TxEncodingConfig, bz json.RawMessage) error

ValidateGenesis performs genesis state validation for the evidence module.



Package evidence imports 25 packages (graph) and is imported by 11 packages. Updated 2020-08-05. Refresh now. Tools for package owners.