Ensure unpacking of connection interfaces in msgs (#7252)

This commit is contained in:
Jack Zampolin 2020-09-07 10:08:11 -07:00 committed by GitHub
parent 221a28f876
commit 2539f6e488
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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