refactor: remove type from evidence (#14757)

This commit is contained in:
Julien Robert 2023-01-24 20:14:01 +01:00 committed by GitHub
parent a16b11d5ee
commit 8fcb029922
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 2 additions and 15 deletions

View File

@ -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.

View File

@ -53,7 +53,6 @@ type Evidence interface {
proto.Message
Route() string
Type() string
String() string
Hash() tmbytes.HexBytes
ValidateBasic() error

View File

@ -13,7 +13,6 @@ type Evidence interface {
proto.Message
Route() string
Type() string
String() string
Hash() tmbytes.HexBytes
ValidateBasic() error

View File

@ -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()

View File

@ -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())
@ -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())

View File

@ -168,10 +168,6 @@ func (*TestEvidence) Route() string {
return "test-route"
}
func (*TestEvidence) Type() string {
return "test-type"
}
func (*TestEvidence) ProtoMessage() {}
func (*TestEvidence) Reset() {}