From 2539f6e4885dbfc8f460aad3ed2f606323567aaf Mon Sep 17 00:00:00 2001 From: Jack Zampolin Date: Mon, 7 Sep 2020 10:08:11 -0700 Subject: [PATCH] Ensure unpacking of connection interfaces in msgs (#7252) --- x/ibc/03-connection/types/msgs.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/x/ibc/03-connection/types/msgs.go b/x/ibc/03-connection/types/msgs.go index 69eb7595b0..9462678a7a 100644 --- a/x/ibc/03-connection/types/msgs.go +++ b/x/ibc/03-connection/types/msgs.go @@ -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" @@ -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)) @@ -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