Skip to content

Commit

Permalink
Ensure unpacking of connection interfaces in msgs (cosmos#7252)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackzampolin authored Sep 7, 2020
1 parent 221a28f commit 2539f6e
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions x/ibc/03-connection/types/msgs.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package types

import (
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
Expand Down Expand Up @@ -144,6 +145,17 @@ func (msg MsgConnectionOpenTry) ValidateBasic() error {
return msg.Counterparty.ValidateBasic()
}

// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces
func (msg MsgConnectionOpenTry) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {
var clientState exported.ClientState
err := unpacker.UnpackAny(msg.ClientState, &clientState)
if err != nil {
return err
}

return nil
}

// GetSignBytes implements sdk.Msg
func (msg MsgConnectionOpenTry) GetSignBytes() []byte {
return sdk.MustSortJSON(SubModuleCdc.MustMarshalJSON(&msg))
Expand Down Expand Up @@ -177,6 +189,17 @@ func NewMsgConnectionOpenAck(
}
}

// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces
func (msg MsgConnectionOpenAck) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {
var clientState exported.ClientState
err := unpacker.UnpackAny(msg.ClientState, &clientState)
if err != nil {
return err
}

return nil
}

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

0 comments on commit 2539f6e

Please sign in to comment.