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

refactor: remove type from evidence #14757

Merged
merged 3 commits into from
Jan 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Improvements

* (x/evidence) [#14757](https://github.com/cosmos/cosmos-sdk/pull/14757) Evidence messages do not need to implement a `.Type()` anymore.
* (x/auth/tx) [#14751](https://github.com/cosmos/cosmos-sdk/pull/14751) Remove `.Type()` and `Route()` methods from all msgs and `legacytx.LegacyMsg` interface.
* [#14691](https://github.com/cosmos/cosmos-sdk/pull/14691) Change behavior of `sdk.StringifyEvents` to not flatten events attributes by events type.
* This change only affects ABCI message logs, and not the actual events.
Expand Down
1 change: 0 additions & 1 deletion x/evidence/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ type Evidence interface {
proto.Message

Route() string
Type() string
String() string
Hash() tmbytes.HexBytes
ValidateBasic() error
Expand Down
1 change: 0 additions & 1 deletion x/evidence/exported/evidence.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ type Evidence interface {
proto.Message

Route() string
Type() string
String() string
Hash() tmbytes.HexBytes
ValidateBasic() error
Expand Down
8 changes: 1 addition & 7 deletions x/evidence/types/evidence.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,13 @@ import (
)

// Evidence type constants
const (
RouteEquivocation = "equivocation"
TypeEquivocation = "equivocation"
)
const RouteEquivocation = "equivocation"

var _ exported.Evidence = &Equivocation{}

// Route returns the Evidence Handler route for an Equivocation type.
func (e *Equivocation) Route() string { return RouteEquivocation }

// Type returns the Evidence Handler type for an Equivocation type.
func (e *Equivocation) Type() string { return TypeEquivocation }

// Hash returns the hash of an Equivocation object.
func (e *Equivocation) Hash() tmbytes.HexBytes {
bz, err := e.Marshal()
Expand Down
2 changes: 0 additions & 2 deletions x/evidence/types/evidence_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ func TestEquivocation_Valid(t *testing.T) {
require.Equal(t, e.GetTime(), e.Time)
require.Equal(t, e.GetConsensusAddress().String(), e.ConsensusAddress)
require.Equal(t, e.GetHeight(), e.Height)
require.Equal(t, e.Type(), types.TypeEquivocation)
require.Equal(t, e.Route(), types.RouteEquivocation)
require.Equal(t, e.Hash().String(), "1E10F9267BEA3A9A4AB5302C2C510CC1AFD7C54E232DA5B2E3360DFAFACF7A76")
require.Equal(t, "height:100 time:<seconds:1136214245 > power:1000000 consensus_address:\"cosmosvalcons1vehk7h6lta047h6lta047h6lta047h6l8m4r53\" ", e.String())
Expand All @@ -38,7 +37,6 @@ func TestEquivocation_Valid(t *testing.T) {
require.Equal(t, e.Time, e.GetTime())
require.Equal(t, e.ConsensusAddress, e.GetConsensusAddress().String())
require.Equal(t, e.Height, e.GetHeight())
require.Equal(t, types.TypeEquivocation, e.Type())
require.Equal(t, types.RouteEquivocation, e.Route())
require.Equal(t, "1E10F9267BEA3A9A4AB5302C2C510CC1AFD7C54E232DA5B2E3360DFAFACF7A76", e.Hash().String())
require.Equal(t, "height:100 time:<seconds:1136214245 > power:1000000 consensus_address:\"cosmosvalcons1vehk7h6lta047h6lta047h6lta047h6l8m4r53\" ", e.String())
Expand Down
4 changes: 0 additions & 4 deletions x/evidence/types/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,6 @@ func (*TestEvidence) Route() string {
return "test-route"
}

func (*TestEvidence) Type() string {
return "test-type"
}

func (*TestEvidence) ProtoMessage() {}
func (*TestEvidence) Reset() {}

Expand Down