Documentation
¶
Overview ¶
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(
// ...,
evidence.AppModuleBasic{},
)
// First, create the keeper
evidenceKeeper := evidence.NewKeeper(
appCodec, runtime.NewKVStoreService(keys[evidencetypes.StoreKey]),
&app.StakingKeeper, app.SlashingKeeper,
)
// Second, create the evidence Handler and register all desired routes.
evidenceRouter := evidence.NewRouter().
AddRoute(evidenceRoute, evidenceHandler).
AddRoute(..., ...)
evidenceKeeper.SetRouter(evidenceRouter)
app.EvidenceKeeper = *evidenceKeeper
app.mm = module.NewManager(
// ...
evidence.NewAppModule(app.EvidenceKeeper),
)
// Remaining application bootstrapping...
Index ¶
- func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState
- func InitGenesis(ctx sdk.Context, k keeper.Keeper, gs *types.GenesisState)
- type AppModule
- func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions
- func (am AppModule) BeginBlock(ctx context.Context) error
- func (AppModule) ConsensusVersion() uint64
- func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage
- func (AppModule) GenerateGenesisState(simState *module.SimulationState)
- func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, bz json.RawMessage)
- func (am AppModule) IsAppModule()
- func (am AppModule) IsOnePerModuleType()
- func (am AppModule) RegisterServices(registrar grpc.ServiceRegistrar) error
- func (am AppModule) RegisterStoreDecoder(sdr simtypes.StoreDecoderRegistry)
- func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation
- type AppModuleBasic
- func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage
- func (a AppModuleBasic) GetTxCmd() *cobra.Command
- func (AppModuleBasic) Name() string
- func (a AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *gwruntime.ServeMux)
- func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry)
- func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino)
- func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error
- type ModuleInputs
- type ModuleOutputs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExportGenesis ¶
ExportGenesis returns the evidence module's exported genesis.
func InitGenesis ¶
InitGenesis initializes the evidence module's state from a provided genesis state.
Types ¶
type AppModule ¶
type AppModule struct {
AppModuleBasic
// contains filtered or unexported fields
}
AppModule implements the AppModule interface for the evidence module.
func NewAppModule ¶
NewAppModule creates a new AppModule object.
func (AppModule) AutoCLIOptions ¶ added in v0.53.1
func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions
AutoCLIOptions implements the autocli.HasAutoCLIConfig interface.
func (AppModule) BeginBlock ¶
BeginBlock executes all ABCI BeginBlock logic respective to the evidence module.
func (AppModule) ConsensusVersion ¶ added in v0.43.0
ConsensusVersion implements AppModule/ConsensusVersion.
func (AppModule) ExportGenesis ¶
ExportGenesis returns the evidence module's exported genesis state as raw JSON bytes.
func (AppModule) GenerateGenesisState ¶
func (AppModule) GenerateGenesisState(simState *module.SimulationState)
GenerateGenesisState creates a randomized GenState of the evidence module.
func (AppModule) InitGenesis ¶
InitGenesis performs the evidence module's genesis initialization. It returns no validator updates.
func (AppModule) IsAppModule ¶ added in v0.47.0
func (am AppModule) IsAppModule()
IsAppModule implements the appmodule.AppModule interface.
func (AppModule) IsOnePerModuleType ¶ added in v0.47.0
func (am AppModule) IsOnePerModuleType()
IsOnePerModuleType implements the depinject.OnePerModuleType interface.
func (AppModule) RegisterServices ¶ added in v0.40.0
func (am AppModule) RegisterServices(registrar grpc.ServiceRegistrar) error
RegisterServices registers module services.
func (AppModule) RegisterStoreDecoder ¶
func (am AppModule) RegisterStoreDecoder(sdr simtypes.StoreDecoderRegistry)
RegisterStoreDecoder registers a decoder for evidence module's types
func (AppModule) WeightedOperations ¶
func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation
WeightedOperations returns all the gov module operations with their respective weights.
type AppModuleBasic ¶
type AppModuleBasic struct {
// contains filtered or unexported fields
}
AppModuleBasic implements the AppModuleBasic interface for the evidence module.
func NewAppModuleBasic ¶
func NewAppModuleBasic(evidenceHandlers ...eviclient.EvidenceHandler) AppModuleBasic
NewAppModuleBasic creates an AppModuleBasic without the codec.
func (AppModuleBasic) DefaultGenesis ¶
func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage
DefaultGenesis returns the evidence module's default genesis state.
func (AppModuleBasic) GetTxCmd ¶
func (a AppModuleBasic) GetTxCmd() *cobra.Command
GetTxCmd returns the evidence module's root tx command.
func (AppModuleBasic) Name ¶
func (AppModuleBasic) Name() string
Name returns the evidence module's name.
func (AppModuleBasic) RegisterGRPCGatewayRoutes ¶ added in v0.40.0
func (a AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *gwruntime.ServeMux)
RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the evidence module.
func (AppModuleBasic) RegisterInterfaces ¶ added in v0.40.0
func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry)
RegisterInterfaces registers the evidence module's interface types
func (AppModuleBasic) RegisterLegacyAminoCodec ¶ added in v0.40.0
func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino)
RegisterLegacyAminoCodec registers the evidence module's types to the LegacyAmino codec.
func (AppModuleBasic) ValidateGenesis ¶
func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error
ValidateGenesis performs genesis state validation for the evidence module.
type ModuleInputs ¶ added in v0.53.1
type ModuleInputs struct {
depinject.In
StoreService store.KVStoreService
Cdc codec.Codec
StakingKeeper types.StakingKeeper
SlashingKeeper types.SlashingKeeper
AddressCodec address.Codec
BlockInfoService comet.BlockInfoService
}
type ModuleOutputs ¶ added in v0.53.1
type ModuleOutputs struct {
depinject.Out
EvidenceKeeper keeper3.Keeper
Module appmodule.AppModule
}
func ProvideModule ¶ added in v0.47.0
func ProvideModule(in ModuleInputs) ModuleOutputs