From e86a15eb35b4bb7285b2580a4e5d1da90f605913 Mon Sep 17 00:00:00 2001 From: Cian Hatton Date: Wed, 28 Sep 2022 20:02:32 +0100 Subject: [PATCH] Modify MsgSendTx fields based on audit (#2280) (cherry picked from commit 3c21b5e34bee5be681ee06e42ed7dd0af90edae2) --- docs/ibc/proto-docs.md | 3 +- .../controller/client/cli/tx.go | 25 +-- .../controller/keeper/msg_server.go | 2 +- .../controller/keeper/msg_server_test.go | 3 +- .../controller/types/msgs.go | 21 +-- .../controller/types/msgs_test.go | 7 +- .../controller/types/tx.pb.go | 160 ++++++------------ .../controller/v1/tx.proto | 17 +- 8 files changed, 80 insertions(+), 158 deletions(-) diff --git a/docs/ibc/proto-docs.md b/docs/ibc/proto-docs.md index 7eaa31bf4c3..cc3cadc7fd6 100644 --- a/docs/ibc/proto-docs.md +++ b/docs/ibc/proto-docs.md @@ -1656,9 +1656,8 @@ MsgSendTx defines the payload for Msg/SendTx | ----- | ---- | ----- | ----------- | | `owner` | [string](#string) | | | | `connection_id` | [string](#string) | | | -| `timeout_height` | [ibc.core.client.v1.Height](#ibc.core.client.v1.Height) | | Timeout height relative to the current block height. The timeout is disabled when set to 0. | -| `timeout_timestamp` | [uint64](#uint64) | | Timeout timestamp in absolute nanoseconds since unix epoch. The timeout is disabled when set to 0. | | `packet_data` | [ibc.applications.interchain_accounts.v1.InterchainAccountPacketData](#ibc.applications.interchain_accounts.v1.InterchainAccountPacketData) | | | +| `relative_timeout` | [uint64](#uint64) | | Relative timeout timestamp provided will be added to the current block time during transaction execution. The timeout timestamp must be non-zero. | diff --git a/modules/apps/27-interchain-accounts/controller/client/cli/tx.go b/modules/apps/27-interchain-accounts/controller/client/cli/tx.go index 63f5bfa9cf3..ea54a81c3a8 100644 --- a/modules/apps/27-interchain-accounts/controller/client/cli/tx.go +++ b/modules/apps/27-interchain-accounts/controller/client/cli/tx.go @@ -13,14 +13,12 @@ import ( "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/controller/types" icatypes "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/types" - clienttypes "github.com/cosmos/ibc-go/v6/modules/core/02-client/types" ) const ( // The controller chain channel version - flagVersion = "version" - flagPacketTimeoutHeight = "packet-timeout-height" - flagPacketTimeoutTimestamp = "packet-timeout-timestamp" + flagVersion = "version" + flagRelativePacketTimeout = "relative-packet-timeout" ) func newRegisterInterchainAccountCmd() *cobra.Command { @@ -65,8 +63,7 @@ func newSendTxCmd() *cobra.Command { Short: "Send an interchain account tx on the provided connection.", Long: strings.TrimSpace(`Submits pre-built packet data containing messages to be executed on the host chain and attempts to send the packet. Packet data is provided as json, file or string. An -appropriate relative timeoutTimestamp must be provided with flag {packet-timeout-timestamp}, along with a timeoutHeight -via {packet-timeout-timestamp}`), +appropriate relative timeoutTimestamp must be provided with flag {relative-packet-timeout}`), Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) @@ -94,28 +91,18 @@ via {packet-timeout-timestamp}`), } } - timeoutHeightStr, err := cmd.Flags().GetString(flagPacketTimeoutHeight) - if err != nil { - return err - } - timeoutHeight, err := clienttypes.ParseHeight(timeoutHeightStr) - if err != nil { - return err - } - - timeoutTimestamp, err := cmd.Flags().GetUint64(flagPacketTimeoutTimestamp) + relativeTimeoutTimestamp, err := cmd.Flags().GetUint64(flagRelativePacketTimeout) if err != nil { return err } - msg := types.NewMsgSendTx(owner, connectionID, timeoutHeight, timeoutTimestamp, icaMsgData) + msg := types.NewMsgSendTx(owner, connectionID, relativeTimeoutTimestamp, icaMsgData) return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, } - cmd.Flags().String(flagPacketTimeoutHeight, icatypes.DefaultRelativePacketTimeoutHeight, "Packet timeout block height. The timeout is disabled when set to 0-0.") - cmd.Flags().Uint64(flagPacketTimeoutTimestamp, icatypes.DefaultRelativePacketTimeoutTimestamp, "Packet timeout timestamp in nanoseconds from now. Default is 10 minutes. The timeout is disabled when set to 0.") + cmd.Flags().Uint64(flagRelativePacketTimeout, icatypes.DefaultRelativePacketTimeoutTimestamp, "Relative packet timeout in nanoseconds from now. Default is 10 minutes.") flags.AddTxFlagsToCmd(cmd) return cmd diff --git a/modules/apps/27-interchain-accounts/controller/keeper/msg_server.go b/modules/apps/27-interchain-accounts/controller/keeper/msg_server.go index c0277b4b45a..e59cc5cd884 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/msg_server.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/msg_server.go @@ -50,7 +50,7 @@ func (s msgServer) SendTx(goCtx context.Context, msg *types.MsgSendTx) (*types.M } // explicitly passing nil as the argument is discarded as the channel capability is retrieved in SendTx. - absoluteTimeout := uint64(ctx.BlockTime().UnixNano()) + msg.TimeoutTimestamp + absoluteTimeout := uint64(ctx.BlockTime().UnixNano()) + msg.RelativeTimeout seq, err := s.Keeper.SendTx(ctx, nil, msg.ConnectionId, portID, msg.PacketData, absoluteTimeout) if err != nil { return nil, err diff --git a/modules/apps/27-interchain-accounts/controller/keeper/msg_server_test.go b/modules/apps/27-interchain-accounts/controller/keeper/msg_server_test.go index 9dbc7801523..09594e5911c 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/msg_server_test.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/msg_server_test.go @@ -10,7 +10,6 @@ import ( "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/controller/keeper" "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/controller/types" icatypes "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/types" - clienttypes "github.com/cosmos/ibc-go/v6/modules/core/02-client/types" channeltypes "github.com/cosmos/ibc-go/v6/modules/core/04-channel/types" host "github.com/cosmos/ibc-go/v6/modules/core/24-host" ibctesting "github.com/cosmos/ibc-go/v6/testing" @@ -182,7 +181,7 @@ func (suite *KeeperTestSuite) TestSubmitTx() { timeoutTimestamp := uint64(suite.chainA.GetContext().BlockTime().Add(time.Minute).UnixNano()) connectionID := path.EndpointA.ConnectionID - msg = types.NewMsgSendTx(owner, connectionID, clienttypes.ZeroHeight(), timeoutTimestamp, packetData) + msg = types.NewMsgSendTx(owner, connectionID, timeoutTimestamp, packetData) tc.malleate() // malleate mutates test data diff --git a/modules/apps/27-interchain-accounts/controller/types/msgs.go b/modules/apps/27-interchain-accounts/controller/types/msgs.go index fd8d8720f61..1096c62e9d7 100644 --- a/modules/apps/27-interchain-accounts/controller/types/msgs.go +++ b/modules/apps/27-interchain-accounts/controller/types/msgs.go @@ -7,8 +7,6 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" icatypes "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/types" - clienttypes "github.com/cosmos/ibc-go/v6/modules/core/02-client/types" - channelerrors "github.com/cosmos/ibc-go/v6/modules/core/04-channel/types" host "github.com/cosmos/ibc-go/v6/modules/core/24-host" ) @@ -51,13 +49,12 @@ func (msg MsgRegisterInterchainAccount) GetSigners() []sdk.AccAddress { } // NewMsgSendTx creates a new instance of MsgSendTx -func NewMsgSendTx(owner, connectionID string, timeoutHeight clienttypes.Height, timeoutTimestamp uint64, packetData icatypes.InterchainAccountPacketData) *MsgSendTx { +func NewMsgSendTx(owner, connectionID string, relativeTimeoutTimestamp uint64, packetData icatypes.InterchainAccountPacketData) *MsgSendTx { return &MsgSendTx{ - ConnectionId: connectionID, - Owner: owner, - TimeoutHeight: timeoutHeight, - TimeoutTimestamp: timeoutTimestamp, - PacketData: packetData, + ConnectionId: connectionID, + Owner: owner, + RelativeTimeout: relativeTimeoutTimestamp, + PacketData: packetData, } } @@ -75,14 +72,14 @@ func (msg MsgSendTx) ValidateBasic() error { return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "failed to parse owner address: %s", msg.Owner) } - if msg.TimeoutHeight.IsZero() && msg.TimeoutTimestamp == 0 { - return sdkerrors.Wrap(channelerrors.ErrInvalidTimeout, "msg timeout height and msg timeout timestamp cannot both be 0") - } - if err := msg.PacketData.ValidateBasic(); err != nil { return sdkerrors.Wrap(err, "invalid interchain account packet data") } + if msg.RelativeTimeout == 0 { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "relative timeout cannot be zero") + } + return nil } diff --git a/modules/apps/27-interchain-accounts/controller/types/msgs_test.go b/modules/apps/27-interchain-accounts/controller/types/msgs_test.go index 5fe57e212c7..933798560ce 100644 --- a/modules/apps/27-interchain-accounts/controller/types/msgs_test.go +++ b/modules/apps/27-interchain-accounts/controller/types/msgs_test.go @@ -10,7 +10,6 @@ import ( "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/controller/types" icatypes "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/types" feetypes "github.com/cosmos/ibc-go/v6/modules/apps/29-fee/types" - clienttypes "github.com/cosmos/ibc-go/v6/modules/core/02-client/types" ibctesting "github.com/cosmos/ibc-go/v6/testing" "github.com/cosmos/ibc-go/v6/testing/simapp" ) @@ -133,9 +132,9 @@ func TestMsgSendTxValidateBasic(t *testing.T) { false, }, { - "timeout height and timestamp are both not set", + "relative timeout is not set", func() { - msg.TimeoutTimestamp = 0 + msg.RelativeTimeout = 0 }, false, }, @@ -167,7 +166,6 @@ func TestMsgSendTxValidateBasic(t *testing.T) { msg = types.NewMsgSendTx( ibctesting.TestAccAddress, ibctesting.FirstConnectionID, - clienttypes.ZeroHeight(), 100000, packetData, ) @@ -204,7 +202,6 @@ func TestMsgSendTxGetSigners(t *testing.T) { msg := types.NewMsgSendTx( ibctesting.TestAccAddress, ibctesting.FirstConnectionID, - clienttypes.ZeroHeight(), 100000, packetData, ) diff --git a/modules/apps/27-interchain-accounts/controller/types/tx.pb.go b/modules/apps/27-interchain-accounts/controller/types/tx.pb.go index b5b40226beb..58d0ad42980 100644 --- a/modules/apps/27-interchain-accounts/controller/types/tx.pb.go +++ b/modules/apps/27-interchain-accounts/controller/types/tx.pb.go @@ -6,8 +6,7 @@ package types import ( context "context" fmt "fmt" - types1 "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/types" - types "github.com/cosmos/ibc-go/v6/modules/core/02-client/types" + types "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/types" _ "github.com/gogo/protobuf/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" @@ -117,15 +116,12 @@ func (m *MsgRegisterInterchainAccountResponse) GetChannelId() string { // MsgSendTx defines the payload for Msg/SendTx type MsgSendTx struct { - Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` - ConnectionId string `protobuf:"bytes,2,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty" yaml:"connection_id"` - // Timeout height relative to the current block height. - // The timeout is disabled when set to 0. - TimeoutHeight types.Height `protobuf:"bytes,3,opt,name=timeout_height,json=timeoutHeight,proto3" json:"timeout_height" yaml:"timeout_height"` - // Timeout timestamp in absolute nanoseconds since unix epoch. - // The timeout is disabled when set to 0. - TimeoutTimestamp uint64 `protobuf:"varint,4,opt,name=timeout_timestamp,json=timeoutTimestamp,proto3" json:"timeout_timestamp,omitempty" yaml:"timeout_timestamp"` - PacketData types1.InterchainAccountPacketData `protobuf:"bytes,5,opt,name=packet_data,json=packetData,proto3" json:"packet_data" yaml:"packet_data"` + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + ConnectionId string `protobuf:"bytes,2,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty" yaml:"connection_id"` + PacketData types.InterchainAccountPacketData `protobuf:"bytes,3,opt,name=packet_data,json=packetData,proto3" json:"packet_data" yaml:"packet_data"` + // Relative timeout timestamp provided will be added to the current block time during transaction execution. + // The timeout timestamp must be non-zero. + RelativeTimeout uint64 `protobuf:"varint,4,opt,name=relative_timeout,json=relativeTimeout,proto3" json:"relative_timeout,omitempty" yaml:"relative_timeout"` } func (m *MsgSendTx) Reset() { *m = MsgSendTx{} } @@ -218,45 +214,42 @@ func init() { } var fileDescriptor_7def041328c84a30 = []byte{ - // 601 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x54, 0x3d, 0x6f, 0xd4, 0x40, - 0x10, 0xb5, 0xf3, 0x45, 0xb2, 0x21, 0x88, 0x58, 0x89, 0x64, 0xac, 0x60, 0x47, 0x16, 0x45, 0x9a, - 0xec, 0xea, 0x8e, 0x08, 0xa4, 0xa0, 0x14, 0x58, 0x41, 0xe2, 0x8a, 0x48, 0x91, 0x49, 0x81, 0x10, - 0xd2, 0xb1, 0xb7, 0x5e, 0xf9, 0x16, 0xec, 0x5d, 0xe3, 0xdd, 0x33, 0x49, 0x49, 0x47, 0x85, 0xe8, - 0x28, 0x68, 0xf2, 0x6f, 0x48, 0x99, 0x92, 0xea, 0x14, 0x25, 0x0d, 0xf5, 0xfd, 0x02, 0xe4, 0x8f, - 0xf3, 0xdd, 0x89, 0x10, 0x85, 0xaf, 0xca, 0x3b, 0xbb, 0xf3, 0x66, 0xde, 0xe8, 0x3d, 0x0f, 0x78, - 0xc4, 0x3a, 0x04, 0xe1, 0x24, 0x89, 0x18, 0xc1, 0x8a, 0x09, 0x2e, 0x11, 0xe3, 0x8a, 0xa6, 0xa4, - 0x8b, 0x19, 0x6f, 0x63, 0x42, 0x44, 0x8f, 0x2b, 0x89, 0x88, 0xe0, 0x2a, 0x15, 0x51, 0x44, 0x53, - 0x94, 0x35, 0x90, 0x3a, 0x84, 0x49, 0x2a, 0x94, 0x30, 0x9a, 0xac, 0x43, 0xe0, 0x38, 0x18, 0x5e, - 0x02, 0x86, 0x23, 0x30, 0xcc, 0x1a, 0xd6, 0x4a, 0x28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0x4f, 0xce, 0x6d, 0xfd, 0xf4, 0xdc, 0xd6, 0xcf, 0xce, 0x6d, 0xfd, - 0xd3, 0x85, 0xad, 0x9d, 0x5e, 0xd8, 0xda, 0xb7, 0x0b, 0x5b, 0x7b, 0xb1, 0x1f, 0x32, 0xd5, 0xed, - 0x75, 0x20, 0x11, 0x31, 0x22, 0x42, 0xc6, 0x42, 0x22, 0xd6, 0x21, 0x9b, 0xa1, 0x40, 0xd9, 0x03, - 0x14, 0x8b, 0xa0, 0x17, 0x51, 0x99, 0x6f, 0x26, 0x89, 0x9a, 0x0f, 0x37, 0x47, 0xad, 0x37, 0x2f, - 0x5b, 0x9e, 0xea, 0x28, 0xa1, 0xb2, 0x33, 0x57, 0x2c, 0xa7, 0xfb, 0x3f, 0x02, 0x00, 0x00, 0xff, - 0xff, 0x18, 0xdf, 0x55, 0x9f, 0x7c, 0x05, 0x00, 0x00, + // 546 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x94, 0xbf, 0x6f, 0xd3, 0x40, + 0x14, 0xc7, 0xed, 0x34, 0x94, 0xe6, 0x0a, 0x82, 0x5a, 0x41, 0x18, 0x83, 0xec, 0xca, 0x62, 0xe8, + 0x92, 0x3b, 0x25, 0x54, 0x20, 0x15, 0x75, 0x20, 0x2a, 0x48, 0x19, 0x22, 0x45, 0xa6, 0x03, 0x42, + 0x48, 0xd1, 0xe5, 0x7c, 0x72, 0x0e, 0x9c, 0x3b, 0xe3, 0xbb, 0x98, 0x76, 0x64, 0x63, 0x42, 0x6c, + 0xac, 0xfd, 0x2b, 0xf8, 0x17, 0xe8, 0xd8, 0x91, 0x29, 0xaa, 0x92, 0x85, 0x39, 0x7f, 0x01, 0xb2, + 0x9d, 0x38, 0x01, 0x4a, 0x55, 0x7e, 0x6d, 0x7e, 0x77, 0xf7, 0x79, 0xef, 0xfb, 0x7e, 0xf8, 0x81, + 0x87, 0xac, 0x47, 0x10, 0x8e, 0xa2, 0x90, 0x11, 0xac, 0x98, 0xe0, 0x12, 0x31, 0xae, 0x68, 0x4c, + 0xfa, 0x98, 0xf1, 0x2e, 0x26, 0x44, 0x0c, 0xb9, 0x92, 0x88, 0x08, 0xae, 0x62, 0x11, 0x86, 0x34, + 0x46, 0x49, 0x1d, 0xa9, 0x03, 0x18, 0xc5, 0x42, 0x09, 0xa3, 0xc1, 0x7a, 0x04, 0x2e, 0xc3, 0xf0, + 0x0c, 0x18, 0x2e, 0x60, 0x98, 0xd4, 0xad, 0x6a, 0x20, 0x02, 0x91, 0xe1, 0x28, 0xfd, 0xca, 0x3d, + 0x59, 0xdb, 0x17, 0x92, 0x91, 0xd4, 0x51, 0x84, 0xc9, 0x2b, 0xaa, 0x72, 0xca, 0xfd, 0xa8, 0x83, + 0x3b, 0x6d, 0x19, 0x78, 0x34, 0x60, 0x52, 0xd1, 0xb8, 0x55, 0x20, 0x8f, 0x72, 0xc2, 0xa8, 0x82, + 0x4b, 0xe2, 0x0d, 0xa7, 0xb1, 0xa9, 0x6f, 0xea, 0x5b, 0x15, 0x2f, 0x37, 0x8c, 0x5d, 0x70, 0x95, + 0x08, 0xce, 0x29, 0x49, 0x23, 0x75, 0x99, 0x6f, 0x96, 0xd2, 0xdb, 0xa6, 0x39, 0x1d, 0x39, 0xd5, + 0x43, 0x3c, 0x08, 0x77, 0xdc, 0xef, 0xae, 0x5d, 0xef, 0xca, 0xc2, 0x6e, 0xf9, 0x86, 0x09, 0x2e, + 0x27, 0x34, 0x96, 0x4c, 0x70, 0x73, 0x25, 0x73, 0x3b, 0x37, 0x77, 0xd6, 0xde, 0x1d, 0x39, 0xda, + 0xd7, 0x23, 0x47, 0x73, 0x5f, 0x80, 0xbb, 0xe7, 0x09, 0xf3, 0xa8, 0x8c, 0x04, 0x97, 0xd4, 0xd8, + 0x06, 0x80, 0xf4, 0x31, 0xe7, 0x34, 0x4c, 0x75, 0x64, 0x2a, 0x9b, 0x37,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b, 0x3f, 0x19, 0xdb, 0xfa, 0xe9, 0xd8, 0xd6, 0x3f, 0x4c, 0x6c, 0xed, 0x64, 0x62, 0x6b, + 0x5f, 0x26, 0xb6, 0xf6, 0xbc, 0x13, 0x30, 0xd5, 0x1f, 0xf6, 0x20, 0x11, 0x03, 0x44, 0x84, 0x1c, + 0x08, 0x89, 0x58, 0x8f, 0xd4, 0x02, 0x81, 0x92, 0xfb, 0x68, 0x20, 0xfc, 0x61, 0x48, 0x65, 0xba, + 0x34, 0x24, 0x6a, 0x3c, 0xa8, 0x2d, 0x42, 0xd7, 0xce, 0x5a, 0x5b, 0xea, 0x30, 0xa2, 0xb2, 0xb7, + 0x9a, 0xed, 0x8d, 0x7b, 0xdf, 0x02, 0x00, 0x00, 0xff, 0xff, 0x67, 0xf2, 0x97, 0x46, 0xf6, 0x04, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -473,23 +466,13 @@ func (m *MsgSendTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - { - size, err := m.PacketData.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - if m.TimeoutTimestamp != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.TimeoutTimestamp)) + if m.RelativeTimeout != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.RelativeTimeout)) i-- dAtA[i] = 0x20 } { - size, err := m.TimeoutHeight.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.PacketData.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -602,13 +585,11 @@ func (m *MsgSendTx) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = m.TimeoutHeight.Size() - n += 1 + l + sovTx(uint64(l)) - if m.TimeoutTimestamp != 0 { - n += 1 + sovTx(uint64(m.TimeoutTimestamp)) - } l = m.PacketData.Size() n += 1 + l + sovTx(uint64(l)) + if m.RelativeTimeout != 0 { + n += 1 + sovTx(uint64(m.RelativeTimeout)) + } return n } @@ -953,7 +934,7 @@ func (m *MsgSendTx) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TimeoutHeight", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PacketData", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -980,34 +961,15 @@ func (m *MsgSendTx) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.TimeoutHeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.PacketData.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 4: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TimeoutTimestamp", wireType) - } - m.TimeoutTimestamp = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TimeoutTimestamp |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } + return fmt.Errorf("proto: wrong wireType = %d for field RelativeTimeout", wireType) } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PacketData", wireType) - } - var msglen int + m.RelativeTimeout = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1017,25 +979,11 @@ func (m *MsgSendTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + m.RelativeTimeout |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.PacketData.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) diff --git a/proto/ibc/applications/interchain_accounts/controller/v1/tx.proto b/proto/ibc/applications/interchain_accounts/controller/v1/tx.proto index b979f880c16..e35795f832e 100644 --- a/proto/ibc/applications/interchain_accounts/controller/v1/tx.proto +++ b/proto/ibc/applications/interchain_accounts/controller/v1/tx.proto @@ -5,7 +5,6 @@ package ibc.applications.interchain_accounts.controller.v1; option go_package = "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/controller/types"; import "gogoproto/gogo.proto"; -import "ibc/core/client/v1/client.proto"; import "ibc/applications/interchain_accounts/v1/packet.proto"; // Msg defines the 27-interchain-accounts/controller Msg service. @@ -38,18 +37,14 @@ message MsgSendTx { string owner = 1; string connection_id = 2 [(gogoproto.moretags) = "yaml:\"connection_id\""]; - // Timeout height relative to the current block height. - // The timeout is disabled when set to 0. - ibc.core.client.v1.Height timeout_height = 3 - [(gogoproto.moretags) = "yaml:\"timeout_height\"", (gogoproto.nullable) = false]; - // Timeout timestamp in absolute nanoseconds since unix epoch. - // The timeout is disabled when set to 0. - uint64 timeout_timestamp = 4 [(gogoproto.moretags) = "yaml:\"timeout_timestamp\""]; - ibc.applications.interchain_accounts.v1.InterchainAccountPacketData packet_data = 5 - [(gogoproto.moretags) = "yaml:\"packet_data\"", (gogoproto.nullable) = false]; + ibc.applications.interchain_accounts.v1.InterchainAccountPacketData packet_data = 3 + [(gogoproto.moretags) = "yaml:\"packet_data\"", (gogoproto.nullable) = false]; + // Relative timeout timestamp provided will be added to the current block time during transaction execution. + // The timeout timestamp must be non-zero. + uint64 relative_timeout = 4 [(gogoproto.moretags) = "yaml:\"relative_timeout\""]; } // MsgSendTxResponse defines the response for MsgSendTx message MsgSendTxResponse { uint64 sequence = 1; -} \ No newline at end of file +}