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

remove Type(), Route(), GetSignBytes() (removed from sdk.Msg interface) #161

Merged
merged 3 commits into from
May 10, 2021
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 @@ -44,6 +44,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

### API Breaking

* (modules/core) [\#161](https://github.com/cosmos/ibc-go/pull/161) Remove Type(), Route(), GetSignBytes() from 02-client, 03-connection, and 04-channel messages.
* (modules) [\#140](https://github.com/cosmos/ibc-go/pull/140) IsFrozen() client state interface changed to Status(). gRPC `ClientStatus` route added.
* (modules/core) [\#109](https://github.com/cosmos/ibc-go/pull/109) Remove connection and channel handshake CLI commands.
* (modules) [\#107](https://github.com/cosmos/ibc-go/pull/107) Modify OnRecvPacket callback to return an acknowledgement which indicates if it is successful or not. Callback state changes are discarded for unsuccessful acknowledgements only.
Expand Down
62 changes: 0 additions & 62 deletions modules/core/02-client/types/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,6 @@ func NewMsgCreateClient(
}, nil
}

// Route implements sdk.Msg
func (msg MsgCreateClient) Route() string {
return host.RouterKey
}

// Type implements sdk.Msg
func (msg MsgCreateClient) Type() string {
return TypeMsgCreateClient
}

// ValidateBasic implements sdk.Msg
func (msg MsgCreateClient) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.Signer)
Expand Down Expand Up @@ -90,12 +80,6 @@ func (msg MsgCreateClient) ValidateBasic() error {
return consensusState.ValidateBasic()
}

// GetSignBytes implements sdk.Msg. The function will panic since it is used
// for amino transaction verification which IBC does not support.
func (msg MsgCreateClient) GetSignBytes() []byte {
panic("IBC messages do not support amino")
}

// GetSigners implements sdk.Msg
func (msg MsgCreateClient) GetSigners() []sdk.AccAddress {
accAddr, err := sdk.AccAddressFromBech32(msg.Signer)
Expand Down Expand Up @@ -132,16 +116,6 @@ func NewMsgUpdateClient(id string, header exported.Header, signer string) (*MsgU
}, nil
}

// Route implements sdk.Msg
func (msg MsgUpdateClient) Route() string {
return host.RouterKey
}

// Type implements sdk.Msg
func (msg MsgUpdateClient) Type() string {
return TypeMsgUpdateClient
}

// ValidateBasic implements sdk.Msg
func (msg MsgUpdateClient) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.Signer)
Expand All @@ -161,12 +135,6 @@ func (msg MsgUpdateClient) ValidateBasic() error {
return host.ClientIdentifierValidator(msg.ClientId)
}

// GetSignBytes implements sdk.Msg. The function will panic since it is used
// for amino transaction verification which IBC does not support.
func (msg MsgUpdateClient) GetSignBytes() []byte {
panic("IBC messages do not support amino")
}

// GetSigners implements sdk.Msg
func (msg MsgUpdateClient) GetSigners() []sdk.AccAddress {
accAddr, err := sdk.AccAddressFromBech32(msg.Signer)
Expand Down Expand Up @@ -205,16 +173,6 @@ func NewMsgUpgradeClient(clientID string, clientState exported.ClientState, cons
}, nil
}

// Route implements sdk.Msg
func (msg MsgUpgradeClient) Route() string {
return host.RouterKey
}

// Type implements sdk.Msg
func (msg MsgUpgradeClient) Type() string {
return TypeMsgUpgradeClient
}

// ValidateBasic implements sdk.Msg
func (msg MsgUpgradeClient) ValidateBasic() error {
// will not validate client state as committed client may not form a valid client state.
Expand Down Expand Up @@ -247,12 +205,6 @@ func (msg MsgUpgradeClient) ValidateBasic() error {
return host.ClientIdentifierValidator(msg.ClientId)
}

// GetSignBytes implements sdk.Msg. The function will panic since it is used
// for amino transaction verification which IBC does not support.
func (msg MsgUpgradeClient) GetSignBytes() []byte {
panic("IBC messages do not support amino")
}

// GetSigners implements sdk.Msg
func (msg MsgUpgradeClient) GetSigners() []sdk.AccAddress {
accAddr, err := sdk.AccAddressFromBech32(msg.Signer)
Expand Down Expand Up @@ -289,14 +241,6 @@ func NewMsgSubmitMisbehaviour(clientID string, misbehaviour exported.Misbehaviou
}, nil
}

// Route returns the MsgSubmitClientMisbehaviour's route.
func (msg MsgSubmitMisbehaviour) Route() string { return host.RouterKey }

// Type returns the MsgSubmitMisbehaviour's type.
func (msg MsgSubmitMisbehaviour) Type() string {
return TypeMsgSubmitMisbehaviour
}

// ValidateBasic performs basic (non-state-dependant) validation on a MsgSubmitMisbehaviour.
func (msg MsgSubmitMisbehaviour) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.Signer)
Expand All @@ -321,12 +265,6 @@ func (msg MsgSubmitMisbehaviour) ValidateBasic() error {
return host.ClientIdentifierValidator(msg.ClientId)
}

// GetSignBytes implements sdk.Msg. The function will panic since it is used
// for amino transaction verification which IBC does not support.
func (msg MsgSubmitMisbehaviour) GetSignBytes() []byte {
panic("IBC messages do not support amino")
}

// GetSigners returns the single expected signer for a MsgSubmitMisbehaviour.
func (msg MsgSubmitMisbehaviour) GetSigners() []sdk.AccAddress {
accAddr, err := sdk.AccAddressFromBech32(msg.Signer)
Expand Down
8 changes: 4 additions & 4 deletions modules/core/03-connection/types/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ const (

// IBC connection events vars
var (
EventTypeConnectionOpenInit = MsgConnectionOpenInit{}.Type()
EventTypeConnectionOpenTry = MsgConnectionOpenTry{}.Type()
EventTypeConnectionOpenAck = MsgConnectionOpenAck{}.Type()
EventTypeConnectionOpenConfirm = MsgConnectionOpenConfirm{}.Type()
EventTypeConnectionOpenInit = "connection_open_init"
EventTypeConnectionOpenTry = "connection_open_try"
EventTypeConnectionOpenAck = "connection_open_ack"
EventTypeConnectionOpenConfirm = "connection_open_confirm"

AttributeValueCategory = fmt.Sprintf("%s_%s", host.ModuleName, SubModuleName)
)
64 changes: 0 additions & 64 deletions modules/core/03-connection/types/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,6 @@ func NewMsgConnectionOpenInit(
}
}

// Route implements sdk.Msg
func (msg MsgConnectionOpenInit) Route() string {
return host.RouterKey
}

// Type implements sdk.Msg
func (msg MsgConnectionOpenInit) Type() string {
return "connection_open_init"
}

// ValidateBasic implements sdk.Msg.
func (msg MsgConnectionOpenInit) ValidateBasic() error {
if err := host.ClientIdentifierValidator(msg.ClientId); err != nil {
Expand All @@ -71,12 +61,6 @@ func (msg MsgConnectionOpenInit) ValidateBasic() error {
return msg.Counterparty.ValidateBasic()
}

// GetSignBytes implements sdk.Msg. The function will panic since it is used
// for amino transaction verification which IBC does not support.
func (msg MsgConnectionOpenInit) GetSignBytes() []byte {
panic("IBC messages do not support amino")
}

// GetSigners implements sdk.Msg
func (msg MsgConnectionOpenInit) GetSigners() []sdk.AccAddress {
accAddr, err := sdk.AccAddressFromBech32(msg.Signer)
Expand Down Expand Up @@ -114,16 +98,6 @@ func NewMsgConnectionOpenTry(
}
}

// Route implements sdk.Msg
func (msg MsgConnectionOpenTry) Route() string {
return host.RouterKey
}

// Type implements sdk.Msg
func (msg MsgConnectionOpenTry) Type() string {
return "connection_open_try"
}

// ValidateBasic implements sdk.Msg
func (msg MsgConnectionOpenTry) ValidateBasic() error {
// an empty connection identifier indicates that a connection identifier should be generated
Expand Down Expand Up @@ -184,12 +158,6 @@ func (msg MsgConnectionOpenTry) UnpackInterfaces(unpacker codectypes.AnyUnpacker
return unpacker.UnpackAny(msg.ClientState, new(exported.ClientState))
}

// GetSignBytes implements sdk.Msg. The function will panic since it is used
// for amino transaction verification which IBC does not support.
func (msg MsgConnectionOpenTry) GetSignBytes() []byte {
panic("IBC messages do not support amino")
}

// GetSigners implements sdk.Msg
func (msg MsgConnectionOpenTry) GetSigners() []sdk.AccAddress {
accAddr, err := sdk.AccAddressFromBech32(msg.Signer)
Expand Down Expand Up @@ -228,16 +196,6 @@ func (msg MsgConnectionOpenAck) UnpackInterfaces(unpacker codectypes.AnyUnpacker
return unpacker.UnpackAny(msg.ClientState, new(exported.ClientState))
}

// Route implements sdk.Msg
func (msg MsgConnectionOpenAck) Route() string {
return host.RouterKey
}

// Type implements sdk.Msg
func (msg MsgConnectionOpenAck) Type() string {
return "connection_open_ack"
}

// ValidateBasic implements sdk.Msg
func (msg MsgConnectionOpenAck) ValidateBasic() error {
if !IsValidConnectionID(msg.ConnectionId) {
Expand Down Expand Up @@ -281,12 +239,6 @@ func (msg MsgConnectionOpenAck) ValidateBasic() error {
return nil
}

// GetSignBytes implements sdk.Msg. The function will panic since it is used
// for amino transaction verification which IBC does not support.
func (msg MsgConnectionOpenAck) GetSignBytes() []byte {
panic("IBC messages do not support amino")
}

// GetSigners implements sdk.Msg
func (msg MsgConnectionOpenAck) GetSigners() []sdk.AccAddress {
accAddr, err := sdk.AccAddressFromBech32(msg.Signer)
Expand All @@ -310,16 +262,6 @@ func NewMsgConnectionOpenConfirm(
}
}

// Route implements sdk.Msg
func (msg MsgConnectionOpenConfirm) Route() string {
return host.RouterKey
}

// Type implements sdk.Msg
func (msg MsgConnectionOpenConfirm) Type() string {
return "connection_open_confirm"
}

// ValidateBasic implements sdk.Msg
func (msg MsgConnectionOpenConfirm) ValidateBasic() error {
if !IsValidConnectionID(msg.ConnectionId) {
Expand All @@ -338,12 +280,6 @@ func (msg MsgConnectionOpenConfirm) ValidateBasic() error {
return nil
}

// GetSignBytes implements sdk.Msg. The function will panic since it is used
// for amino transaction verification which IBC does not support.
func (msg MsgConnectionOpenConfirm) GetSignBytes() []byte {
panic("IBC messages do not support amino")
}

// GetSigners implements sdk.Msg
func (msg MsgConnectionOpenConfirm) GetSigners() []sdk.AccAddress {
accAddr, err := sdk.AccAddressFromBech32(msg.Signer)
Expand Down
23 changes: 12 additions & 11 deletions modules/core/04-channel/types/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ const (
AttributeCounterpartyPortID = "counterparty_port_id"
AttributeCounterpartyChannelID = "counterparty_channel_id"

EventTypeSendPacket = "send_packet"
EventTypeRecvPacket = "recv_packet"
EventTypeWriteAck = "write_acknowledgement"
EventTypeAcknowledgePacket = "acknowledge_packet"
EventTypeTimeoutPacket = "timeout_packet"
EventTypeSendPacket = "send_packet"
EventTypeRecvPacket = "recv_packet"
EventTypeWriteAck = "write_acknowledgement"
EventTypeAcknowledgePacket = "acknowledge_packet"
EventTypeTimeoutPacket = "timeout_packet"
EventTypeTimeoutPacketOnClose = "timeout_on_close_packet"

// NOTE: DEPRECATED in favor of AttributeKeyDataHex
AttributeKeyData = "packet_data"
Expand All @@ -38,12 +39,12 @@ const (

// IBC channel events vars
var (
EventTypeChannelOpenInit = MsgChannelOpenInit{}.Type()
EventTypeChannelOpenTry = MsgChannelOpenTry{}.Type()
EventTypeChannelOpenAck = MsgChannelOpenAck{}.Type()
EventTypeChannelOpenConfirm = MsgChannelOpenConfirm{}.Type()
EventTypeChannelCloseInit = MsgChannelCloseInit{}.Type()
EventTypeChannelCloseConfirm = MsgChannelCloseConfirm{}.Type()
EventTypeChannelOpenInit = "channel_open_init"
EventTypeChannelOpenTry = "channel_open_try"
EventTypeChannelOpenAck = "channel_open_ack"
EventTypeChannelOpenConfirm = "channel_open_confirm"
EventTypeChannelCloseInit = "channel_close_init"
EventTypeChannelCloseConfirm = "channel_close_confirm"

AttributeValueCategory = fmt.Sprintf("%s_%s", host.ModuleName, SubModuleName)
)
Loading