Skip to content

Commit

Permalink
refactor: remove type from evidence (#14757)
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrbrt committed Jan 24, 2023
1 parent a16b11d commit 8fcb029
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 15 deletions.
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

0 comments on commit 8fcb029

Please sign in to comment.