refactor: remove type from evidence (#14757)
This commit is contained in:
parent
a16b11d5ee
commit
8fcb029922
@ -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.
|
||||
|
||||
@ -53,7 +53,6 @@ type Evidence interface {
|
||||
proto.Message
|
||||
|
||||
Route() string
|
||||
Type() string
|
||||
String() string
|
||||
Hash() tmbytes.HexBytes
|
||||
ValidateBasic() error
|
||||
|
||||
@ -13,7 +13,6 @@ type Evidence interface {
|
||||
proto.Message
|
||||
|
||||
Route() string
|
||||
Type() string
|
||||
String() string
|
||||
Hash() tmbytes.HexBytes
|
||||
ValidateBasic() error
|
||||
|
||||
@ -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()
|
||||
|
||||
@ -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())
|
||||
|
||||
@ -168,10 +168,6 @@ func (*TestEvidence) Route() string {
|
||||
return "test-route"
|
||||
}
|
||||
|
||||
func (*TestEvidence) Type() string {
|
||||
return "test-type"
|
||||
}
|
||||
|
||||
func (*TestEvidence) ProtoMessage() {}
|
||||
func (*TestEvidence) Reset() {}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user