diff --git a/x/ibc-account/keeper/relay.go b/x/ibc-account/keeper/relay.go index fc1780c0..cc0791d3 100644 --- a/x/ibc-account/keeper/relay.go +++ b/x/ibc-account/keeper/relay.go @@ -40,11 +40,10 @@ func (k Keeper) TryRegisterIBCAccount(ctx sdk.Context, sourcePort, sourceChannel Data: salt, } - timeoutHeight := clienttypes.Height{ - RevisionNumber: 2, - RevisionHeight: ^uint64(0), - } + timeoutHeight := clienttypes.ZeroHeight() + // timeoutTimestamp is set to be a max number here so that we never recieve a timeout + // ics-27-1 uses ordered channels which can close upon recieving a timeout, which is an undesired effect const timeoutTimestamp = ^uint64(0) packet := channeltypes.NewPacket( @@ -65,7 +64,7 @@ func (k Keeper) TryRegisterIBCAccount(ctx sdk.Context, sourcePort, sourceChannel return nil } -// TryRunTx try to send messages to source channel. +// TryRunTx attemps to send messages to source channel. func (k Keeper) TryRunTx(ctx sdk.Context, sourcePort, sourceChannel, typ string, data interface{}) ([]byte, error) { sourceChannelEnd, found := k.channelKeeper.GetChannel(ctx, sourcePort, sourceChannel) if !found { @@ -129,11 +128,10 @@ func (k Keeper) createOutgoingPacket( Data: txBytes, } - timeoutHeight := clienttypes.Height{ - RevisionNumber: 2, - RevisionHeight: ^uint64(0), - } + timeoutHeight := clienttypes.ZeroHeight() + // timeoutTimestamp is set to be a max number here so that we never recieve a timeout + // ics-27-1 uses ordered channels which can close upon recieving a timeout, which is an undesired effect const timeoutTimestamp = ^uint64(0) packet := channeltypes.NewPacket( diff --git a/x/inter-tx/types/codec.go b/x/inter-tx/types/codec.go index a1be779f..e209bd23 100644 --- a/x/inter-tx/types/codec.go +++ b/x/inter-tx/types/codec.go @@ -15,8 +15,11 @@ func RegisterCodec(cdc *codec.LegacyAmino) { func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) - registry.RegisterImplementations((*sdk.Msg)(nil), &MsgSend{}) - registry.RegisterImplementations((*sdk.Msg)(nil), &MsgRegisterAccount{}) + registry.RegisterImplementations( + (*sdk.Msg)(nil), + &MsgSend{}, + &MsgRegisterAccount{}, + ) } var ( diff --git a/x/inter-tx/types/msgs.go b/x/inter-tx/types/msgs.go index 98143941..6b8d0dd6 100644 --- a/x/inter-tx/types/msgs.go +++ b/x/inter-tx/types/msgs.go @@ -3,6 +3,7 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "strings" ) const ( @@ -34,7 +35,7 @@ func (MsgRegisterAccount) Type() string { } func (msg MsgRegisterAccount) ValidateBasic() error { - if msg.Owner == "" { + if strings.TrimSpace(msg.Owner) == "" { return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "missing sender address") } @@ -58,7 +59,7 @@ var _ sdk.Msg = &MsgSend{} // NewMsgSend creates a new MsgSend instance func NewMsgSend( - chainType, port, channel string, sender, toAddress sdk.AccAddress, amount []sdk.Coin, + chainType, port, channel string, sender, toAddress sdk.AccAddress, amount sdk.Coins, ) *MsgSend { return &MsgSend{ ChainType: chainType, @@ -98,10 +99,6 @@ func (msg MsgSend) ValidateBasic() error { if !msg.Amount.IsValid() { return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, msg.Amount.String()) } - - if !msg.Amount.IsAllPositive() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, msg.Amount.String()) - } return nil }