Skip to content

Commit

Permalink
Removed TypeMsg constants (#2478)
Browse files Browse the repository at this point in the history
* removed TypeMsg constants

* updated changelog.md

* removed associated tests

* removed new variable

Co-authored-by: colin axnér <[email protected]>
  • Loading branch information
alizahidraja and colin-axner authored Oct 7, 2022
1 parent 6a70103 commit 126b6f3
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 54 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (light-clients/06-solomachine) Moving `verifyMisbehaviour` function from update.go to misbehaviour_handle.go.
* (apps/27-interchain-accounts) [\#2297](https://github.com/cosmos/ibc-go/pull/2297) Adding cli command to generate ICS27 packet data.
* (modules/core/keeper) [\#1728](https://github.com/cosmos/ibc-go/pull/2399) Updated channel callback errors to include portID & channelID for better identification of errors.
* [\#2434](https://github.com/cosmos/ibc-go/pull/2478) Removed all `TypeMsg` constants

### Features

Expand Down
16 changes: 0 additions & 16 deletions modules/apps/29-fee/types/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ import (
host "github.com/cosmos/ibc-go/v6/modules/core/24-host"
)

// msg types
const (
TypeMsgPayPacketFee = "payPacketFee"
TypeMsgPayPacketFeeAsync = "payPacketFeeAsync"
)

// NewMsgRegisterPayee creates a new instance of MsgRegisterPayee
func NewMsgRegisterPayee(portID, channelID, relayerAddr, payeeAddr string) *MsgRegisterPayee {
return &MsgRegisterPayee{
Expand Down Expand Up @@ -159,11 +153,6 @@ func (msg MsgPayPacketFee) Route() string {
return RouterKey
}

// Type implements sdk.Msg
func (msg MsgPayPacketFee) Type() string {
return TypeMsgPayPacketFee
}

// GetSignBytes implements sdk.Msg.
func (msg MsgPayPacketFee) GetSignBytes() []byte {
return sdk.MustSortJSON(AminoCdc.MustMarshalJSON(&msg))
Expand Down Expand Up @@ -205,11 +194,6 @@ func (msg MsgPayPacketFeeAsync) Route() string {
return RouterKey
}

// Type implements sdk.Msg
func (msg MsgPayPacketFeeAsync) Type() string {
return TypeMsgPayPacketFeeAsync
}

// GetSignBytes implements sdk.Msg.
func (msg MsgPayPacketFeeAsync) GetSignBytes() []byte {
return sdk.MustSortJSON(AminoCdc.MustMarshalJSON(&msg))
Expand Down
10 changes: 0 additions & 10 deletions modules/apps/29-fee/types/msgs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,6 @@ func TestMsgPayPacketFeeRoute(t *testing.T) {
require.Equal(t, types.RouterKey, msg.Route())
}

func TestMsgPayPacketFeeType(t *testing.T) {
var msg types.MsgPayPacketFee
require.Equal(t, "payPacketFee", msg.Type())
}

func TestMsgPayPacketFeeGetSignBytes(t *testing.T) {
fee := types.NewFee(defaultRecvFee, defaultAckFee, defaultTimeoutFee)
msg := types.NewMsgPayPacketFee(fee, ibctesting.MockFeePort, ibctesting.FirstChannelID, defaultAccAddress, nil)
Expand Down Expand Up @@ -391,11 +386,6 @@ func TestMsgPayPacketFeeAsyncRoute(t *testing.T) {
require.Equal(t, types.RouterKey, msg.Route())
}

func TestMsgPayPacketFeeAsyncType(t *testing.T) {
var msg types.MsgPayPacketFeeAsync
require.Equal(t, "payPacketFeeAsync", msg.Type())
}

func TestMsgPayPacketFeeAsyncGetSignBytes(t *testing.T) {
packetID := channeltypes.NewPacketID(ibctesting.MockFeePort, ibctesting.FirstChannelID, 1)
fee := types.NewFee(defaultRecvFee, defaultAckFee, defaultTimeoutFee)
Expand Down
10 changes: 0 additions & 10 deletions modules/apps/transfer/types/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ import (
host "github.com/cosmos/ibc-go/v6/modules/core/24-host"
)

// msg types
const (
TypeMsgTransfer = "transfer"
)

// NewMsgTransfer creates a new MsgTransfer instance
//
//nolint:interfacer
Expand All @@ -39,11 +34,6 @@ func (MsgTransfer) Route() string {
return RouterKey
}

// Type implements sdk.Msg
func (MsgTransfer) Type() string {
return TypeMsgTransfer
}

// ValidateBasic performs a basic check of the MsgTransfer fields.
// NOTE: timeout height or timestamp values can be 0 to disable the timeout.
// NOTE: The recipient addresses format is not validated as the format defined by
Expand Down
7 changes: 0 additions & 7 deletions modules/apps/transfer/types/msgs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,6 @@ func TestMsgTransferRoute(t *testing.T) {
require.Equal(t, RouterKey, msg.Route())
}

// TestMsgTransferType tests Type for MsgTransfer
func TestMsgTransferType(t *testing.T) {
msg := NewMsgTransfer(validPort, validChannel, coin, addr1, addr2, timeoutHeight, 0)

require.Equal(t, "transfer", msg.Type())
}

func TestMsgTransferGetSignBytes(t *testing.T) {
msg := NewMsgTransfer(validPort, validChannel, coin, addr1, addr2, timeoutHeight, 0)
expected := fmt.Sprintf(`{"type":"cosmos-sdk/MsgTransfer","value":{"receiver":"%s","sender":"%s","source_channel":"testchannel","source_port":"testportid","timeout_height":{"revision_height":"10"},"token":{"amount":"100","denom":"atom"}}}`, addr2, addr1)
Expand Down
8 changes: 0 additions & 8 deletions modules/core/02-client/types/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@ import (
"github.com/cosmos/ibc-go/v6/modules/core/exported"
)

// message types for the IBC client
const (
TypeMsgCreateClient string = "create_client"
TypeMsgUpdateClient string = "update_client"
TypeMsgUpgradeClient string = "upgrade_client"
TypeMsgSubmitMisbehaviour string = "submit_misbehaviour"
)

var (
_ sdk.Msg = &MsgCreateClient{}
_ sdk.Msg = &MsgUpdateClient{}
Expand Down
6 changes: 3 additions & 3 deletions modules/core/04-channel/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ func (suite *KeeperTestSuite) TestGetAllChannelsWithPortPrefix() {
name: "transfer channel is retrieved with prefix",
prefix: "tra",
allChannels: allChannels,
expectedChannels: []types.IdentifiedChannel{types.NewIdentifiedChannel(transfertypes.TypeMsgTransfer, ibctesting.FirstChannelID, types.Channel{})},
expectedChannels: []types.IdentifiedChannel{types.NewIdentifiedChannel(transfertypes.PortID, ibctesting.FirstChannelID, types.Channel{})},
},
{
name: "matches port with full name as prefix",
prefix: transfertypes.TypeMsgTransfer,
prefix: transfertypes.PortID,
allChannels: allChannels,
expectedChannels: []types.IdentifiedChannel{types.NewIdentifiedChannel(transfertypes.TypeMsgTransfer, ibctesting.FirstChannelID, types.Channel{})},
expectedChannels: []types.IdentifiedChannel{types.NewIdentifiedChannel(transfertypes.PortID, ibctesting.FirstChannelID, types.Channel{})},
},
{
name: "no ports match prefix",
Expand Down

0 comments on commit 126b6f3

Please sign in to comment.