-
Notifications
You must be signed in to change notification settings - Fork 0
/
doc.go
44 lines (34 loc) · 1.57 KB
/
doc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
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's subspace for parameters and the keeper itself.
evidenceParamspace := app.ParamsKeeper.Subspace(evidence.DefaultParamspace)
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)
app.mm = module.NewManager(
// ...
evidence.NewAppModule(evidenceKeeper),
)
// Remaining application bootstrapping...
*/
package evidence