Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/evidence module implementation #5240

Merged
merged 76 commits into from
Nov 6, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
2d0b5fd
add stub files for evidence module
alexanderbez Oct 24, 2019
9e1a726
adr: update status and log
alexanderbez Oct 24, 2019
fff7429
adr: update router definition
alexanderbez Oct 24, 2019
9e92430
move IsAlphaNumeric to types/ and update gov usage
alexanderbez Oct 24, 2019
b3cd14e
types: add evidence type and router/handler
alexanderbez Oct 24, 2019
2d5b6a7
implement EvidenceHandler and related types
alexanderbez Oct 24, 2019
30af5af
rename file
alexanderbez Oct 24, 2019
45db95e
add module constants
alexanderbez Oct 24, 2019
eee71d2
add initial codec
alexanderbez Oct 24, 2019
6c102f4
update client package to be used by AppModuleBasic
alexanderbez Oct 24, 2019
e8851a6
update alias'
alexanderbez Oct 24, 2019
1f33d38
nolint alias file
alexanderbez Oct 24, 2019
5a27e5b
implement AppModuleBasic
alexanderbez Oct 24, 2019
46a1fb8
update AppModule
alexanderbez Oct 25, 2019
febbbf5
add unit tests for types
alexanderbez Oct 25, 2019
e589478
adr: update error return type
alexanderbez Oct 25, 2019
e51c9d2
implement initial keeper
alexanderbez Oct 25, 2019
9b76411
update adr
alexanderbez Oct 25, 2019
37ca15f
update evidence type to include hash
alexanderbez Oct 25, 2019
dbaba7a
add initial error handling
alexanderbez Oct 25, 2019
9e18744
add initial error types
alexanderbez Oct 25, 2019
793b1d4
exec evidence handler
alexanderbez Oct 25, 2019
f3dbc52
update godoc
alexanderbez Oct 25, 2019
50c72ef
implement and use setEvidence
alexanderbez Oct 25, 2019
79e8e28
restructure router usage and start keeper test harness
alexanderbez Oct 27, 2019
e1c0120
add tests
alexanderbez Oct 27, 2019
ce64ee6
use prefix stores instead of key comp.
alexanderbez Oct 28, 2019
10537e3
implement iterator with tests
alexanderbez Oct 28, 2019
39d1142
add new error types with converter
alexanderbez Oct 28, 2019
e638306
start querier types
alexanderbez Oct 28, 2019
a593d67
add ErrNoEvidenceExists
alexanderbez Oct 28, 2019
e90488f
implement querier with tests
alexanderbez Oct 28, 2019
674fc90
implement NewQuerierHandler and update alias'
alexanderbez Oct 28, 2019
9d4c1ea
godoc and misc.
alexanderbez Oct 28, 2019
add9d08
add message with test harness setup
alexanderbez Oct 28, 2019
fd3c6f2
register MsgSubmitEvidence with module cdc
alexanderbez Oct 29, 2019
129eb7e
change export genesis type
alexanderbez Oct 29, 2019
964b4ff
Merge branch 'master' into bez/evidence-module-impl
alexanderbez Oct 29, 2019
8aad1fb
redo type tests
alexanderbez Oct 29, 2019
6374cd6
add handler unit tests
alexanderbez Oct 29, 2019
4ef7797
add DONTCOVER to errors
alexanderbez Oct 29, 2019
25816dd
add genesis tpes along with import/export
alexanderbez Oct 29, 2019
371ca0b
add genesis test file (stub)
alexanderbez Oct 29, 2019
8aa1cbb
Merge branch 'master' into bez/evidence-module-impl
alexanderbez Oct 30, 2019
8c2413b
use simapp in test suites
alexanderbez Oct 30, 2019
fd9a484
add DONTCOVER to test utils
alexanderbez Oct 30, 2019
9b3976d
implement genesis types unit tests
alexanderbez Oct 30, 2019
8b21b3b
add genesis tests
alexanderbez Oct 30, 2019
8e8d382
add doc.go
alexanderbez Oct 30, 2019
2e1485f
remove TODO from module
alexanderbez Oct 30, 2019
f3c9d8b
implement CLI query command
alexanderbez Oct 30, 2019
5a727fd
remove TODO from module
alexanderbez Oct 30, 2019
ba048c6
implement rest handlers to query for evidence
alexanderbez Oct 31, 2019
2dfe2e5
update SubmitEvidenceCMD
alexanderbez Oct 31, 2019
615a3c0
add spec
alexanderbez Oct 31, 2019
946628d
add changelog entry
alexanderbez Oct 31, 2019
c829a3f
update adr
alexanderbez Oct 31, 2019
829c674
Update x/evidence/client/cli/query.go
alexanderbez Nov 5, 2019
2fc3737
Update x/evidence/client/cli/query.go
alexanderbez Nov 5, 2019
2d12a84
Update x/evidence/client/cli/query.go
alexanderbez Nov 5, 2019
bac71c0
Update x/evidence/client/cli/tx.go
alexanderbez Nov 5, 2019
ad7e945
Update x/evidence/client/cli/tx.go
alexanderbez Nov 5, 2019
4f9eb5d
Update x/evidence/client/cli/tx.go
alexanderbez Nov 5, 2019
0aebd95
Update x/evidence/client/rest/query.go
alexanderbez Nov 5, 2019
0737aa8
fix build
alexanderbez Nov 5, 2019
6991768
remove abci.go
alexanderbez Nov 5, 2019
0d5bd13
add to docs file
alexanderbez Nov 5, 2019
1b46150
move Evidence type to exported
alexanderbez Nov 5, 2019
ba5c236
Merge branch 'master' into bez/evidence-module-impl
alexanderbez Nov 5, 2019
709d5f5
emit events for evidence submission
alexanderbez Nov 5, 2019
4338e05
Merge branch 'bez/evidence-module-impl' of github.com:cosmos/cosmos-s…
alexanderbez Nov 5, 2019
cffa3b1
fix tests; goimports
alexanderbez Nov 5, 2019
177b5d3
Merge branch 'master' into bez/evidence-module-impl
alexanderbez Nov 6, 2019
3219e64
add GetEvidenceHandler
alexanderbez Nov 6, 2019
d07c383
Merge branch 'master' into bez/evidence-module-impl
alexanderbez Nov 6, 2019
9039963
Merge branch 'master' into bez/evidence-module-impl
alexanderbez Nov 6, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add GetEvidenceHandler
  • Loading branch information
alexanderbez committed Nov 6, 2019
commit 3219e6457b0d30c3d648fd8f41fb49ddb7a19772
10 changes: 10 additions & 0 deletions x/evidence/internal/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,16 @@ func (k *Keeper) SetRouter(rtr types.Router) {
k.router = rtr
}

// GetEvidenceHandler returns a registered Handler for a given Evidence type. If
// no handler exists, an error is returned.
func (k Keeper) GetEvidenceHandler(evidenceRoute string) (types.Handler, error) {
if !k.router.HasRoute(evidenceRoute) {
return nil, types.ErrNoEvidenceHandlerExists(k.codespace, evidenceRoute)
}

return k.router.GetRoute(evidenceRoute), nil
}

// 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
Expand Down
10 changes: 10 additions & 0 deletions x/evidence/internal/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,16 @@ func (suite *KeeperTestSuite) TestIterateEvidence() {
suite.Len(evidence, numEvidence)
}

func (suite *KeeperTestSuite) TestGetEvidenceHandler() {
handler, err := suite.keeper.GetEvidenceHandler(types.TestEquivocationEvidence{}.Route())
suite.NoError(err)
suite.NotNil(handler)

handler, err = suite.keeper.GetEvidenceHandler("invalidHandler")
suite.Error(err)
suite.Nil(handler)
}

func TestKeeperTestSuite(t *testing.T) {
suite.Run(t, new(KeeperTestSuite))
}