From e483b9a5fb6887c97c6f76257967b8b40bbf82cf Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Wed, 12 Jun 2024 12:32:46 +0200 Subject: [PATCH 1/5] chore: rename ForwardingInfo to Forwarding --- e2e/testsuite/testsuite.go | 20 ++-- modules/apps/transfer/keeper/export_test.go | 2 +- modules/apps/transfer/keeper/relay.go | 12 +-- .../transfer/keeper/relay_forwarding_test.go | 11 +-- modules/apps/transfer/types/msgs.go | 3 +- modules/apps/transfer/types/packet.go | 2 +- modules/apps/transfer/types/packet.pb.go | 56 +++++------ modules/apps/transfer/types/packet_test.go | 4 +- modules/apps/transfer/types/transfer.pb.go | 92 +++++++++---------- modules/apps/transfer/types/tx.pb.go | 89 +++++++++--------- .../applications/transfer/v1/transfer.proto | 4 +- proto/ibc/applications/transfer/v1/tx.proto | 2 +- .../ibc/applications/transfer/v2/packet.proto | 2 +- 13 files changed, 146 insertions(+), 153 deletions(-) diff --git a/e2e/testsuite/testsuite.go b/e2e/testsuite/testsuite.go index 9a113fbd7e9..e9c1d7fc96d 100644 --- a/e2e/testsuite/testsuite.go +++ b/e2e/testsuite/testsuite.go @@ -8,6 +8,14 @@ import ( "path" "strings" + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + feetypes "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types" + transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" dockerclient "github.com/docker/docker/client" interchaintest "github.com/strangelove-ventures/interchaintest/v8" "github.com/strangelove-ventures/interchaintest/v8/chain/cosmos" @@ -17,21 +25,11 @@ import ( testifysuite "github.com/stretchr/testify/suite" "go.uber.org/zap" - sdkmath "cosmossdk.io/math" - - sdk "github.com/cosmos/cosmos-sdk/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - "github.com/cosmos/ibc-go/e2e/internal/directories" "github.com/cosmos/ibc-go/e2e/relayer" "github.com/cosmos/ibc-go/e2e/testsuite/diagnostics" "github.com/cosmos/ibc-go/e2e/testsuite/query" "github.com/cosmos/ibc-go/e2e/testvalues" - feetypes "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types" - transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" ) const ( @@ -563,7 +561,7 @@ func getValidatorsAndFullNodes(chainIdx int) (int, int) { } // GetMsgTransfer returns a MsgTransfer that is constructed based on the channel version -func GetMsgTransfer(portID, channelID, version string, tokens sdk.Coins, sender, receiver string, timeoutHeight clienttypes.Height, timeoutTimestamp uint64, memo string, forwardingPath *transfertypes.ForwardingInfo) *transfertypes.MsgTransfer { +func GetMsgTransfer(portID, channelID, version string, tokens sdk.Coins, sender, receiver string, timeoutHeight clienttypes.Height, timeoutTimestamp uint64, memo string, forwardingPath *transfertypes.Forwarding) *transfertypes.MsgTransfer { if len(tokens) == 0 { panic(errors.New("tokens cannot be empty")) } diff --git a/modules/apps/transfer/keeper/export_test.go b/modules/apps/transfer/keeper/export_test.go index 760e04cc97f..670f85b7ac3 100644 --- a/modules/apps/transfer/keeper/export_test.go +++ b/modules/apps/transfer/keeper/export_test.go @@ -34,6 +34,6 @@ func (k Keeper) TokenFromCoin(ctx sdk.Context, coin sdk.Coin) (types.Token, erro } // CreatePacketDataBytesFromVersion is a wrapper around createPacketDataBytesFromVersion for testing purposes -func CreatePacketDataBytesFromVersion(appVersion, sender, receiver, memo string, tokens types.Tokens, forwardingPath *types.ForwardingInfo) []byte { +func CreatePacketDataBytesFromVersion(appVersion, sender, receiver, memo string, tokens types.Tokens, forwardingPath *types.Forwarding) []byte { return createPacketDataBytesFromVersion(appVersion, sender, receiver, memo, tokens, forwardingPath) } diff --git a/modules/apps/transfer/keeper/relay.go b/modules/apps/transfer/keeper/relay.go index c4957aae5e3..ccd320f5471 100644 --- a/modules/apps/transfer/keeper/relay.go +++ b/modules/apps/transfer/keeper/relay.go @@ -5,13 +5,11 @@ import ( "fmt" "strings" - "github.com/hashicorp/go-metrics" - errorsmod "cosmossdk.io/errors" sdkmath "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/hashicorp/go-metrics" "github.com/cosmos/ibc-go/v8/modules/apps/transfer/internal/events" internaltelemetry "github.com/cosmos/ibc-go/v8/modules/apps/transfer/internal/telemetry" @@ -65,7 +63,7 @@ func (k Keeper) sendTransfer( timeoutHeight clienttypes.Height, timeoutTimestamp uint64, memo string, - forwardingPath *types.ForwardingInfo, + forwardingPath *types.Forwarding, ) (uint64, error) { channel, found := k.channelKeeper.GetChannel(ctx, sourcePort, sourceChannel) if !found { @@ -277,12 +275,12 @@ func (k Keeper) OnRecvPacket(ctx sdk.Context, packet channeltypes.Packet, data t if data.ForwardingPath != nil && len(data.ForwardingPath.Hops) > 0 { memo := "" - var nextForwardingPath *types.ForwardingInfo + var nextForwardingPath *types.Forwarding if len(data.ForwardingPath.Hops) == 1 { memo = data.ForwardingPath.Memo nextForwardingPath = nil } else { - nextForwardingPath = &types.ForwardingInfo{ + nextForwardingPath = &types.Forwarding{ Hops: data.ForwardingPath.Hops[1:], Memo: data.ForwardingPath.Memo, } @@ -551,7 +549,7 @@ func (k Keeper) tokenFromCoin(ctx sdk.Context, coin sdk.Coin) (types.Token, erro } // createPacketDataBytesFromVersion creates the packet data bytes to be sent based on the application version. -func createPacketDataBytesFromVersion(appVersion, sender, receiver, memo string, tokens types.Tokens, forwardingPath *types.ForwardingInfo) []byte { +func createPacketDataBytesFromVersion(appVersion, sender, receiver, memo string, tokens types.Tokens, forwardingPath *types.Forwarding) []byte { var packetDataBytes []byte switch appVersion { case types.V1: diff --git a/modules/apps/transfer/keeper/relay_forwarding_test.go b/modules/apps/transfer/keeper/relay_forwarding_test.go index bdb1aa2b0ae..341b1daad80 100644 --- a/modules/apps/transfer/keeper/relay_forwarding_test.go +++ b/modules/apps/transfer/keeper/relay_forwarding_test.go @@ -4,7 +4,6 @@ import ( "fmt" sdkmath "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" @@ -27,7 +26,7 @@ func (suite *KeeperTestSuite) TestPathForwarding() { coin := sdk.NewCoin(sdk.DefaultBondDenom, amount) sender := suite.chainA.SenderAccounts[0].SenderAccount receiver := suite.chainA.SenderAccounts[1].SenderAccount - forwardingPath := types.ForwardingInfo{ + forwardingPath := types.Forwarding{ Hops: []*types.Hop{ { PortId: path2.EndpointA.ChannelConfig.PortID, @@ -89,7 +88,7 @@ func (suite *KeeperTestSuite) TestEscrowsAreSetAfterForwarding() { coin := sdk.NewCoin(sdk.DefaultBondDenom, amount) sender := suite.chainA.SenderAccounts[0].SenderAccount receiver := suite.chainA.SenderAccounts[1].SenderAccount - forwardingPath := types.ForwardingInfo{ + forwardingPath := types.Forwarding{ Hops: []*types.Hop{ { PortId: path2.EndpointB.ChannelConfig.PortID, @@ -172,7 +171,7 @@ func (suite *KeeperTestSuite) TestHappyPathForwarding() { coin = sdk.NewCoin(sdk.DefaultBondDenom, amount) sender := suite.chainA.SenderAccounts[0].SenderAccount receiver := suite.chainA.SenderAccounts[1].SenderAccount - forwardingPath := types.ForwardingInfo{ + forwardingPath := types.Forwarding{ Hops: []*types.Hop{ { PortId: path2.EndpointB.ChannelConfig.PortID, @@ -280,7 +279,7 @@ func (suite *KeeperTestSuite) TestSimplifiedHappyPathForwarding() { coin := sdk.NewCoin(sdk.DefaultBondDenom, amount) sender := suite.chainA.SenderAccounts[0].SenderAccount receiver := suite.chainA.SenderAccounts[1].SenderAccount - forwardingPath := types.ForwardingInfo{ + forwardingPath := types.Forwarding{ Hops: []*types.Hop{ { PortId: path2.EndpointB.ChannelConfig.PortID, @@ -477,7 +476,7 @@ func (suite *KeeperTestSuite) TestAcknowledgementFailureScenario5Forwarding() { sender = suite.chainC.SenderAccounts[0].SenderAccount receiver = suite.chainA.SenderAccounts[0].SenderAccount // Receiver is the A chain account - forwardingPath := types.ForwardingInfo{ + forwardingPath := types.Forwarding{ Hops: []*types.Hop{ { PortId: path1.EndpointB.ChannelConfig.PortID, diff --git a/modules/apps/transfer/types/msgs.go b/modules/apps/transfer/types/msgs.go index 3c10f3b5779..4dbfc9b8136 100644 --- a/modules/apps/transfer/types/msgs.go +++ b/modules/apps/transfer/types/msgs.go @@ -4,7 +4,6 @@ import ( "strings" errorsmod "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" @@ -49,7 +48,7 @@ func NewMsgTransfer( tokens sdk.Coins, sender, receiver string, timeoutHeight clienttypes.Height, timeoutTimestamp uint64, memo string, - forwardingPath *ForwardingInfo, + forwardingPath *Forwarding, ) *MsgTransfer { return &MsgTransfer{ SourcePort: sourcePort, diff --git a/modules/apps/transfer/types/packet.go b/modules/apps/transfer/types/packet.go index fcdb431695e..5513d2d62db 100644 --- a/modules/apps/transfer/types/packet.go +++ b/modules/apps/transfer/types/packet.go @@ -103,7 +103,7 @@ func NewFungibleTokenPacketDataV2( tokens []Token, sender, receiver string, memo string, - forwardingPath *ForwardingInfo, + forwardingPath *Forwarding, ) FungibleTokenPacketDataV2 { return FungibleTokenPacketDataV2{ Tokens: tokens, diff --git a/modules/apps/transfer/types/packet.pb.go b/modules/apps/transfer/types/packet.pb.go index 1eae85e38e9..b5e4fffdaef 100644 --- a/modules/apps/transfer/types/packet.pb.go +++ b/modules/apps/transfer/types/packet.pb.go @@ -120,7 +120,7 @@ type FungibleTokenPacketDataV2 struct { // optional memo Memo string `protobuf:"bytes,4,opt,name=memo,proto3" json:"memo,omitempty"` // optional forwarding information - ForwardingPath *ForwardingInfo `protobuf:"bytes,5,opt,name=forwarding_path,json=forwardingPath,proto3" json:"forwarding_path,omitempty"` + ForwardingPath *Forwarding `protobuf:"bytes,5,opt,name=forwarding_path,json=forwardingPath,proto3" json:"forwarding_path,omitempty"` } func (m *FungibleTokenPacketDataV2) Reset() { *m = FungibleTokenPacketDataV2{} } @@ -184,7 +184,7 @@ func (m *FungibleTokenPacketDataV2) GetMemo() string { return "" } -func (m *FungibleTokenPacketDataV2) GetForwardingPath() *ForwardingInfo { +func (m *FungibleTokenPacketDataV2) GetForwardingPath() *Forwarding { if m != nil { return m.ForwardingPath } @@ -201,31 +201,31 @@ func init() { } var fileDescriptor_653ca2ce9a5ca313 = []byte{ - // 379 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0x41, 0xab, 0xd3, 0x40, - 0x14, 0x85, 0x33, 0xaf, 0x79, 0x45, 0xe7, 0x81, 0xc2, 0xf0, 0xd0, 0x58, 0x24, 0x3e, 0x9e, 0x9b, - 0x8a, 0x3a, 0x43, 0xe3, 0x42, 0xb7, 0x16, 0x29, 0xb8, 0xab, 0x45, 0x5d, 0xb8, 0x91, 0xc9, 0x64, - 0x9a, 0x0e, 0x6d, 0xe6, 0x86, 0x99, 0x49, 0xc4, 0x5f, 0xa1, 0x3f, 0xab,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0, 0x2a, 0x79, 0x4a, 0xbb, 0xde, 0x92, 0xfa, 0x82, 0x71, 0xb8, 0xfe, 0xfd, 0x24, 0x98, 0xed, - 0x17, 0x4f, 0x40, 0x2f, 0xce, 0x82, 0xf6, 0xce, 0x80, 0x86, 0x47, 0x50, 0xf2, 0x09, 0xdf, 0x9f, - 0x83, 0xf9, 0xc6, 0x4d, 0xa6, 0x74, 0xfe, 0xb5, 0xe4, 0x6e, 0xe1, 0xff, 0xe3, 0x2a, 0x79, 0xd1, - 0xc5, 0x34, 0xa2, 0x93, 0xc3, 0xd2, 0x7b, 0x3d, 0x87, 0xd9, 0xbd, 0x63, 0xc9, 0x94, 0xbb, 0xc5, - 0xf8, 0xc3, 0x7a, 0x1b, 0xa3, 0xcd, 0x36, 0x46, 0x7f, 0xb6, 0x31, 0xfa, 0xb9, 0x8b, 0x83, 0xcd, - 0x2e, 0x0e, 0x7e, 0xed, 0xe2, 0xe0, 0xcb, 0xeb, 0x5c, 0xb9, 0x45, 0x95, 0x52, 0x01, 0x05, 0x13, - 0x60, 0x0b, 0xb0, 0x4c, 0xa5, 0xe2, 0x65, 0x0e, 0xac, 0x7e, 0xc3, 0x0a, 0xc8, 0xaa, 0x95, 0xb4, - 0xcd, 0xe1, 0x4f, 0x0e, 0xee, 0xbe, 0x97, 0xd2, 0xa6, 0x7d, 0x7f, 0xeb, 0x57, 0xff, 0x02, 0x00, - 0x00, 0xff, 0xff, 0x9a, 0x79, 0x3e, 0x9a, 0xa3, 0x02, 0x00, 0x00, + // 372 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0x41, 0x0f, 0xd2, 0x30, + 0x1c, 0xc5, 0x57, 0x18, 0x44, 0x4b, 0xa2, 0x49, 0x43, 0x74, 0x12, 0x33, 0x09, 0x5e, 0x66, 0x8c, + 0x6d, 0x98, 0x07, 0xbd, 0x4a, 0x0c, 0x67, 0x20,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0xc0, 0x67, 0x77, + 0x88, 0x3e, 0xc7, 0xe8, 0x03, 0xec, 0xbb, 0x17, 0x30, 0x01, 0x18, 0x77, 0xa3, 0x41, 0xfc, 0x12, + 0xb7, 0xbd, 0x25, 0x76, 0x05, 0x33, 0x7f, 0xff, 0xfb, 0x85, 0xb7, 0x3a, 0x2f, 0xde, 0x80, 0x76, + 0xee, 0x82, 0x76, 0xef, 0x80, 0xfa, 0x57, 0x50, 0xb4, 0x84, 0x8f, 0xd7, 0x4a, 0x7f, 0xa3, 0x3a, + 0x15, 0x32, 0xfb, 0x5a, 0x50, 0xbb, 0x71, 0xff, 0x31, 0x88, 0xa3, 0x36, 0xa6, 0x29, 0x9e, 0x5f, + 0x96, 0x56, 0x8f, 0xae, 0x05, 0x0b, 0x6a, 0x37, 0xb3, 0xe5, 0xfe, 0x18, 0x82, 0xc3, 0x31, 0x04, + 0x7f, 0x8e, 0x21, 0xf8, 0x79, 0x0a, 0xbd, 0xc3, 0x29, 0xf4, 0x7e, 0x9d, 0x42, 0xef, 0xcb, 0xbb, + 0x4c, 0xd8, 0x4d, 0x99, 0x60, 0xa6, 0x72, 0xc2, 0x94, 0xc9, 0x95, 0x21, 0x22, 0x61, 0x6f, 0x32, + 0x45, 0xaa, 0xf7, 0x24, 0x57, 0x69, 0xb9, 0xe3, 0xa6, 0x3e, 0xfa, 0xcd, 0xb1, 0xed, 0xf7, 0x82, + 0x9b, 0xa4, 0xef, 0xee, 0xfc, 0xf6, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc0, 0x6b, 0xf8, 0x91, + 0x9f, 0x02, 0x00, 0x00, } func (m *FungibleTokenPacketData) Marshal() (dAtA []byte, err error) { @@ -832,7 +832,7 @@ func (m *FungibleTokenPacketDataV2) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.ForwardingPath == nil { - m.ForwardingPath = &ForwardingInfo{} + m.ForwardingPath = &Forwarding{} } if err := m.ForwardingPath.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err diff --git a/modules/apps/transfer/types/packet_test.go b/modules/apps/transfer/types/packet_test.go index 9997751b69e..7ba33b11a59 100644 --- a/modules/apps/transfer/types/packet_test.go +++ b/modules/apps/transfer/types/packet_test.go @@ -233,7 +233,7 @@ func TestFungibleTokenPacketDataV2ValidateBasic(t *testing.T) { sender, receiver, "", - &types.ForwardingInfo{ + &types.Forwarding{ Hops: []*types.Hop{ { PortId: "transfer", @@ -399,7 +399,7 @@ func TestFungibleTokenPacketDataV2ValidateBasic(t *testing.T) { sender, receiver, "memo", - &types.ForwardingInfo{ + &types.Forwarding{ Hops: []*types.Hop{ { PortId: "transfer", diff --git a/modules/apps/transfer/types/transfer.pb.go b/modules/apps/transfer/types/transfer.pb.go index 75ee2e183d4..bfd375b7683 100644 --- a/modules/apps/transfer/types/transfer.pb.go +++ b/modules/apps/transfer/types/transfer.pb.go @@ -82,26 +82,26 @@ func (m *Params) GetReceiveEnabled() bool { return false } -// ForwardingInfo defines a list of port ID, channel ID pairs determining the path +// Forwarding defines a list of hops determining the path // through which a packet must be forwarded, and the memo string to be used in the // final destination of the tokens. -type ForwardingInfo struct { +type Forwarding struct { Hops []*Hop `protobuf:"bytes,1,rep,name=hops,proto3" json:"hops,omitempty"` Memo string `protobuf:"bytes,2,opt,name=memo,proto3" json:"memo,omitempty"` } -func (m *ForwardingInfo) Reset() { *m = ForwardingInfo{} } -func (m *ForwardingInfo) String() string { return proto.CompactTextString(m) } -func (*ForwardingInfo) ProtoMessage() {} -func (*ForwardingInfo) Descriptor() ([]byte, []int) { +func (m *Forwarding) Reset() { *m = Forwarding{} } +func (m *Forwarding) String() string { return proto.CompactTextString(m) } +func (*Forwarding) ProtoMessage() {} +func (*Forwarding) Descriptor() ([]byte, []int) { return fileDescriptor_5041673e96e97901, []int{1} } -func (m *ForwardingInfo) XXX_Unmarshal(b []byte) error { +func (m *Forwarding) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *ForwardingInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *Forwarding) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_ForwardingInfo.Marshal(b, m, deterministic) + return xxx_messageInfo_Forwarding.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -111,26 +111,26 @@ func (m *ForwardingInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro return b[:n], nil } } -func (m *ForwardingInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_ForwardingInfo.Merge(m, src) +func (m *Forwarding) XXX_Merge(src proto.Message) { + xxx_messageInfo_Forwarding.Merge(m, src) } -func (m *ForwardingInfo) XXX_Size() int { +func (m *Forwarding) XXX_Size() int { return m.Size() } -func (m *ForwardingInfo) XXX_DiscardUnknown() { - xxx_messageInfo_ForwardingInfo.DiscardUnknown(m) +func (m *Forwarding) XXX_DiscardUnknown() { + xxx_messageInfo_Forwarding.DiscardUnknown(m) } -var xxx_messageInfo_ForwardingInfo proto.InternalMessageInfo +var xxx_messageInfo_Forwarding proto.InternalMessageInfo -func (m *ForwardingInfo) GetHops() []*Hop { +func (m *Forwarding) GetHops() []*Hop { if m != nil { return m.Hops } return nil } -func (m *ForwardingInfo) GetMemo() string { +func (m *Forwarding) GetMemo() string { if m != nil { return m.Memo } @@ -193,7 +193,7 @@ func (m *Hop) GetChannelId() string { func init() { proto.RegisterType((*Params)(nil), "ibc.applications.transfer.v1.Params") - proto.RegisterType((*ForwardingInfo)(nil), "ibc.applications.transfer.v1.ForwardingInfo") + proto.RegisterType((*Forwarding)(nil), "ibc.applications.transfer.v1.Forwarding") proto.RegisterType((*Hop)(nil), "ibc.applications.transfer.v1.Hop") } @@ -202,27 +202,27 @@ func init() { } var fileDescriptor_5041673e96e97901 = []byte{ - // 308 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c,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1, 0xfc, 0xa6, 0x95, 0x96, 0x79, 0x70, 0x87, 0xea, 0x63, 0xb0, 0xf8, 0x18, 0xfd, 0xb7, - 0xe0, 0xc2, 0x54, 0x6d, 0xab, 0xb6, 0xd2, 0x66, 0x71, 0x9c, 0x08, 0x7c, 0x8a, 0x10, 0x5f, 0x50, - 0x63, 0x64, 0x56, 0xdc, 0x6d, 0x5f, 0xb6, 0x76, 0x64, 0x22, 0xee, 0x9f, 0xbf, 0xd6, 0x71, 0xb4, - 0x5a, 0xc7, 0xd1, 0xcf, 0x3a, 0x8e, 0x3e, 0x37, 0x71, 0x6d, 0xb5, 0x89, 0x6b, 0xdf, 0x9b, 0xb8, - 0xf6, 0x7a, 0x33, 0x57, 0x61, 0xb1, 0x64, 0x09, 0x07, 0x4d, 0x38, 0x78, 0x0d, 0x9e, 0x28, 0xc6, - 0x2f, 0xe6, 0x40, 0xf2, 0x5b, 0xa2, 0x41, 0x2c, 0x33, 0xe9, 0x8b, 0xd9, 0xf7, 0xe6, 0x0e, 0x1f, - 0x56, 0x7a, 0xd6, 0x2c, 0x97, 0xbe, 0xfa, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x05, 0xad, 0xe6, 0x9f, - 0x98, 0x01, 0x00, 0x00, + // 306 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x90, 0x31, 0x4b, 0x33, 0x31, + 0x1c, 0xc6, 0x7b, 0x6f, 0x4b, 0x5f, 0xfb, 0xaf, 0x28, 0x64, 0xb1, 0x83, 0x1e, 0x6d, 0x17, 0x0b, + 0xe2, 0x85, 0x2a, 0xa2, 0x8b, 0x8b, 0xa0, 0xb4, 0x9b, 0x1e, 0x82, 0xe0, 0x52, 0x72, 0x49, 0x6c, + 0x03, 0x97, 0xfc, 0x43, 0x92, 0x9e, 0xf8, 0x2d, 0xfc, 0x58, 0x8e, 0x1d, 0x1d, 0xa5, 0xfd, 0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x71, 0x6d, 0xb1, 0x8a, 0x6b, 0xdf, 0xab, 0xb8, 0xf6, 0x7a, 0x3d, + 0x55, 0x61, 0x36, 0xcf, 0x12, 0x8e, 0x9a, 0x72, 0xf4, 0x1a, 0x3d, 0x55, 0x19, 0x3f, 0x9f, 0x22, + 0x2d, 0x6e, 0xa8, 0x46, 0x31, 0xcf, 0xa5, 0x2f, 0x27, 0xdf, 0x99, 0x3a, 0x7c, 0x58, 0xe9, 0xb3, + 0x66, 0xb5, 0xf2, 0xe5, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x73, 0x9a, 0x7d, 0x45, 0x94, 0x01, + 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -268,7 +268,7 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *ForwardingInfo) Marshal() (dAtA []byte, err error) { +func (m *Forwarding) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -278,12 +278,12 @@ func (m *ForwardingInfo) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ForwardingInfo) MarshalTo(dAtA []byte) (int, error) { +func (m *Forwarding) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ForwardingInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Forwarding) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -375,7 +375,7 @@ func (m *Params) Size() (n int) { return n } -func (m *ForwardingInfo) Size() (n int) { +func (m *Forwarding) Size() (n int) { if m == nil { return 0 } @@ -507,7 +507,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { } return nil } -func (m *ForwardingInfo) Unmarshal(dAtA []byte) error { +func (m *Forwarding) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -530,10 +530,10 @@ func (m *ForwardingInfo) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ForwardingInfo: wiretype end group for non-group") + return fmt.Errorf("proto: Forwarding: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ForwardingInfo: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Forwarding: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: diff --git a/modules/apps/transfer/types/tx.pb.go b/modules/apps/transfer/types/tx.pb.go index 7550a142816..79c8d64f1ad 100644 --- a/modules/apps/transfer/types/tx.pb.go +++ b/modules/apps/transfer/types/tx.pb.go @@ -57,7 +57,7 @@ type MsgTransfer struct { // tokens to be transferred Tokens []types.Coin `protobuf:"bytes,9,rep,name=tokens,proto3" json:"tokens"` // optional forwarding information - ForwardingPath *ForwardingInfo `protobuf:"bytes,10,opt,name=forwarding_path,json=forwardingPath,proto3" json:"forwarding_path,omitempty"` + ForwardingPath *Forwarding `protobuf:"bytes,10,opt,name=forwarding_path,json=forwardingPath,proto3" json:"forwarding_path,omitempty"` } func (m *MsgTransfer) Reset() { *m = MsgTransfer{} } @@ -225,50 +225,49 @@ func init() { } var fileDescriptor_7401ed9bed2f8e09 = []byte{ - // 673 bytes of a gzipped FileDescriptorProto + // 669 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xcf, 0x4f, 0x13, 0x4f, - 0x14, 0xef, 0x7e, 0x29, 0xfd, 0xc2, 0x54, 0x40, 0x46, 0x03, 0xcb, 0xc6, 0x6c, 0x9b, 0x46, 0x12, - 0x2c, 0x32, 0x93, 0x62, 0x0c, 0x86, 0x78, 0x2a, 0x89, 0xd1, 0x44, 0x12, 0xdc, 0xc0, 0xc5, 0x0b, - 0x99, 0xdd, 0x0e, 0xbb, 0x13, 0xba, 0x33, 0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, 0xc4, 0x05, 0x86, 0xc8, 0x5d, 0x34, 0x69, 0xf3, 0xd0, 0xa3, 0x51, 0xd2, - 0x13, 0x7e, 0x24, 0x82, 0xf9, 0xab, 0x22, 0x7b, 0x44, 0x27, 0xdb, 0xed, 0xf7, 0x9f, 0x1b, 0x95, - 0x77, 0x97, 0x27, 0x6d, 0xab, 0xe5, 0x87, 0xcb, 0x93, 0xf6, 0x52, 0x31, 0xd2, 0x86, 0xea, 0x1d, - 0xe3, 0xb1, 0x25, 0x68, 0x6d, 0x81, 0x1b, 0x63, 0x66, 0x40, 0x55, 0x26, 0xb8, 0xa2, 0xb9, 0xfa, - 0x8a, 0xbe, 0x18, 0x50, 0x1e, 0x51, 0xb3, 0x18, 0xd5, 0x60, 0x64, 0x6f, 0x57, 0xf3, 0xf2, 0xad, - 0x37, 0x60, 0x61, 0x57, 0xc5, 0x07, 0x59, 0x8f, 0x68, 0xba, 0x47, 0x24, 0x49, 0x95, 0xf9, 0x94, - 0x2c, 0xe6, 0x54, 0xda, 0x5d, 0xb2, 0x16, 0xec, 0x82, 0x5a, 0x66, 0x10, 0x66, 0x7f, 0xea, 0x9b, - 0xb7, 0x27, 0xb3, 0x2b, 0xaa, 0x95, 0x52, 0x15, 0x99, 0xdb, 0x0b, 0x57, 0x9c, 0x4c, 0xd1, 0xd6, - 0x0a, 0x58, 0xfe, 0xad, 0x7f, 0x39, 0xfc, 0xe6, 0x0f, 0x07, 0x4c, 0xed, 0xaa, 0x18, 0x26, 0x60, - 0x66, 0xb4, 0xec, 0x77, 0x26, 0xf7, 0x1c, 0xd3, 0xc0, 0xeb, 0xfc, 0x35, 0x74, 0x24, 0x97, 0x06, - 0xd7, 0x7e, 0x51, 0x62, 0xe3, 0x8f, 0x25, 0xc6, 0xe1, 0xde, 0xfd, 0x7f, 0x82, 0x97, 0x5d, 0xbd, - 0xe9, 0xb7, 0xf9, 0x3a, 0x77, 0x9f, 0x9d, 0x9e, 0xfb, 0xce, 0xd9, 0xb9, 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12, 0x86, 0x4a, 0x18, 0x1a, 0x75, 0xbd, 0x65, 0x92, 0x32, 0x2e, 0xb0, 0xf9, 0x2d, 0x12, + 0xbc, 0xdb, 0xb1, 0x88, 0x85, 0x79, 0xe2, 0xfc, 0x65, 0xbd, 0xab, 0x91, 0x50, 0xa9, 0x50, 0x38, + 0x55, 0x71, 0x5e, 0x3e, 0x55, 0xb1, 0x0d, 0xf8, 0x36, 0x10, 0x12, 0x45, 0xf1, 0xa8, 0x1b, 0x52, + 0x4d, 0xba, 0x38, 0x12, 0x8c, 0xdb, 0x78, 0x23, 0x1f, 0x33, 0x12, 0x92, 0xe2, 0x68, 0xc0, 0x28, + 0xd7, 0x79, 0x76, 0xf1, 0xb2, 0x80, 0x8d, 0xe9, 0x3c, 0xca, 0x61, 0x0d, 0xb8, 0xf5, 0xb1, 0x0a, + 0xea, 0x7b, 0x2a, 0x3e, 0xb4, 0x5e, 0xd8, 0x00, 0x75, 0x25, 0x86, 0x32, 0xa2, 0x47, 0x99, 0x90, + 0xda, 0x75, 0x9a, 0x4e, 0x7b, 0x3e, 0x00, 0x85, 0x6b, 0x5f, 0x48, 0x0d, 0xd7, 0xc1, 0xa2, 0x05, + 0x44, 0x09, 0xe1, 0x9c, 0x0e, 0xdc, 0xff, 0x0c, 0x66, 0xa1, 0xf0, 0xee, 0x16, 0x4e, 0xf8, 0x08, + 0xcc, 0x6a, 0x71, 0x42, 0xb9, 0x3b, 0xd3, 0x74, 0xda, 0xf5, 0xad, 0x35, 0x54, 0xb0, 0x42, 0x39, + 0x2b, 0x64, 0x59, 0xa1, 0x5d, 0xc1, 0x78, 0xaf, 0x7e, 0xf6, 0xad, 0x51, 0xf9, 0x72, 0x75, 0xda, + 0x71, 0x5c, 0x27, 0x28, 0x92, 0xe0, 0x0a, 0xa8, 0x29, 0xca, 0xfb, 0x54, 0xba, 0x55, 0x53, 0xdc, + 0x5a, 0xd0, 0x03, 0x73, 0x92, 0x46, 0x94, 0x8d, 0xa8, 0x74, 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8a, 0x9f, 0x65, 0x7d, 0xa2, 0xe9, 0x3e, 0x91, 0x24, 0x55, 0xe6, 0x33, 0xb2, 0x98, 0x53, 0x69, + 0xf7, 0xc8, 0x5a, 0xb0, 0x07, 0x6a, 0x99, 0x41, 0x98, 0xdd, 0xa9, 0x6f, 0xdd, 0x9d, 0xce, 0xac, + 0xa8, 0x56, 0xca, 0x54, 0x64, 0xee, 0x2c, 0x5d, 0x73, 0x32, 0x45, 0x5b, 0x6b, 0x60, 0xf5, 0xb7, + 0xfe, 0xe5, 0xf0, 0x5b, 0x3f, 0x1c, 0x30, 0xb3, 0xa7, 0x62, 0x98, 0x80, 0xb9, 0xf1, 0xa2, 0xdf, + 0x9b, 0xde, 0x73, 0x42, 0x03, 0xaf, 0xfb, 0xd7, 0xd0, 0xb1, 0x5c, 0x1a, 0xdc, 0xf8, 0x45, 0x89, + 0xcd, 0x3f, 0x96, 0x98, 0x84, 0x7b, 0x0f, 0xfe, 0x09, 0x5e, 0x76, 0xf5, 0x66, 0xdf, 0xe6, 0xab, + 0xdc, 0x3b, 0x38, 0xbb, 0xf0, 0x9d, 0xf3, 0x0b, 0xdf, 0xf9, 0x7e, 0xe1, 0x3b, 0x9f, 0x2e, 0xfd, + 0xca, 0xf9, 0xa5, 0x5f, 0xf9, 0x7a, 0xe9, 0x57, 0x9e, 0x6f, 0xc7, 0x4c, 0x27, 0xc3, 0x10, 0x45, + 0x22, 0xc5, 0xf6, 0xcc, 0xb0, 0x30, 0xda, 0x8c, 0x05, 0x1e, 0x3d, 0xc4, 0xa9, 0xe8, 0x0f, 0x07, + 0x54, 0xe5, 0xa7, 0x63, 0xe2, 0x64, 0xe8, 0xd7, 0x19, 0x55, 0x61, 0xcd, 0x5c, 0x8b, 0xfb, 0x3f, + 0x03, 0x00, 0x00, 0xff, 0xff, 0x07, 0xeb, 0x25, 0x21, 0x24, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1028,7 +1027,7 @@ func (m *MsgTransfer) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.ForwardingPath == nil { - m.ForwardingPath = &ForwardingInfo{} + m.ForwardingPath = &Forwarding{} } if err := m.ForwardingPath.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err diff --git a/proto/ibc/applications/transfer/v1/transfer.proto b/proto/ibc/applications/transfer/v1/transfer.proto index 45dc9c0d2b5..6f970848fc8 100644 --- a/proto/ibc/applications/transfer/v1/transfer.proto +++ b/proto/ibc/applications/transfer/v1/transfer.proto @@ -17,10 +17,10 @@ message Params { bool receive_enabled = 2; } -// ForwardingInfo defines a list of port ID, channel ID pairs determining the path +// Forwarding defines a list of hops determining the path // through which a packet must be forwarded, and the memo string to be used in the // final destination of the tokens. -message ForwardingInfo { +message Forwarding { repeated Hop hops = 1; string memo = 2; } diff --git a/proto/ibc/applications/transfer/v1/tx.proto b/proto/ibc/applications/transfer/v1/tx.proto index 4caf0273b2c..abe573916c9 100644 --- a/proto/ibc/applications/transfer/v1/tx.proto +++ b/proto/ibc/applications/transfer/v1/tx.proto @@ -52,7 +52,7 @@ message MsgTransfer { // tokens to be transferred repeated cosmos.base.v1beta1.Coin tokens = 9 [(gogoproto.nullable) = false]; // optional forwarding information - ForwardingInfo forwarding_path = 10; + Forwarding forwarding_path = 10; } // MsgTransferResponse defines the Msg/Transfer response type. diff --git a/proto/ibc/applications/transfer/v2/packet.proto b/proto/ibc/applications/transfer/v2/packet.proto index 702be8b2ffe..66fc7515448 100644 --- a/proto/ibc/applications/transfer/v2/packet.proto +++ b/proto/ibc/applications/transfer/v2/packet.proto @@ -37,5 +37,5 @@ message FungibleTokenPacketDataV2 { // optional memo string memo = 4; // optional forwarding information - ibc.applications.transfer.v1.ForwardingInfo forwarding_path = 5; + ibc.applications.transfer.v1.Forwarding forwarding_path = 5; } From 0c9f3684d7b194548db75956be23872d669fd09e Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Wed, 12 Jun 2024 12:33:13 +0200 Subject: [PATCH 2/5] Revert "chore: rename ForwardingInfo to Forwarding" This reverts commit e483b9a5fb6887c97c6f76257967b8b40bbf82cf. --- e2e/testsuite/testsuite.go | 20 ++-- modules/apps/transfer/keeper/export_test.go | 2 +- modules/apps/transfer/keeper/relay.go | 12 ++- .../transfer/keeper/relay_forwarding_test.go | 11 ++- modules/apps/transfer/types/msgs.go | 3 +- modules/apps/transfer/types/packet.go | 2 +- modules/apps/transfer/types/packet.pb.go | 56 +++++------ modules/apps/transfer/types/packet_test.go | 4 +- modules/apps/transfer/types/transfer.pb.go | 92 +++++++++---------- modules/apps/transfer/types/tx.pb.go | 89 +++++++++--------- .../applications/transfer/v1/transfer.proto | 4 +- proto/ibc/applications/transfer/v1/tx.proto | 2 +- .../ibc/applications/transfer/v2/packet.proto | 2 +- 13 files changed, 153 insertions(+), 146 deletions(-) diff --git a/e2e/testsuite/testsuite.go b/e2e/testsuite/testsuite.go index e9c1d7fc96d..9a113fbd7e9 100644 --- a/e2e/testsuite/testsuite.go +++ b/e2e/testsuite/testsuite.go @@ -8,14 +8,6 @@ import ( "path" "strings" - sdkmath "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - feetypes "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types" - transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" dockerclient "github.com/docker/docker/client" interchaintest "github.com/strangelove-ventures/interchaintest/v8" "github.com/strangelove-ventures/interchaintest/v8/chain/cosmos" @@ -25,11 +17,21 @@ import ( testifysuite "github.com/stretchr/testify/suite" "go.uber.org/zap" + sdkmath "cosmossdk.io/math" + + sdk "github.com/cosmos/cosmos-sdk/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/ibc-go/e2e/internal/directories" "github.com/cosmos/ibc-go/e2e/relayer" "github.com/cosmos/ibc-go/e2e/testsuite/diagnostics" "github.com/cosmos/ibc-go/e2e/testsuite/query" "github.com/cosmos/ibc-go/e2e/testvalues" + feetypes "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types" + transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" ) const ( @@ -561,7 +563,7 @@ func getValidatorsAndFullNodes(chainIdx int) (int, int) { } // GetMsgTransfer returns a MsgTransfer that is constructed based on the channel version -func GetMsgTransfer(portID, channelID, version string, tokens sdk.Coins, sender, receiver string, timeoutHeight clienttypes.Height, timeoutTimestamp uint64, memo string, forwardingPath *transfertypes.Forwarding) *transfertypes.MsgTransfer { +func GetMsgTransfer(portID, channelID, version string, tokens sdk.Coins, sender, receiver string, timeoutHeight clienttypes.Height, timeoutTimestamp uint64, memo string, forwardingPath *transfertypes.ForwardingInfo) *transfertypes.MsgTransfer { if len(tokens) == 0 { panic(errors.New("tokens cannot be empty")) } diff --git a/modules/apps/transfer/keeper/export_test.go b/modules/apps/transfer/keeper/export_test.go index 670f85b7ac3..760e04cc97f 100644 --- a/modules/apps/transfer/keeper/export_test.go +++ b/modules/apps/transfer/keeper/export_test.go @@ -34,6 +34,6 @@ func (k Keeper) TokenFromCoin(ctx sdk.Context, coin sdk.Coin) (types.Token, erro } // CreatePacketDataBytesFromVersion is a wrapper around createPacketDataBytesFromVersion for testing purposes -func CreatePacketDataBytesFromVersion(appVersion, sender, receiver, memo string, tokens types.Tokens, forwardingPath *types.Forwarding) []byte { +func CreatePacketDataBytesFromVersion(appVersion, sender, receiver, memo string, tokens types.Tokens, forwardingPath *types.ForwardingInfo) []byte { return createPacketDataBytesFromVersion(appVersion, sender, receiver, memo, tokens, forwardingPath) } diff --git a/modules/apps/transfer/keeper/relay.go b/modules/apps/transfer/keeper/relay.go index ccd320f5471..c4957aae5e3 100644 --- a/modules/apps/transfer/keeper/relay.go +++ b/modules/apps/transfer/keeper/relay.go @@ -5,11 +5,13 @@ import ( "fmt" "strings" + "github.com/hashicorp/go-metrics" + errorsmod "cosmossdk.io/errors" sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/hashicorp/go-metrics" "github.com/cosmos/ibc-go/v8/modules/apps/transfer/internal/events" internaltelemetry "github.com/cosmos/ibc-go/v8/modules/apps/transfer/internal/telemetry" @@ -63,7 +65,7 @@ func (k Keeper) sendTransfer( timeoutHeight clienttypes.Height, timeoutTimestamp uint64, memo string, - forwardingPath *types.Forwarding, + forwardingPath *types.ForwardingInfo, ) (uint64, error) { channel, found := k.channelKeeper.GetChannel(ctx, sourcePort, sourceChannel) if !found { @@ -275,12 +277,12 @@ func (k Keeper) OnRecvPacket(ctx sdk.Context, packet channeltypes.Packet, data t if data.ForwardingPath != nil && len(data.ForwardingPath.Hops) > 0 { memo := "" - var nextForwardingPath *types.Forwarding + var nextForwardingPath *types.ForwardingInfo if len(data.ForwardingPath.Hops) == 1 { memo = data.ForwardingPath.Memo nextForwardingPath = nil } else { - nextForwardingPath = &types.Forwarding{ + nextForwardingPath = &types.ForwardingInfo{ Hops: data.ForwardingPath.Hops[1:], Memo: data.ForwardingPath.Memo, } @@ -549,7 +551,7 @@ func (k Keeper) tokenFromCoin(ctx sdk.Context, coin sdk.Coin) (types.Token, erro } // createPacketDataBytesFromVersion creates the packet data bytes to be sent based on the application version. -func createPacketDataBytesFromVersion(appVersion, sender, receiver, memo string, tokens types.Tokens, forwardingPath *types.Forwarding) []byte { +func createPacketDataBytesFromVersion(appVersion, sender, receiver, memo string, tokens types.Tokens, forwardingPath *types.ForwardingInfo) []byte { var packetDataBytes []byte switch appVersion { case types.V1: diff --git a/modules/apps/transfer/keeper/relay_forwarding_test.go b/modules/apps/transfer/keeper/relay_forwarding_test.go index 341b1daad80..bdb1aa2b0ae 100644 --- a/modules/apps/transfer/keeper/relay_forwarding_test.go +++ b/modules/apps/transfer/keeper/relay_forwarding_test.go @@ -4,6 +4,7 @@ import ( "fmt" sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" @@ -26,7 +27,7 @@ func (suite *KeeperTestSuite) TestPathForwarding() { coin := sdk.NewCoin(sdk.DefaultBondDenom, amount) sender := suite.chainA.SenderAccounts[0].SenderAccount receiver := suite.chainA.SenderAccounts[1].SenderAccount - forwardingPath := types.Forwarding{ + forwardingPath := types.ForwardingInfo{ Hops: []*types.Hop{ { PortId: path2.EndpointA.ChannelConfig.PortID, @@ -88,7 +89,7 @@ func (suite *KeeperTestSuite) TestEscrowsAreSetAfterForwarding() { coin := sdk.NewCoin(sdk.DefaultBondDenom, amount) sender := suite.chainA.SenderAccounts[0].SenderAccount receiver := suite.chainA.SenderAccounts[1].SenderAccount - forwardingPath := types.Forwarding{ + forwardingPath := types.ForwardingInfo{ Hops: []*types.Hop{ { PortId: path2.EndpointB.ChannelConfig.PortID, @@ -171,7 +172,7 @@ func (suite *KeeperTestSuite) TestHappyPathForwarding() { coin = sdk.NewCoin(sdk.DefaultBondDenom, amount) sender := suite.chainA.SenderAccounts[0].SenderAccount receiver := suite.chainA.SenderAccounts[1].SenderAccount - forwardingPath := types.Forwarding{ + forwardingPath := types.ForwardingInfo{ Hops: []*types.Hop{ { PortId: path2.EndpointB.ChannelConfig.PortID, @@ -279,7 +280,7 @@ func (suite *KeeperTestSuite) TestSimplifiedHappyPathForwarding() { coin := sdk.NewCoin(sdk.DefaultBondDenom, amount) sender := suite.chainA.SenderAccounts[0].SenderAccount receiver := suite.chainA.SenderAccounts[1].SenderAccount - forwardingPath := types.Forwarding{ + forwardingPath := types.ForwardingInfo{ Hops: []*types.Hop{ { PortId: path2.EndpointB.ChannelConfig.PortID, @@ -476,7 +477,7 @@ func (suite *KeeperTestSuite) TestAcknowledgementFailureScenario5Forwarding() { sender = suite.chainC.SenderAccounts[0].SenderAccount receiver = suite.chainA.SenderAccounts[0].SenderAccount // Receiver is the A chain account - forwardingPath := types.Forwarding{ + forwardingPath := types.ForwardingInfo{ Hops: []*types.Hop{ { PortId: path1.EndpointB.ChannelConfig.PortID, diff --git a/modules/apps/transfer/types/msgs.go b/modules/apps/transfer/types/msgs.go index 4dbfc9b8136..3c10f3b5779 100644 --- a/modules/apps/transfer/types/msgs.go +++ b/modules/apps/transfer/types/msgs.go @@ -4,6 +4,7 @@ import ( "strings" errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" @@ -48,7 +49,7 @@ func NewMsgTransfer( tokens sdk.Coins, sender, receiver string, timeoutHeight clienttypes.Height, timeoutTimestamp uint64, memo string, - forwardingPath *Forwarding, + forwardingPath *ForwardingInfo, ) *MsgTransfer { return &MsgTransfer{ SourcePort: sourcePort, diff --git a/modules/apps/transfer/types/packet.go b/modules/apps/transfer/types/packet.go index 5513d2d62db..fcdb431695e 100644 --- a/modules/apps/transfer/types/packet.go +++ b/modules/apps/transfer/types/packet.go @@ -103,7 +103,7 @@ func NewFungibleTokenPacketDataV2( tokens []Token, sender, receiver string, memo string, - forwardingPath *Forwarding, + forwardingPath *ForwardingInfo, ) FungibleTokenPacketDataV2 { return FungibleTokenPacketDataV2{ Tokens: tokens, diff --git a/modules/apps/transfer/types/packet.pb.go b/modules/apps/transfer/types/packet.pb.go index b5e4fffdaef..1eae85e38e9 100644 --- a/modules/apps/transfer/types/packet.pb.go +++ b/modules/apps/transfer/types/packet.pb.go @@ -120,7 +120,7 @@ type FungibleTokenPacketDataV2 struct { // optional memo Memo string `protobuf:"bytes,4,opt,name=memo,proto3" json:"memo,omitempty"` // optional forwarding information - ForwardingPath *Forwarding `protobuf:"bytes,5,opt,name=forwarding_path,json=forwardingPath,proto3" json:"forwarding_path,omitempty"` + ForwardingPath *ForwardingInfo `protobuf:"bytes,5,opt,name=forwarding_path,json=forwardingPath,proto3" json:"forwarding_path,omitempty"` } func (m *FungibleTokenPacketDataV2) Reset() { *m = FungibleTokenPacketDataV2{} } @@ -184,7 +184,7 @@ func (m *FungibleTokenPacketDataV2) GetMemo() string { return "" } -func (m *FungibleTokenPacketDataV2) GetForwardingPath() *Forwarding { +func (m *FungibleTokenPacketDataV2) GetForwardingPath() *ForwardingInfo { if m != nil { return m.ForwardingPath } @@ -201,31 +201,31 @@ func init() { } var fileDescriptor_653ca2ce9a5ca313 = []byte{ - // 372 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0x41, 0x0f, 0xd2, 0x30, - 0x1c, 0xc5, 0x57, 0x18, 0x44, 0x4b, 0xa2, 0x49, 0x43, 0x74, 0x12, 0x33, 0x09, 0x5e, 0x66, 0x8c, - 0x6d, 0x98, 0x07, 0xbd, 0x4a, 0x0c, 0x67, 0x20, 0xc6, 0x83, 0x17, 0xd3, 0x75, 0x65, 0x34, 0xb0, - 0x76, 0x69, 0xbb, 0x19, 0x3f, 0x85, 0x7e, 0x2c, 0x8e, 0x1c, 0x3d, 0x19, 0x03, 0x9f, 0xc2, 0x9b, - 0x59, 0x87, 0xc0, 0x85, 0xdd, 0x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x3a, 0x2f, 0xde, 0x80, 0x76, - 0xee, 0x82, 0x76, 0xef, 0x80, 0xfa, 0x57, 0x50, 0xb4, 0x84, 0x8f, 0xd7, 0x4a, 0x7f, 0xa3, 0x3a, - 0x15, 0x32, 0xfb, 0x5a, 0x50, 0xbb, 0x71, 0xff, 0x31, 0x88, 0xa3, 0x36, 0xa6, 0x29, 0x9e, 0x5f, - 0x96, 0x56, 0x8f, 0xae, 0x05, 0x0b, 0x6a, 0x37, 0xb3, 0xe5, 0xfe, 0x18, 0x82, 0xc3, 0x31, 0x04, - 0x7f, 0x8e, 0x21, 0xf8, 0x79, 0x0a, 0xbd, 0xc3, 0x29, 0xf4, 0x7e, 0x9d, 0x42, 0xef, 0xcb, 0xbb, - 0x4c, 0xd8, 0x4d, 0x99, 0x60, 0xa6, 0x72, 0xc2, 0x94, 0xc9, 0x95, 0x21, 0x22, 0x61, 0x6f, 0x32, - 0x45, 0xaa, 0xf7, 0x24, 0x57, 0x69, 0xb9, 0xe3, 0xa6, 0x3e, 0xfa, 0xcd, 0xb1, 0xed, 0xf7, 0x82, - 0x9b, 0xa4, 0xef, 0xee, 0xfc, 0xf6, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc0, 0x6b, 0xf8, 0x91, - 0x9f, 0x02, 0x00, 0x00, + // 379 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0x41, 0xab, 0xd3, 0x40, + 0x14, 0x85, 0x33, 0xaf, 0x79, 0x45, 0xe7, 0x81, 0xc2, 0xf0, 0xd0, 0x58, 0x24, 0x3e, 0x9e, 0x9b, + 0x8a, 0x3a, 0x43, 0xe3, 0x42, 0xb7, 0x16, 0x29, 0xb8, 0xab, 0x45, 0x5d, 0xb8, 0x91, 0xc9, 0x64, + 0x9a, 0x0e, 0x6d, 0xe6, 0x86, 0x99, 0x49, 0xc4, 0x5f, 0xa1, 0x3f, 0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0xf0, 0x2a, 0x79, 0x4a, 0xbb, 0xde, 0x92, 0xfa, 0x82, 0x71, 0xb8, 0xfe, 0xfd, 0x24, 0x98, 0xed, + 0x17, 0x4f, 0x40, 0x2f, 0xce, 0x82, 0xf6, 0xce, 0x80, 0x86, 0x47, 0x50, 0xf2, 0x09, 0xdf, 0x9f, + 0x83, 0xf9, 0xc6, 0x4d, 0xa6, 0x74, 0xfe, 0xb5, 0xe4, 0x6e, 0xe1, 0xff, 0xe3, 0x2a, 0x79, 0xd1, + 0xc5, 0x34, 0xa2, 0x93, 0xc3, 0xd2, 0x7b, 0x3d, 0x87, 0xd9, 0xbd, 0x63, 0xc9, 0x94, 0xbb, 0xc5, + 0xf8, 0xc3, 0x7a, 0x1b, 0xa3, 0xcd, 0x36, 0x46, 0x7f, 0xb6, 0x31, 0xfa, 0xb9, 0x8b, 0x83, 0xcd, + 0x2e, 0x0e, 0x7e, 0xed, 0xe2, 0xe0, 0xcb, 0xeb, 0x5c, 0xb9, 0x45, 0x95, 0x52, 0x01, 0x05, 0x13, + 0x60, 0x0b, 0xb0, 0x4c, 0xa5, 0xe2, 0x65, 0x0e, 0xac, 0x7e, 0xc3, 0x0a, 0xc8, 0xaa, 0x95, 0xb4, + 0xcd, 0xe1, 0x4f, 0x0e, 0xee, 0xbe, 0x97, 0xd2, 0xa6, 0x7d, 0x7f, 0xeb, 0x57, 0xff, 0x02, 0x00, + 0x00, 0xff, 0xff, 0x9a, 0x79, 0x3e, 0x9a, 0xa3, 0x02, 0x00, 0x00, } func (m *FungibleTokenPacketData) Marshal() (dAtA []byte, err error) { @@ -832,7 +832,7 @@ func (m *FungibleTokenPacketDataV2) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.ForwardingPath == nil { - m.ForwardingPath = &Forwarding{} + m.ForwardingPath = &ForwardingInfo{} } if err := m.ForwardingPath.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err diff --git a/modules/apps/transfer/types/packet_test.go b/modules/apps/transfer/types/packet_test.go index 7ba33b11a59..9997751b69e 100644 --- a/modules/apps/transfer/types/packet_test.go +++ b/modules/apps/transfer/types/packet_test.go @@ -233,7 +233,7 @@ func TestFungibleTokenPacketDataV2ValidateBasic(t *testing.T) { sender, receiver, "", - &types.Forwarding{ + &types.ForwardingInfo{ Hops: []*types.Hop{ { PortId: "transfer", @@ -399,7 +399,7 @@ func TestFungibleTokenPacketDataV2ValidateBasic(t *testing.T) { sender, receiver, "memo", - &types.Forwarding{ + &types.ForwardingInfo{ Hops: []*types.Hop{ { PortId: "transfer", diff --git a/modules/apps/transfer/types/transfer.pb.go b/modules/apps/transfer/types/transfer.pb.go index bfd375b7683..75ee2e183d4 100644 --- a/modules/apps/transfer/types/transfer.pb.go +++ b/modules/apps/transfer/types/transfer.pb.go @@ -82,26 +82,26 @@ func (m *Params) GetReceiveEnabled() bool { return false } -// Forwarding defines a list of hops determining the path +// ForwardingInfo defines a list of port ID, channel ID pairs determining the path // through which a packet must be forwarded, and the memo string to be used in the // final destination of the tokens. -type Forwarding struct { +type ForwardingInfo struct { Hops []*Hop `protobuf:"bytes,1,rep,name=hops,proto3" json:"hops,omitempty"` Memo string `protobuf:"bytes,2,opt,name=memo,proto3" json:"memo,omitempty"` } -func (m *Forwarding) Reset() { *m = Forwarding{} } -func (m *Forwarding) String() string { return proto.CompactTextString(m) } -func (*Forwarding) ProtoMessage() {} -func (*Forwarding) Descriptor() ([]byte, []int) { +func (m *ForwardingInfo) Reset() { *m = ForwardingInfo{} } +func (m *ForwardingInfo) String() string { return proto.CompactTextString(m) } +func (*ForwardingInfo) ProtoMessage() {} +func (*ForwardingInfo) Descriptor() ([]byte, []int) { return fileDescriptor_5041673e96e97901, []int{1} } -func (m *Forwarding) XXX_Unmarshal(b []byte) error { +func (m *ForwardingInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *Forwarding) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *ForwardingInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_Forwarding.Marshal(b, m, deterministic) + return xxx_messageInfo_ForwardingInfo.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -111,26 +111,26 @@ func (m *Forwarding) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *Forwarding) XXX_Merge(src proto.Message) { - xxx_messageInfo_Forwarding.Merge(m, src) +func (m *ForwardingInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_ForwardingInfo.Merge(m, src) } -func (m *Forwarding) XXX_Size() int { +func (m *ForwardingInfo) XXX_Size() int { return m.Size() } -func (m *Forwarding) XXX_DiscardUnknown() { - xxx_messageInfo_Forwarding.DiscardUnknown(m) +func (m *ForwardingInfo) XXX_DiscardUnknown() { + xxx_messageInfo_ForwardingInfo.DiscardUnknown(m) } -var xxx_messageInfo_Forwarding proto.InternalMessageInfo +var xxx_messageInfo_ForwardingInfo proto.InternalMessageInfo -func (m *Forwarding) GetHops() []*Hop { +func (m *ForwardingInfo) GetHops() []*Hop { if m != nil { return m.Hops } return nil } -func (m *Forwarding) GetMemo() string { +func (m *ForwardingInfo) GetMemo() string { if m != nil { return m.Memo } @@ -193,7 +193,7 @@ func (m *Hop) GetChannelId() string { func init() { proto.RegisterType((*Params)(nil), "ibc.applications.transfer.v1.Params") - proto.RegisterType((*Forwarding)(nil), "ibc.applications.transfer.v1.Forwarding") + proto.RegisterType((*ForwardingInfo)(nil), "ibc.applications.transfer.v1.ForwardingInfo") proto.RegisterType((*Hop)(nil), "ibc.applications.transfer.v1.Hop") } @@ -202,27 +202,27 @@ func init() { } var fileDescriptor_5041673e96e97901 = []byte{ - // 306 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x90, 0x31, 0x4b, 0x33, 0x31, - 0x1c, 0xc6, 0x7b, 0x6f, 0x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, 0x47, 0xf0, 0xdf, 0xa2, 0x0b, 0x13, - 0xb5, 0xae, 0xd9, 0x4a, 0x9b, 0xe5, 0x71, 0x2c, 0xc8, 0x09, 0x00, 0x9f, 0x31, 0x63, 0x64, 0x5e, - 0xde, 0xad, 0x5f, 0xb6, 0x36, 0x64, 0x2c, 0xee, 0x9e, 0xbe, 0x96, 0x71, 0xb4, 0x58, 0xc6, 0xd1, - 0xcf, 0x32, 0x8e, 0x3e, 0x57, 0x71, 0x6d, 0xb1, 0x8a, 0x6b, 0xdf, 0xab, 0xb8, 0xf6, 0x7a, 0x3d, - 0x55, 0x61, 0x36, 0xcf, 0x12, 0x8e, 0x9a, 0x72, 0xf4, 0x1a, 0x3d, 0x55, 0x19, 0x3f, 0x9f, 0x22, - 0x2d, 0x6e, 0xa8, 0x46, 0x31, 0xcf, 0xa5, 0x2f, 0x27, 0xdf, 0x99, 0x3a, 0x7c, 0x58, 0xe9, 0xb3, - 0x66, 0xb5, 0xf2, 0xe5, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x73, 0x9a, 0x7d, 0x45, 0x94, 0x01, - 0x00, 0x00, + // 308 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x90, 0x3f, 0x4f, 0x3a, 0x31, + 0x1c, 0xc6, 0xb9, 0x1f, 0x84, 0x9f, 0x14, 0x83, 0x49, 0x17, 0x19, 0xf4, 0x02, 0x2c, 0x92, 0x18, + 0xaf, 0x41, 0x63, 0x74, 0x71, 0x31, 0xd1, 0xc0, 0xa6, 0x17, 0x27, 0x1d, 0x48, 0xff, 0x01, 0x4d, + 0xae, 0xfd, 0x36, 0x6d, 0x39, 0xe3, 0xbb, 0xf0, 0x65, 0x39, 0x32, 0x3a, 0x1a, 0x78, 0x23, 0xe6, + 0x0e, 0x72, 0x61, 0x72, 0x7b, 0xfa, 0xe9, 0xa7, 0xe9, 0x93, 0x07, 0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6, 0x7a, 0x33, 0x57, 0x61, 0xb1, 0x64, 0x09, 0x07, 0x4d, 0x38, 0x78, 0x0d, 0x9e, 0x28, 0xc6, + 0x2f, 0xe6, 0x40, 0xf2, 0x5b, 0xa2, 0x41, 0x2c, 0x33, 0xe9, 0x8b, 0xd9, 0xf7, 0xe6, 0x0e, 0x1f, + 0x56, 0x7a, 0xd6, 0x2c, 0x97, 0xbe, 0xfa, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x05, 0xad, 0xe6, 0x9f, + 0x98, 0x01, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -268,7 +268,7 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *Forwarding) Marshal() (dAtA []byte, err error) { +func (m *ForwardingInfo) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -278,12 +278,12 @@ func (m *Forwarding) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *Forwarding) MarshalTo(dAtA []byte) (int, error) { +func (m *ForwardingInfo) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Forwarding) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ForwardingInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -375,7 +375,7 @@ func (m *Params) Size() (n int) { return n } -func (m *Forwarding) Size() (n int) { +func (m *ForwardingInfo) Size() (n int) { if m == nil { return 0 } @@ -507,7 +507,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { } return nil } -func (m *Forwarding) Unmarshal(dAtA []byte) error { +func (m *ForwardingInfo) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -530,10 +530,10 @@ func (m *Forwarding) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Forwarding: wiretype end group for non-group") + return fmt.Errorf("proto: ForwardingInfo: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Forwarding: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ForwardingInfo: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: diff --git a/modules/apps/transfer/types/tx.pb.go b/modules/apps/transfer/types/tx.pb.go index 79c8d64f1ad..7550a142816 100644 --- a/modules/apps/transfer/types/tx.pb.go +++ b/modules/apps/transfer/types/tx.pb.go @@ -57,7 +57,7 @@ type MsgTransfer struct { // tokens to be transferred Tokens []types.Coin `protobuf:"bytes,9,rep,name=tokens,proto3" json:"tokens"` // optional forwarding information - ForwardingPath *Forwarding `protobuf:"bytes,10,opt,name=forwarding_path,json=forwardingPath,proto3" json:"forwarding_path,omitempty"` + ForwardingPath *ForwardingInfo `protobuf:"bytes,10,opt,name=forwarding_path,json=forwardingPath,proto3" json:"forwarding_path,omitempty"` } func (m *MsgTransfer) Reset() { *m = MsgTransfer{} } @@ -225,49 +225,50 @@ func init() { } var fileDescriptor_7401ed9bed2f8e09 = []byte{ - // 669 bytes of a gzipped FileDescriptorProto + // 673 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xcf, 0x4f, 0x13, 0x4f, - 0x14, 0xef, 0x7e, 0x29, 0xfd, 0xc2, 0x54, 0x40, 0x46, 0x03, 0xcb, 0xc6, 0x6c, 0x9b, 0x46, 0x92, - 0x5a, 0xc2, 0x4c, 0x8a, 0x31, 0x18, 0xe2, 0xa9, 0x24, 0xc6, 0x83, 0x24, 0xb0, 0xc1, 0x8b, 0x17, - 0x32, 0xbb, 0x1d, 0x76, 0x27, 0x74, 0x67, 0xd6, 0x99, 0x69, 0xd5, 0x8b, 0x31, 0x9e, 0x8c, 0x07, - 0xe3, 0x9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0xa1, 0xf0, 0xee, 0x16, 0x4e, 0xf8, 0x08, - 0xcc, 0x6a, 0x71, 0x42, 0xb9, 0x3b, 0xd3, 0x74, 0xda, 0xf5, 0xad, 0x35, 0x54, 0xb0, 0x42, 0x39, - 0x2b, 0x64, 0x59, 0xa1, 0x5d, 0xc1, 0x78, 0xaf, 0x7e, 0xf6, 0xad, 0x51, 0xf9, 0x72, 0x75, 0xda, - 0x71, 0x5c, 0x27, 0x28, 0x92, 0xe0, 0x0a, 0xa8, 0x29, 0xca, 0xfb, 0x54, 0xba, 0x55, 0x53, 0xdc, - 0x5a, 0xd0, 0x03, 0x73, 0x92, 0x46, 0x94, 0x8d, 0xa8, 0x74, 0x67, 0x4d, 0x64, 0x6c, 0xc3, 0xa7, - 0x60, 0x51, 0xb3, 0x94, 0x8a, 0xa1, 0x3e, 0x4a, 0x28, 0x8b, 0x13, 0xed, 0xd6, 0x4c, 0x6b, 0x0f, - 0xe5, 0x1f, 0x2c, 0x17, 0x0c, 0x59, 0x99, 0x46, 0x5d, 0xf4, 0xc4, 0x20, 0x7a, 0xf3, 0xe3, 0xde, - 0xc1, 0x82, 0x4d, 0x2e, 0x22, 0x70, 0x03, 0x2c, 0x97, 0xd5, 0xf2, 0x7f, 0xa5, 0x49, 0x9a, 0xb9, - 0xff, 0x37, 0x9d, 0x76, 0x35, 0xb8, 0x69, 0x03, 0x87, 0xa5, 0x1f, 0x42, 0x50, 0x4d, 0x69, 0x2a, - 0xdc, 0x39, 0x33, 0x92, 0x79, 0xc3, 0x6d, 0x50, 0x33, 0x5c, 0x94, 0x3b, 0xdf, 0x9c, 0x99, 0xae, - 0x40, 0x35, 0x9f, 0x22, 0xb0, 0x70, 0x78, 0x00, 0x96, 0x8e, 0x85, 0x7c, 0x49, 0x64, 0x9f, 0xf1, - 0xf8, 0x28, 0x23, 0x3a, 0x71, 0x81, 0x21, 0xd2, 0x46, 0xd3, 0x36, 0x0f, 0x3d, 0x1e, 0x27, 0x05, - 0x8b, 0x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 0x03, 0x7d, 0x98, 0x50, 0x16, 0x27, 0xda, 0xad, 0x99, 0xd6, 0x1e, + 0xca, 0x3f, 0x58, 0x2e, 0x18, 0xb2, 0x32, 0x0d, 0x3b, 0xe8, 0xb1, 0x41, 0x74, 0x67, 0x47, 0xbd, + 0x83, 0x39, 0x9b, 0x5c, 0x44, 0xe0, 0x3a, 0x58, 0x2c, 0xab, 0xe5, 0xff, 0x4a, 0x93, 0x34, 0x73, + 0xff, 0x6f, 0x3a, 0x6b, 0xd5, 0xe0, 0xba, 0x0d, 0xec, 0x97, 0x7e, 0x08, 0x41, 0x35, 0xa5, 0xa9, + 0x70, 0x67, 0xcc, 0x48, 0xe6, 0x0d, 0xb7, 0x40, 0xcd, 0x70, 0x51, 0xee, 0x6c, 0x73, 0x6a, 0xb2, + 0x02, 0xd5, 0x7c, 0x8a, 0xc0, 0xc2, 0xe1, 0x01, 0x58, 0x38, 0x12, 0xf2, 0x25, 0x91, 0x3d, 0xc6, + 0xe3, 0xc3, 0x8c, 0xe8, 0xc4, 0x05, 0x86, 0xc8, 0x5d, 0x34, 0x69, 0xf3, 0xd0, 0xa3, 0x51, 0xd2, + 0x13, 0x7e, 0x24, 0x82, 0xf9, 0xab, 0x22, 0x7b, 0x44, 0x27, 0xdb, 0xed, 0xf7, 0x9f, 0x1b, 0x95, + 0x77, 0x97, 0x27, 0x6d, 0xab, 0xe5, 0x87, 0xcb, 0x93, 0xf6, 0x52, 0x31, 0xd2, 0x86, 0xea, 0x1d, + 0xe3, 0xb1, 0x25, 0x68, 0x6d, 0x81, 0x1b, 0x63, 0x66, 0x40, 0x55, 0x26, 0xb8, 0xa2, 0xb9, 0xfa, + 0x8a, 0xbe, 0x18, 0x50, 0x1e, 0x51, 0xb3, 0x18, 0xd5, 0x60, 0x64, 0x6f, 0x57, 0xf3, 0xf2, 0xad, + 0x37, 0x60, 0x61, 0x57, 0xc5, 0x07, 0x59, 0x8f, 0x68, 0xba, 0x47, 0x24, 0x49, 0x95, 0xf9, 0x94, + 0x2c, 0xe6, 0x54, 0xda, 0x5d, 0xb2, 0x16, 0xec, 0x82, 0x5a, 0x66, 0x10, 0x66, 0x7f, 0xea, 0x9b, + 0xb7, 0x27, 0xb3, 0x2b, 0xaa, 0x95, 0x52, 0x15, 0x99, 0xdb, 0x0b, 0x57, 0x9c, 0x4c, 0xd1, 0xd6, + 0x0a, 0x58, 0xfe, 0xad, 0x7f, 0x39, 0xfc, 0xe6, 0x0f, 0x07, 0x4c, 0xed, 0xaa, 0x18, 0x26, 0x60, + 0x66, 0xb4, 0xec, 0x77, 0x26, 0xf7, 0x1c, 0xd3, 0xc0, 0xeb, 0xfc, 0x35, 0x74, 0x24, 0x97, 0x06, + 0xd7, 0x7e, 0x51, 0x62, 0xe3, 0x8f, 0x25, 0xc6, 0xe1, 0xde, 0xfd, 0x7f, 0x82, 0x97, 0x5d, 0xbd, + 0xe9, 0xb7, 0xf9, 0x3a, 0x77, 0x9f, 0x9d, 0x9e, 0xfb, 0xce, 0xd9, 0xb9, 0xef, 0x7c, 0x3f, 0xf7, + 0x9d, 0x8f, 0x17, 0x7e, 0xe5, 0xec, 0xc2, 0xaf, 0x7c, 0xbd, 0xf0, 0x2b, 0xcf, 0xb7, 0x62, 0xa6, + 0x93, 0x41, 0x88, 0x22, 0x91, 0x62, 0x7b, 0x6a, 0x58, 0x18, 0x6d, 0xc4, 0x02, 0x0f, 0x1f, 0xe0, + 0x54, 0xf4, 0x06, 0x7d, 0xaa, 0xf2, 0xf3, 0x31, 0x76, 0x36, 0xf4, 0xeb, 0x8c, 0xaa, 0xb0, 0x66, + 0x2e, 0xc6, 0xbd, 0x9f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xec, 0xa3, 0x95, 0xc7, 0x28, 0x05, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1027,7 +1028,7 @@ func (m *MsgTransfer) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.ForwardingPath == nil { - m.ForwardingPath = &Forwarding{} + m.ForwardingPath = &ForwardingInfo{} } if err := m.ForwardingPath.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err diff --git a/proto/ibc/applications/transfer/v1/transfer.proto b/proto/ibc/applications/transfer/v1/transfer.proto index 6f970848fc8..45dc9c0d2b5 100644 --- a/proto/ibc/applications/transfer/v1/transfer.proto +++ b/proto/ibc/applications/transfer/v1/transfer.proto @@ -17,10 +17,10 @@ message Params { bool receive_enabled = 2; } -// Forwarding defines a list of hops determining the path +// ForwardingInfo defines a list of port ID, channel ID pairs determining the path // through which a packet must be forwarded, and the memo string to be used in the // final destination of the tokens. -message Forwarding { +message ForwardingInfo { repeated Hop hops = 1; string memo = 2; } diff --git a/proto/ibc/applications/transfer/v1/tx.proto b/proto/ibc/applications/transfer/v1/tx.proto index abe573916c9..4caf0273b2c 100644 --- a/proto/ibc/applications/transfer/v1/tx.proto +++ b/proto/ibc/applications/transfer/v1/tx.proto @@ -52,7 +52,7 @@ message MsgTransfer { // tokens to be transferred repeated cosmos.base.v1beta1.Coin tokens = 9 [(gogoproto.nullable) = false]; // optional forwarding information - Forwarding forwarding_path = 10; + ForwardingInfo forwarding_path = 10; } // MsgTransferResponse defines the Msg/Transfer response type. diff --git a/proto/ibc/applications/transfer/v2/packet.proto b/proto/ibc/applications/transfer/v2/packet.proto index 66fc7515448..702be8b2ffe 100644 --- a/proto/ibc/applications/transfer/v2/packet.proto +++ b/proto/ibc/applications/transfer/v2/packet.proto @@ -37,5 +37,5 @@ message FungibleTokenPacketDataV2 { // optional memo string memo = 4; // optional forwarding information - ibc.applications.transfer.v1.Forwarding forwarding_path = 5; + ibc.applications.transfer.v1.ForwardingInfo forwarding_path = 5; } From 413b7c16046104eeb75915596a3e125761c2ba87 Mon Sep 17 00:00:00 2001 From: DimitrisJim Date: Wed, 12 Jun 2024 18:48:27 +0300 Subject: [PATCH 3/5] nit(transfer): Mark hops as non nullable. (#6566) * nit(transfer): Mark hops as non nullable. * lint: fix additional linting issues --- .../transfer/keeper/relay_forwarding_test.go | 10 ++-- modules/apps/transfer/types/packet_test.go | 4 +- modules/apps/transfer/types/transfer.pb.go | 50 ++++++++++--------- .../applications/transfer/v1/transfer.proto | 6 ++- 4 files changed, 37 insertions(+), 33 deletions(-) diff --git a/modules/apps/transfer/keeper/relay_forwarding_test.go b/modules/apps/transfer/keeper/relay_forwarding_test.go index bdb1aa2b0ae..880e9dbcf89 100644 --- a/modules/apps/transfer/keeper/relay_forwarding_test.go +++ b/modules/apps/transfer/keeper/relay_forwarding_test.go @@ -28,7 +28,7 @@ func (suite *KeeperTestSuite) TestPathForwarding() { sender := suite.chainA.SenderAccounts[0].SenderAccount receiver := suite.chainA.SenderAccounts[1].SenderAccount forwardingPath := types.ForwardingInfo{ - Hops: []*types.Hop{ + Hops: []types.Hop{ { PortId: path2.EndpointA.ChannelConfig.PortID, ChannelId: path2.EndpointA.ChannelID, @@ -90,7 +90,7 @@ func (suite *KeeperTestSuite) TestEscrowsAreSetAfterForwarding() { sender := suite.chainA.SenderAccounts[0].SenderAccount receiver := suite.chainA.SenderAccounts[1].SenderAccount forwardingPath := types.ForwardingInfo{ - Hops: []*types.Hop{ + Hops: []types.Hop{ { PortId: path2.EndpointB.ChannelConfig.PortID, ChannelId: path2.EndpointB.ChannelID, @@ -173,7 +173,7 @@ func (suite *KeeperTestSuite) TestHappyPathForwarding() { sender := suite.chainA.SenderAccounts[0].SenderAccount receiver := suite.chainA.SenderAccounts[1].SenderAccount forwardingPath := types.ForwardingInfo{ - Hops: []*types.Hop{ + Hops: []types.Hop{ { PortId: path2.EndpointB.ChannelConfig.PortID, ChannelId: path2.EndpointB.ChannelID, @@ -281,7 +281,7 @@ func (suite *KeeperTestSuite) TestSimplifiedHappyPathForwarding() { sender := suite.chainA.SenderAccounts[0].SenderAccount receiver := suite.chainA.SenderAccounts[1].SenderAccount forwardingPath := types.ForwardingInfo{ - Hops: []*types.Hop{ + Hops: []types.Hop{ { PortId: path2.EndpointB.ChannelConfig.PortID, ChannelId: path2.EndpointB.ChannelID, @@ -478,7 +478,7 @@ func (suite *KeeperTestSuite) TestAcknowledgementFailureScenario5Forwarding() { receiver = suite.chainA.SenderAccounts[0].SenderAccount // Receiver is the A chain account forwardingPath := types.ForwardingInfo{ - Hops: []*types.Hop{ + Hops: []types.Hop{ { PortId: path1.EndpointB.ChannelConfig.PortID, ChannelId: path1.EndpointB.ChannelID, diff --git a/modules/apps/transfer/types/packet_test.go b/modules/apps/transfer/types/packet_test.go index 9997751b69e..19c1d12e81d 100644 --- a/modules/apps/transfer/types/packet_test.go +++ b/modules/apps/transfer/types/packet_test.go @@ -234,7 +234,7 @@ func TestFungibleTokenPacketDataV2ValidateBasic(t *testing.T) { receiver, "", &types.ForwardingInfo{ - Hops: []*types.Hop{ + Hops: []types.Hop{ { PortId: "transfer", ChannelId: "channel-1", @@ -400,7 +400,7 @@ func TestFungibleTokenPacketDataV2ValidateBasic(t *testing.T) { receiver, "memo", &types.ForwardingInfo{ - Hops: []*types.Hop{ + Hops: []types.Hop{ { PortId: "transfer", ChannelId: "channel-1", diff --git a/modules/apps/transfer/types/transfer.pb.go b/modules/apps/transfer/types/transfer.pb.go index 75ee2e183d4..70af1be23e4 100644 --- a/modules/apps/transfer/types/transfer.pb.go +++ b/modules/apps/transfer/types/transfer.pb.go @@ -5,6 +5,7 @@ package types import ( fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" io "io" math "math" @@ -86,7 +87,7 @@ func (m *Params) GetReceiveEnabled() bool { // through which a packet must be forwarded, and the memo string to be used in the // final destination of the tokens. type ForwardingInfo struct { - Hops []*Hop `protobuf:"bytes,1,rep,name=hops,proto3" json:"hops,omitempty"` + Hops []Hop `protobuf:"bytes,1,rep,name=hops,proto3" json:"hops"` Memo string `protobuf:"bytes,2,opt,name=memo,proto3" json:"memo,omitempty"` } @@ -123,7 +124,7 @@ func (m *ForwardingInfo) XXX_DiscardUnknown() { var xxx_messageInfo_ForwardingInfo proto.InternalMessageInfo -func (m *ForwardingInfo) GetHops() []*Hop { +func (m *ForwardingInfo) GetHops() []Hop { if m != nil { return m.Hops } @@ -202,27 +203,28 @@ func init() { } var fileDescriptor_5041673e96e97901 = []byte{ - // 308 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x90, 0x3f, 0x4f, 0x3a, 0x31, - 0x1c, 0xc6, 0xb9, 0x1f, 0x84, 0x9f, 0x14, 0x83, 0x49, 0x17, 0x19, 0xf4, 0x02, 0x2c, 0x92, 0x18, - 0xaf, 0x41, 0x63, 0x74, 0x71, 0x31, 0xd1, 0xc0, 0xa6, 0x17, 0x27, 0x1d, 0x48, 0xff, 0x01, 0x4d, - 0xae, 0xfd, 0x36, 0x6d, 0x39, 0xe3, 0xbb, 0xf0, 0x65, 0x39, 0x32, 0x3a, 0x1a, 0x78, 0x23, 0xe6, - 0x0e, 0x72, 0x61, 0x72, 0x7b, 0xfa, 0xe9, 0xa7, 0xe9, 0x93, 0x07, 0x9d, 0x2b, 0xc6, 0x09, 0xb5, - 0x36, 0x53, 0x9c, 0x06, 0x05, 0xc6, 0x93, 0xe0, 0xa8, 0xf1, 0x33, 0xe9, 0x48, 0x3e, 0xaa, 0x72, - 0x62, 0x1d, 0x04, 0xc0, 0x27, 0x8a, 0xf1, 0x64, 0x5f, 0x4e, 0x2a, 0x21, 0x1f, 0x0d, 0x5e, 0x50, - 0xf3, 0x89, 0x3a, 0xaa, 0x3d, 0xee, 0xa3, 0x43, 0x2f, 0x8d, 0x98, 0x4a, 0x43, 0x59, 0x26, 0x45, - 0x37, 0xea, 0x45, 0xc3, 0x83, 0xb4, 0x5d, 0xb0, 0x87, 0x2d, 0xc2, 0x67, 0xe8, 0xc8, 0x49, 0x2e, - 0x55, 0x2e, 0x2b, 0xeb, 0x5f, 0x69, 0x75, 0x76, 0x78, 0x27, 0x0e, 0xde, 0x50, 0xe7, 0x11, 0xdc, - 0x3b, 0x75, 0x42, 0x99, 0xf9, 0xc4, 0xcc, 0x00, 0x5f, 0xa3, 0xc6, 0x02, 0xac, 0xef, 0x46, 0xbd, - 0xfa, 0xb0, 0x7d, 0xd9, 0x4f, 0xfe, 0x2a, 0x95, 0x8c, 0xc1, 0xa6, 0xa5, 0x8e, 0x31, 0x6a, 0x68, - 0xa9, 0xa1, 0xfc, 0xa6, 0x95, 0x96, 0x79, 0x70, 0x87, 0xea, 0x63, 0xb0, 0xf8, 0x18, 0xfd, 0xb7, - 0xe0, 0xc2, 0x54, 0x6d, 0xab, 0xb6, 0xd2, 0x66, 0x71, 0x9c, 0x08, 0x7c, 0x8a, 0x10, 0x5f, 0x50, - 0x63, 0x64, 0x56, 0xdc, 0x6d, 0x5f, 0xb6, 0x76, 0x64, 0x22, 0xee, 0x9f, 0xbf, 0xd6, 0x71, 0xb4, - 0x5a, 0xc7, 0xd1, 0xcf, 0x3a, 0x8e, 0x3e, 0x37, 0x71, 0x6d, 0xb5, 0x89, 0x6b, 0xdf, 0x9b, 0xb8, - 0xf6, 0x7a, 0x33, 0x57, 0x61, 0xb1, 0x64, 0x09, 0x07, 0x4d, 0x38, 0x78, 0x0d, 0x9e, 0x28, 0xc6, - 0x2f, 0xe6, 0x40, 0xf2, 0x5b, 0xa2, 0x41, 0x2c, 0x33, 0xe9, 0x8b, 0xd9, 0xf7, 0xe6, 0x0e, 0x1f, - 0x56, 0x7a, 0xd6, 0x2c, 0x97, 0xbe, 0xfa, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x05, 0xad, 0xe6, 0x9f, - 0x98, 0x01, 0x00, 0x00, + // 325 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0x41, 0x4b, 0xc3, 0x30, + 0x18, 0x86, 0x5b, 0x37, 0xa6, 0xcb, 0x64, 0x42, 0x10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, + 0x79, 0x0a, 0xf6, 0xb1, 0x66, 0x60, 0x73, 0xff, 0x11, 0xd5, 0xc6, 0xa0, 0xf0, 0x09, 0xda, 0x57, + 0xa0, 0xb3, 0xa9, 0x28, 0x07, 0x6e, 0x06, 0x8d, 0xe2, 0x38, 0x89, 0xf0, 0x39, 0x42, 0x6c, 0x4e, + 0xa5, 0xe4, 0x49, 0x71, 0x57, 0x36, 0x9b, 0x5b, 0x32, 0x89, 0x46, 0xaf, 0xcb, 0xb5, 0xe7, 0xae, + 0xd6, 0x9e, 0xfb, 0xbb, 0xf6, 0xdc, 0xaf, 0x8d, 0xe7, 0xac, 0x36, 0x9e, 0xf3, 0xbd, 0xf1, 0x9c, + 0xf7, 0xbb, 0x58, 0x64, 0xf3, 0x45, 0xe8, 0x33, 0x48, 0x09, 0x03, 0x93, 0x82, 0x21, 0x22, 0x64, + 0xd7, 0x31, 0x90, 0xfc, 0x9e, 0xa4, 0x10, 0x2d, 0x12, 0x6e, 0x8a, 0x95, 0xec, 0xac, 0x22, 0xfb, + 0x54, 0xdc, 0x84, 0x0d, 0xfb, 0xa3, 0xb7, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x6b, 0x1c, 0xa2, + 0x4b, 0xb4, 0x01, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -565,7 +567,7 @@ func (m *ForwardingInfo) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Hops = append(m.Hops, &Hop{}) + m.Hops = append(m.Hops, Hop{}) if err := m.Hops[len(m.Hops)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } diff --git a/proto/ibc/applications/transfer/v1/transfer.proto b/proto/ibc/applications/transfer/v1/transfer.proto index 45dc9c0d2b5..2eac86c7f6c 100644 --- a/proto/ibc/applications/transfer/v1/transfer.proto +++ b/proto/ibc/applications/transfer/v1/transfer.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package ibc.applications.transfer.v1; +import "gogoproto/gogo.proto"; + option go_package = "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"; // Params defines the set of IBC transfer parameters. @@ -21,7 +23,7 @@ message Params { // through which a packet must be forwarded, and the memo string to be used in the // final destination of the tokens. message ForwardingInfo { - repeated Hop hops = 1; + repeated Hop hops = 1 [(gogoproto.nullable) = false]; string memo = 2; } @@ -30,4 +32,4 @@ message ForwardingInfo { message Hop { string port_id = 1; string channel_id = 2; -} \ No newline at end of file +} From ae2046a71ddaa853c77f9f0175cfbf8e8a89409f Mon Sep 17 00:00:00 2001 From: Gjermund Garaba Date: Wed, 12 Jun 2024 18:21:05 +0200 Subject: [PATCH 4/5] feat(transfer): add forwarding info validation to token packet (#6571) * feat(transfer): add forwarding info validation to token packet * Added NewForwardingInfo constructor * Removed redundant check * Clean up tests per cr comments * Back to Validate and use NewDenom --- modules/apps/transfer/types/errors.go | 1 + .../apps/transfer/types/forwarding_info.go | 39 +++++ .../transfer/types/forwarding_info_test.go | 151 ++++++++++++++++++ modules/apps/transfer/types/packet.go | 12 +- modules/apps/transfer/types/packet_test.go | 115 ++++++++++--- 5 files changed, 293 insertions(+), 25 deletions(-) create mode 100644 modules/apps/transfer/types/forwarding_info.go create mode 100644 modules/apps/transfer/types/forwarding_info_test.go diff --git a/modules/apps/transfer/types/errors.go b/modules/apps/transfer/types/errors.go index 2a7d90c0fbe..13f87f17a77 100644 --- a/modules/apps/transfer/types/errors.go +++ b/modules/apps/transfer/types/errors.go @@ -16,4 +16,5 @@ var ( ErrMaxTransferChannels = errorsmod.Register(ModuleName, 9, "max transfer channels") ErrInvalidAuthorization = errorsmod.Register(ModuleName, 10, "invalid transfer authorization") ErrInvalidMemo = errorsmod.Register(ModuleName, 11, "invalid memo") + ErrInvalidForwardingInfo = errorsmod.Register(ModuleName, 12, "invalid forwarding info") ) diff --git a/modules/apps/transfer/types/forwarding_info.go b/modules/apps/transfer/types/forwarding_info.go new file mode 100644 index 00000000000..167ca89bff0 --- /dev/null +++ b/modules/apps/transfer/types/forwarding_info.go @@ -0,0 +1,39 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" + + host "github.com/cosmos/ibc-go/v8/modules/core/24-host" +) + +const MaximumNumberOfForwardingHops = 64 + +// NewForwardingInfo creates a new ForwardingInfo instance given a memo and a variable number of hops. +func NewForwardingInfo(memo string, hops ...Hop) *ForwardingInfo { + return &ForwardingInfo{ + Memo: memo, + Hops: hops, + } +} + +// Validate performs a basic validation of the ForwardingInfo fields. +func (fi ForwardingInfo) Validate() error { + if len(fi.Hops) > MaximumNumberOfForwardingHops { + return errorsmod.Wrapf(ErrInvalidForwardingInfo, "number of hops in forwarding path cannot exceed %d", MaximumNumberOfForwardingHops) + } + + for _, hop := range fi.Hops { + if err := host.PortIdentifierValidator(hop.PortId); err != nil { + return errorsmod.Wrapf(err, "invalid source port ID %s", hop.PortId) + } + if err := host.ChannelIdentifierValidator(hop.ChannelId); err != nil { + return errorsmod.Wrapf(err, "invalid source channel ID %s", hop.ChannelId) + } + } + + if len(fi.Memo) > MaximumMemoLength { + return errorsmod.Wrapf(ErrInvalidMemo, "memo length cannot exceed %d", MaximumMemoLength) + } + + return nil +} diff --git a/modules/apps/transfer/types/forwarding_info_test.go b/modules/apps/transfer/types/forwarding_info_test.go new file mode 100644 index 00000000000..7be1fadeeaa --- /dev/null +++ b/modules/apps/transfer/types/forwarding_info_test.go @@ -0,0 +1,151 @@ +package types_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + host "github.com/cosmos/ibc-go/v8/modules/core/24-host" + ibctesting "github.com/cosmos/ibc-go/v8/testing" +) + +var validHop = types.Hop{ + PortId: types.PortID, + ChannelId: ibctesting.FirstChannelID, +} + +func TestForwardingInfo_Validate(t *testing.T) { + tests := []struct { + name string + forwardingInfo *types.ForwardingInfo + expError error + }{ + { + "valid forwarding info with no hops", + types.NewForwardingInfo(""), + nil, + }, + { + "valid forwarding info with hops", + types.NewForwardingInfo("", validHop), + nil, + }, + { + "valid forwarding info with memo", + types.NewForwardingInfo(testMemo1, validHop, validHop), + nil, + }, + { + "valid forwarding info with max hops", + types.NewForwardingInfo("", generateHops(types.MaximumNumberOfForwardingHops)...), + nil, + }, + { + "valid forwarding info with max memo length", + types.NewForwardingInfo(ibctesting.GenerateString(types.MaximumMemoLength), validHop), + nil, + }, + { + "invalid forwarding info with too many hops", + types.NewForwardingInfo("", generateHops(types.MaximumNumberOfForwardingHops+1)...), + types.ErrInvalidForwardingInfo, + }, + { + "invalid forwarding info with too long memo", + types.NewForwardingInfo(ibctesting.GenerateString(types.MaximumMemoLength+1), validHop), + types.ErrInvalidMemo, + }, + { + "invalid forwarding info with too short hop port ID", + types.NewForwardingInfo( + "", + types.Hop{ + PortId: invalidShortPort, + ChannelId: ibctesting.FirstChannelID, + }, + ), + host.ErrInvalidID, + }, + { + "invalid forwarding info with too long hop port ID", + types.NewForwardingInfo( + "", + types.Hop{ + PortId: invalidLongPort, + ChannelId: ibctesting.FirstChannelID, + }, + ), + host.ErrInvalidID, + }, + { + "invalid forwarding info with non-alpha hop port ID", + types.NewForwardingInfo( + "", + types.Hop{ + PortId: invalidPort, + ChannelId: ibctesting.FirstChannelID, + }, + ), + host.ErrInvalidID, + }, + { + "invalid forwarding info with too long hop channel ID", + types.NewForwardingInfo( + "", + types.Hop{ + PortId: types.PortID, + ChannelId: invalidLongChannel, + }, + ), + host.ErrInvalidID, + }, + { + "invalid forwarding info with too short hop channel ID", + types.NewForwardingInfo( + "", + types.Hop{ + PortId: types.PortID, + ChannelId: invalidShortChannel, + }, + ), + host.ErrInvalidID, + }, + { + "invalid forwarding info with non-alpha hop channel ID", + types.NewForwardingInfo( + "", + types.Hop{ + PortId: types.PortID, + ChannelId: invalidChannel, + }, + ), + host.ErrInvalidID, + }, + } + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + tc := tc + + err := tc.forwardingInfo.Validate() + + expPass := tc.expError == nil + if expPass { + require.NoError(t, err) + } else { + require.ErrorIs(t, err, tc.expError) + } + }) + } +} + +func generateHops(n int) []types.Hop { + hops := make([]types.Hop, n) + for i := 0; i < n; i++ { + hops[i] = types.Hop{ + PortId: types.PortID, + ChannelId: ibctesting.FirstChannelID, + } + } + return hops +} diff --git a/modules/apps/transfer/types/packet.go b/modules/apps/transfer/types/packet.go index fcdb431695e..e4f5179bd78 100644 --- a/modules/apps/transfer/types/packet.go +++ b/modules/apps/transfer/types/packet.go @@ -140,9 +140,15 @@ func (ftpd FungibleTokenPacketDataV2) ValidateBasic() error { return errorsmod.Wrapf(ErrInvalidMemo, "memo must not exceed %d bytes", MaximumMemoLength) } - // We cannot have non-empty memo and non-empty forwarding path hops at the same time. - if ftpd.ForwardingPath != nil && len(ftpd.ForwardingPath.Hops) > 0 && ftpd.Memo != "" { - return errorsmod.Wrapf(ErrInvalidMemo, "memo must be empty if forwarding path hops is not empty: %s, %s", ftpd.Memo, ftpd.ForwardingPath.Hops) + if ftpd.ForwardingPath != nil { + if err := ftpd.ForwardingPath.Validate(); err != nil { + return err + } + + // We cannot have non-empty memo and non-empty forwarding path hops at the same time. + if len(ftpd.ForwardingPath.Hops) > 0 && ftpd.Memo != "" { + return errorsmod.Wrapf(ErrInvalidMemo, "memo must be empty if forwarding path hops is not empty: %s, %s", ftpd.Memo, ftpd.ForwardingPath.Hops) + } } return nil diff --git a/modules/apps/transfer/types/packet_test.go b/modules/apps/transfer/types/packet_test.go index 19c1d12e81d..509435f5323 100644 --- a/modules/apps/transfer/types/packet_test.go +++ b/modules/apps/transfer/types/packet_test.go @@ -8,6 +8,7 @@ import ( "github.com/stretchr/testify/require" "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + host "github.com/cosmos/ibc-go/v8/modules/core/24-host" ibcerrors "github.com/cosmos/ibc-go/v8/modules/core/errors" ibctesting "github.com/cosmos/ibc-go/v8/testing" ) @@ -223,25 +224,30 @@ func TestFungibleTokenPacketDataV2ValidateBasic(t *testing.T) { types.NewFungibleTokenPacketDataV2( []types.Token{ { - Denom: types.Denom{ - Base: denom, - Trace: []types.Trace{types.NewTrace("transfer", "channel-0"), types.NewTrace("transfer", "channel-1")}, - }, + Denom: types.NewDenom(denom, types.NewTrace("transfer", "channel-0"), types.NewTrace("transfer", "channel-1")), Amount: amount, }, }, sender, receiver, "", - &types.ForwardingInfo{ - Hops: []types.Hop{ - { - PortId: "transfer", - ChannelId: "channel-1", - }, + types.NewForwardingInfo("", validHop, validHop), + ), + nil, + }, + { + "success: valid packet with forwarding path hops with memo", + types.NewFungibleTokenPacketDataV2( + []types.Token{ + { + Denom: types.NewDenom(denom, types.NewTrace("transfer", "channel-0"), types.NewTrace("transfer", "channel-1")), + Amount: amount, }, - Memo: "", }, + sender, + receiver, + "", + types.NewForwardingInfo("memo", validHop), ), nil, }, @@ -389,25 +395,90 @@ func TestFungibleTokenPacketDataV2ValidateBasic(t *testing.T) { types.NewFungibleTokenPacketDataV2( []types.Token{ { - Denom: types.Denom{ - Base: denom, - Trace: []types.Trace{types.NewTrace("transfer", "channel-0"), types.NewTrace("transfer", "channel-1")}, - }, + Denom: types.NewDenom(denom, types.NewTrace("transfer", "channel-0"), types.NewTrace("transfer", "channel-1")), Amount: amount, }, }, sender, receiver, "memo", - &types.ForwardingInfo{ - Hops: []types.Hop{ - { - PortId: "transfer", - ChannelId: "channel-1", - }, + types.NewForwardingInfo("", validHop), + ), + types.ErrInvalidMemo, + }, + { + "failure: invalid forwarding path port ID", + types.NewFungibleTokenPacketDataV2( + []types.Token{ + { + Denom: types.NewDenom(denom, types.NewTrace("transfer", "channel-0"), types.NewTrace("transfer", "channel-1")), + Amount: amount, }, - Memo: "", }, + sender, + receiver, + "", + types.NewForwardingInfo( + "", + types.Hop{ + PortId: invalidPort, + ChannelId: "channel-1", + }, + ), + ), + host.ErrInvalidID, + }, + { + "failure: invalid forwarding path channel ID", + types.NewFungibleTokenPacketDataV2( + []types.Token{ + { + Denom: types.NewDenom(denom, types.NewTrace("transfer", "channel-0"), types.NewTrace("transfer", "channel-1")), + Amount: amount, + }, + }, + sender, + receiver, + "", + types.NewForwardingInfo( + "", + types.Hop{ + PortId: "transfer", + ChannelId: invalidChannel, + }, + ), + ), + host.ErrInvalidID, + }, + { + "failure: invalid forwarding path too many hops", + types.NewFungibleTokenPacketDataV2( + []types.Token{ + { + Denom: types.NewDenom(denom, types.NewTrace("transfer", "channel-0"), types.NewTrace("transfer", "channel-1")), + Amount: amount, + }, + }, + sender, + receiver, + "", + types.NewForwardingInfo("", generateHops(types.MaximumNumberOfForwardingHops+1)...), + ), + types.ErrInvalidForwardingInfo, + }, + { + "failure: invalid forwarding path too long memo", + types.NewFungibleTokenPacketDataV2( + []types.Token{ + { + Denom: types.NewDenom(denom, types.NewTrace("transfer", "channel-0"), types.NewTrace("transfer", "channel-1")), + Amount: amount, + }, + }, + sender, + receiver, + "", + types.NewForwardingInfo(ibctesting.GenerateString(types.MaximumMemoLength+1), validHop), ), types.ErrInvalidMemo, }, From ba7c4a87a8b3efd8ae30193e13c4586139d1eaf9 Mon Sep 17 00:00:00 2001 From: Gjermund Garaba Date: Thu, 13 Jun 2024 09:51:34 +0200 Subject: [PATCH 5/5] feat(transfer): add validation for forwarding info in msg transfer validate basic (#6583) --- modules/apps/transfer/types/msgs.go | 11 ++++ modules/apps/transfer/types/msgs_test.go | 77 +++++++++++++----------- 2 files changed, 52 insertions(+), 36 deletions(-) diff --git a/modules/apps/transfer/types/msgs.go b/modules/apps/transfer/types/msgs.go index 3c10f3b5779..a50a6e5719a 100644 --- a/modules/apps/transfer/types/msgs.go +++ b/modules/apps/transfer/types/msgs.go @@ -102,6 +102,17 @@ func (msg MsgTransfer) ValidateBasic() error { return errorsmod.Wrapf(ErrInvalidMemo, "memo must not exceed %d bytes", MaximumMemoLength) } + if msg.ForwardingPath != nil { + if err := msg.ForwardingPath.Validate(); err != nil { + return err + } + + // We cannot have non-empty memo and non-empty forwarding path hops at the same time. + if len(msg.ForwardingPath.Hops) > 0 && msg.Memo != "" { + return errorsmod.Wrapf(ErrInvalidMemo, "memo must be empty if forwarding path hops is not empty: %s, %s", msg.Memo, msg.ForwardingPath.Hops) + } + } + for _, coin := range msg.GetCoins() { if err := validateIBCCoin(coin); err != nil { return errorsmod.Wrapf(ibcerrors.ErrInvalidCoins, "%s: %s", err.Error(), coin.String()) diff --git a/modules/apps/transfer/types/msgs_test.go b/modules/apps/transfer/types/msgs_test.go index 2f153eacca0..447fd619a36 100644 --- a/modules/apps/transfer/types/msgs_test.go +++ b/modules/apps/transfer/types/msgs_test.go @@ -79,19 +79,24 @@ func TestMsgTransferValidation(t *testing.T) { {"multidenom: zero coins", types.NewMsgTransfer(validPort, validChannel, zeroCoins, sender, receiver, timeoutHeight, 0, "", nil), ibcerrors.ErrInvalidCoins}, {"multidenom: too many coins", types.NewMsgTransfer(validPort, validChannel, make([]sdk.Coin, types.MaximumTokensLength+1), sender, receiver, timeoutHeight, 0, "", nil), ibcerrors.ErrInvalidCoins}, {"multidenom: both token and tokens are set", &types.MsgTransfer{validPort, validChannel, coin, sender, receiver, timeoutHeight, 0, "", coins, nil}, ibcerrors.ErrInvalidCoins}, + {"memo must be empty if forwarding path hops is not empty", types.NewMsgTransfer(validPort, validChannel, coins, sender, receiver, timeoutHeight, 0, "memo", types.NewForwardingInfo("", validHop)), types.ErrInvalidMemo}, + {"invalid forwarding info port", types.NewMsgTransfer(validPort, validChannel, coins, sender, receiver, timeoutHeight, 0, "", types.NewForwardingInfo("", types.Hop{PortId: invalidPort, ChannelId: validChannel})), host.ErrInvalidID}, + {"invalid forwarding info channel", types.NewMsgTransfer(validPort, validChannel, coins, sender, receiver, timeoutHeight, 0, "", types.NewForwardingInfo("", types.Hop{PortId: validPort, ChannelId: invalidChannel})), host.ErrInvalidID}, + {"invalid forwarding info too many hops", types.NewMsgTransfer(validPort, validChannel, coins, sender, receiver, timeoutHeight, 0, "", types.NewForwardingInfo("", generateHops(types.MaximumNumberOfForwardingHops+1)...)), types.ErrInvalidForwardingInfo}, + {"invalid forwarding info too long memo", types.NewMsgTransfer(validPort, validChannel, coins, sender, receiver, timeoutHeight, 0, "", types.NewForwardingInfo(ibctesting.GenerateString(types.MaximumMemoLength+1), validHop)), types.ErrInvalidMemo}, } for _, tc := range testCases { - tc := tc - - err := tc.msg.ValidateBasic() - - expPass := tc.expError == nil - if expPass { - require.NoError(t, err) - } else { - require.ErrorIs(t, err, tc.expError) - } + t.Run(tc.name, func(t *testing.T) { + err := tc.msg.ValidateBasic() + + expPass := tc.expError == nil + if expPass { + require.NoError(t, err) + } else { + require.ErrorIs(t, err, tc.expError) + } + }) } } @@ -119,16 +124,16 @@ func TestMsgUpdateParamsValidateBasic(t *testing.T) { } for _, tc := range testCases { - tc := tc - - err := tc.msg.ValidateBasic() - - expPass := tc.expError == nil - if expPass { - require.NoError(t, err) - } else { - require.ErrorIs(t, err, tc.expError) - } + t.Run(tc.name, func(t *testing.T) { + err := tc.msg.ValidateBasic() + + expPass := tc.expError == nil + if expPass { + require.NoError(t, err) + } else { + require.ErrorIs(t, err, tc.expError) + } + }) } } @@ -144,21 +149,21 @@ func TestMsgUpdateParamsGetSigners(t *testing.T) { } for _, tc := range testCases { - tc := tc - - msg := types.MsgUpdateParams{ - Signer: tc.address.String(), - Params: types.DefaultParams(), - } - - encodingCfg := moduletestutil.MakeTestEncodingConfig(transfer.AppModuleBasic{}) - signers, _, err := encodingCfg.Codec.GetMsgV1Signers(&msg) - - if tc.expPass { - require.NoError(t, err) - require.Equal(t, tc.address.Bytes(), signers[0]) - } else { - require.Error(t, err) - } + t.Run(tc.name, func(t *testing.T) { + msg := types.MsgUpdateParams{ + Signer: tc.address.String(), + Params: types.DefaultParams(), + } + + encodingCfg := moduletestutil.MakeTestEncodingConfig(transfer.AppModuleBasic{}) + signers, _, err := encodingCfg.Codec.GetMsgV1Signers(&msg) + + if tc.expPass { + require.NoError(t, err) + require.Equal(t, tc.address.Bytes(), signers[0]) + } else { + require.Error(t, err) + } + }) } }