From be8d9319234ce8a0963127bc03643f48baa49865 Mon Sep 17 00:00:00 2001 From: Sean King Date: Mon, 21 Feb 2022 17:23:54 +0100 Subject: [PATCH 1/7] fix: switch source with destintion for chan/port IDs --- modules/apps/29-fee/ibc_module.go | 2 +- modules/apps/29-fee/keeper/relay.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/apps/29-fee/ibc_module.go b/modules/apps/29-fee/ibc_module.go index 66e40d5d8d8..90dcfd29197 100644 --- a/modules/apps/29-fee/ibc_module.go +++ b/modules/apps/29-fee/ibc_module.go @@ -224,7 +224,7 @@ func (im IBCModule) OnAcknowledgementPacket( return sdkerrors.Wrapf(err, "cannot unmarshal ICS-29 incentivized packet acknowledgement: %v", ack) } - packetID := channeltypes.NewPacketId(packet.SourceChannel, packet.SourcePort, packet.Sequence) + packetID := channeltypes.NewPacketId(packet.DestinationChannel, packet.DestinationPort, packet.Sequence) identifiedPacketFees, found := im.keeper.GetFeesInEscrow(ctx, packetID) if !found { // return underlying callback if no fee found for given packetID diff --git a/modules/apps/29-fee/keeper/relay.go b/modules/apps/29-fee/keeper/relay.go index 628ad40a61f..9fcc11c994a 100644 --- a/modules/apps/29-fee/keeper/relay.go +++ b/modules/apps/29-fee/keeper/relay.go @@ -18,7 +18,7 @@ func (k Keeper) SendPacket(ctx sdk.Context, chanCap *capabilitytypes.Capability, // ICS29 WriteAcknowledgement is used for asynchronous acknowledgements func (k Keeper) WriteAcknowledgement(ctx sdk.Context, chanCap *capabilitytypes.Capability, packet ibcexported.PacketI, acknowledgement []byte) error { // retrieve the forward relayer that was stored in `onRecvPacket` - packetId := channeltypes.NewPacketId(packet.GetSourceChannel(), packet.GetSourcePort(), packet.GetSequence()) + packetId := channeltypes.NewPacketId(packet.GetDestChannel(), packet.GetDestPort(), packet.GetSequence()) relayer, _ := k.GetForwardRelayerAddress(ctx, packetId) k.DeleteForwardRelayerAddress(ctx, packetId) From 86bda95bf15334cf012becbbb3ed126c522a56fa Mon Sep 17 00:00:00 2001 From: Sean King Date: Tue, 22 Feb 2022 10:31:05 +0100 Subject: [PATCH 2/7] fix: blunder --- modules/apps/29-fee/ibc_module.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/apps/29-fee/ibc_module.go b/modules/apps/29-fee/ibc_module.go index 90dcfd29197..6593eb7152d 100644 --- a/modules/apps/29-fee/ibc_module.go +++ b/modules/apps/29-fee/ibc_module.go @@ -200,7 +200,7 @@ func (im IBCModule) OnRecvPacket( // incase of async aknowledgement (ack == nil) store the ForwardRelayer address for use later if ack == nil && found { - im.keeper.SetForwardRelayerAddress(ctx, channeltypes.NewPacketId(packet.GetSourceChannel(), packet.GetSourcePort(), packet.GetSequence()), forwardRelayer) + im.keeper.SetForwardRelayerAddress(ctx, channeltypes.NewPacketId(packet.GetDestChannel(), packet.GetDestPort(), packet.GetSequence()), forwardRelayer) return nil } @@ -224,7 +224,7 @@ func (im IBCModule) OnAcknowledgementPacket( return sdkerrors.Wrapf(err, "cannot unmarshal ICS-29 incentivized packet acknowledgement: %v", ack) } - packetID := channeltypes.NewPacketId(packet.DestinationChannel, packet.DestinationPort, packet.Sequence) + packetID := channeltypes.NewPacketId(packet.SourceChannel, packet.SourcePort, packet.Sequence) identifiedPacketFees, found := im.keeper.GetFeesInEscrow(ctx, packetID) if !found { // return underlying callback if no fee found for given packetID From 53decd4a29ceaa1c1ef4df1065cabcfd2d4737e9 Mon Sep 17 00:00:00 2001 From: Sean King Date: Thu, 24 Feb 2022 16:27:06 +0100 Subject: [PATCH 3/7] test: adding tests in case of incorrect channel/port id --- modules/apps/29-fee/fee_test.go | 14 ++++++++++++-- modules/apps/29-fee/ibc_module_test.go | 24 +++++++++++++++++++----- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/modules/apps/29-fee/fee_test.go b/modules/apps/29-fee/fee_test.go index 12d7e70a147..a6e2642c30a 100644 --- a/modules/apps/29-fee/fee_test.go +++ b/modules/apps/29-fee/fee_test.go @@ -19,14 +19,17 @@ type FeeTestSuite struct { chainA *ibctesting.TestChain chainB *ibctesting.TestChain + chainC *ibctesting.TestChain - path *ibctesting.Path + path *ibctesting.Path + path2 *ibctesting.Path } func (suite *FeeTestSuite) SetupTest() { - suite.coordinator = ibctesting.NewCoordinator(suite.T(), 2) + suite.coordinator = ibctesting.NewCoordinator(suite.T(), 3) suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(1)) suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(2)) + suite.chainC = suite.coordinator.GetChain(ibctesting.GetChainID(3)) path := ibctesting.NewPath(suite.chainA, suite.chainB) mockFeeVersion := string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{FeeVersion: types.Version, AppVersion: ibcmock.Version})) @@ -35,6 +38,13 @@ func (suite *FeeTestSuite) SetupTest() { path.EndpointA.ChannelConfig.PortID = ibctesting.MockFeePort path.EndpointB.ChannelConfig.PortID = ibctesting.MockFeePort suite.path = path + + path = ibctesting.NewPath(suite.chainA, suite.chainC) + path.EndpointA.ChannelConfig.Version = mockFeeVersion + path.EndpointB.ChannelConfig.Version = mockFeeVersion + path.EndpointA.ChannelConfig.PortID = ibctesting.MockFeePort + path.EndpointB.ChannelConfig.PortID = ibctesting.MockFeePort + suite.path2 = path } func TestIBCFeeTestSuite(t *testing.T) { diff --git a/modules/apps/29-fee/ibc_module_test.go b/modules/apps/29-fee/ibc_module_test.go index 214c171d72a..80b6f693c94 100644 --- a/modules/apps/29-fee/ibc_module_test.go +++ b/modules/apps/29-fee/ibc_module_test.go @@ -498,12 +498,10 @@ func (suite *FeeTestSuite) TestOnRecvPacket() { tc := tc suite.Run(tc.name, func() { suite.SetupTest() + suite.coordinator.Setup(suite.path2) suite.coordinator.Setup(suite.path) - // set up a different channel to make sure that the test will error if the destination channel of the packet is not fee enabled - suite.path.EndpointB.ChannelID = "channel-1" suite.chainB.GetSimApp().IBCFeeKeeper.SetFeeEnabled(suite.chainB.GetContext(), suite.path.EndpointB.ChannelConfig.PortID, suite.path.EndpointB.ChannelID) - suite.chainB.GetSimApp().IBCFeeKeeper.DeleteFeeEnabled(suite.chainB.GetContext(), suite.path.EndpointB.ChannelConfig.PortID, "channel-0") packet := suite.CreateMockPacket() @@ -514,7 +512,7 @@ func (suite *FeeTestSuite) TestOnRecvPacket() { cbs, ok := suite.chainB.App.GetIBCKeeper().Router.GetRoute(module) suite.Require().True(ok) - suite.chainB.GetSimApp().IBCFeeKeeper.SetCounterpartyAddress(suite.chainB.GetContext(), suite.chainA.SenderAccount.GetAddress().String(), suite.chainB.SenderAccount.GetAddress().String(), suite.path.EndpointB.ChannelID) + suite.chainB.GetSimApp().IBCFeeKeeper.SetCounterpartyAddress(suite.chainB.GetContext(), suite.chainA.SenderAccount.GetAddress().String(), suite.chainB.SenderAccount.GetAddress().String(), suite.path.EndpointA.ChannelID) // malleate test case tc.malleate() @@ -527,11 +525,27 @@ func (suite *FeeTestSuite) TestOnRecvPacket() { case tc.forwardRelayer && result == nil: suite.Require().Equal(nil, result) + packetId := channeltypes.NewPacketId(packet.GetDestChannel(), packet.GetDestPort(), packet.GetSequence()) + + // retrieve the forward relayer that was stored in `onRecvPacket` + relayer, _ := suite.chainB.GetSimApp().IBCFeeKeeper.GetRelayerAddressForAsyncAck(suite.chainB.GetContext(), packetId) + suite.Require().Equal(relayer, suite.chainA.SenderAccount.GetAddress().String()) + + chanCap := suite.chainB.GetChannelCapability(suite.path.EndpointB.ChannelConfig.PortID, suite.path.EndpointB.ChannelID) + ack := channeltypes.NewResultAcknowledgement([]byte("success")) + + err := suite.chainB.GetSimApp().IBCFeeKeeper.WriteAcknowledgement(suite.chainB.GetContext(), chanCap, packet, ack) + suite.Require().NoError(err) + + packetAck, _ := suite.chainB.GetSimApp().GetIBCKeeper().ChannelKeeper.GetPacketAcknowledgement(suite.chainB.GetContext(), packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence()) + suite.Require().Equal(packetAck, channeltypes.CommitAcknowledgement(ack.Acknowledgement())) case !tc.forwardRelayer: + forwardAddr, _ := suite.chainB.GetSimApp().IBCFeeKeeper.GetCounterpartyAddress(suite.chainB.GetContext(), suite.chainA.SenderAccount.GetAddress().String(), suite.path.EndpointA.ChannelID) + expectedAck := types.IncentivizedAcknowledgement{ Result: ibcmock.MockAcknowledgement.Acknowledgement(), - ForwardRelayerAddress: "", + ForwardRelayerAddress: forwardAddr, UnderlyingAppSuccess: true, } suite.Require().Equal(expectedAck, result) From f67f1394b66a1dc988f9116c5aa2f1ab76eeba57 Mon Sep 17 00:00:00 2001 From: Sean King Date: Thu, 24 Feb 2022 17:08:00 +0100 Subject: [PATCH 4/7] test: moving check to WriteAcknowledgement --- modules/apps/29-fee/ibc_module_test.go | 11 ++--------- modules/apps/29-fee/keeper/keeper_test.go | 15 +++++++++++++-- modules/apps/29-fee/keeper/relay_test.go | 12 ++++++++++-- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/modules/apps/29-fee/ibc_module_test.go b/modules/apps/29-fee/ibc_module_test.go index 80b6f693c94..293ae29c08f 100644 --- a/modules/apps/29-fee/ibc_module_test.go +++ b/modules/apps/29-fee/ibc_module_test.go @@ -498,7 +498,9 @@ func (suite *FeeTestSuite) TestOnRecvPacket() { tc := tc suite.Run(tc.name, func() { suite.SetupTest() + // setup path2 (chainA -> chainC) first in order to have different channel IDs for chainA & chainB suite.coordinator.Setup(suite.path2) + // setup path for chainA -> chainB suite.coordinator.Setup(suite.path) suite.chainB.GetSimApp().IBCFeeKeeper.SetFeeEnabled(suite.chainB.GetContext(), suite.path.EndpointB.ChannelConfig.PortID, suite.path.EndpointB.ChannelID) @@ -531,15 +533,6 @@ func (suite *FeeTestSuite) TestOnRecvPacket() { relayer, _ := suite.chainB.GetSimApp().IBCFeeKeeper.GetRelayerAddressForAsyncAck(suite.chainB.GetContext(), packetId) suite.Require().Equal(relayer, suite.chainA.SenderAccount.GetAddress().String()) - chanCap := suite.chainB.GetChannelCapability(suite.path.EndpointB.ChannelConfig.PortID, suite.path.EndpointB.ChannelID) - ack := channeltypes.NewResultAcknowledgement([]byte("success")) - - err := suite.chainB.GetSimApp().IBCFeeKeeper.WriteAcknowledgement(suite.chainB.GetContext(), chanCap, packet, ack) - suite.Require().NoError(err) - - packetAck, _ := suite.chainB.GetSimApp().GetIBCKeeper().ChannelKeeper.GetPacketAcknowledgement(suite.chainB.GetContext(), packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence()) - suite.Require().Equal(packetAck, channeltypes.CommitAcknowledgement(ack.Acknowledgement())) - case !tc.forwardRelayer: forwardAddr, _ := suite.chainB.GetSimApp().IBCFeeKeeper.GetCounterpartyAddress(suite.chainB.GetContext(), suite.chainA.SenderAccount.GetAddress().String(), suite.path.EndpointA.ChannelID) diff --git a/modules/apps/29-fee/keeper/keeper_test.go b/modules/apps/29-fee/keeper/keeper_test.go index 65132c243e1..adb710da0cf 100644 --- a/modules/apps/29-fee/keeper/keeper_test.go +++ b/modules/apps/29-fee/keeper/keeper_test.go @@ -28,15 +28,19 @@ type KeeperTestSuite struct { // testing chains used for convenience and readability chainA *ibctesting.TestChain chainB *ibctesting.TestChain + chainC *ibctesting.TestChain + + path *ibctesting.Path + path2 *ibctesting.Path - path *ibctesting.Path queryClient types.QueryClient } func (suite *KeeperTestSuite) SetupTest() { - suite.coordinator = ibctesting.NewCoordinator(suite.T(), 2) + suite.coordinator = ibctesting.NewCoordinator(suite.T(), 3) suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(1)) suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(2)) + suite.chainC = suite.coordinator.GetChain(ibctesting.GetChainID(3)) path := ibctesting.NewPath(suite.chainA, suite.chainB) mockFeeVersion := string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{FeeVersion: types.Version, AppVersion: ibcmock.Version})) @@ -46,6 +50,13 @@ func (suite *KeeperTestSuite) SetupTest() { path.EndpointB.ChannelConfig.PortID = ibctesting.MockFeePort suite.path = path + path = ibctesting.NewPath(suite.chainA, suite.chainC) + path.EndpointA.ChannelConfig.Version = mockFeeVersion + path.EndpointB.ChannelConfig.Version = mockFeeVersion + path.EndpointA.ChannelConfig.PortID = ibctesting.MockFeePort + path.EndpointB.ChannelConfig.PortID = ibctesting.MockFeePort + suite.path2 = path + queryHelper := baseapp.NewQueryServerTestHelper(suite.chainA.GetContext(), suite.chainA.GetSimApp().InterfaceRegistry()) types.RegisterQueryServer(queryHelper, suite.chainA.GetSimApp().IBCFeeKeeper) suite.queryClient = types.NewQueryClient(queryHelper) diff --git a/modules/apps/29-fee/keeper/relay_test.go b/modules/apps/29-fee/keeper/relay_test.go index 4f366b8682a..3d639473c48 100644 --- a/modules/apps/29-fee/keeper/relay_test.go +++ b/modules/apps/29-fee/keeper/relay_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + "github.com/cosmos/ibc-go/v3/modules/apps/29-fee/types" clienttypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types" channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" ) @@ -14,7 +15,7 @@ func (suite *KeeperTestSuite) TestWriteAcknowledgementAsync() { { "success", func() { - suite.chainB.GetSimApp().IBCFeeKeeper.SetRelayerAddressForAsyncAck(suite.chainB.GetContext(), channeltypes.NewPacketId(suite.path.EndpointA.ChannelID, suite.path.EndpointA.ChannelConfig.PortID, 1), suite.chainA.SenderAccount.GetAddress().String()) + suite.chainB.GetSimApp().IBCFeeKeeper.SetRelayerAddressForAsyncAck(suite.chainB.GetContext(), channeltypes.NewPacketId(suite.path.EndpointB.ChannelID, suite.path.EndpointB.ChannelConfig.PortID, 1), suite.chainA.SenderAccount.GetAddress().String()) suite.chainB.GetSimApp().IBCFeeKeeper.SetCounterpartyAddress(suite.chainB.GetContext(), suite.chainA.SenderAccount.GetAddress().String(), suite.chainB.SenderAccount.GetAddress().String(), suite.path.EndpointA.ChannelID) }, true, @@ -31,7 +32,10 @@ func (suite *KeeperTestSuite) TestWriteAcknowledgementAsync() { suite.Run(tc.name, func() { suite.SetupTest() - // open incentivized channel + // open incentivized channels + // setup path2 (chainA -> chainC) first in order to have different channel IDs for chainA & chainB + suite.coordinator.Setup(suite.path2) + // setup path for chainA -> chainB suite.coordinator.Setup(suite.path) // build packet @@ -59,6 +63,10 @@ func (suite *KeeperTestSuite) TestWriteAcknowledgementAsync() { suite.Require().NoError(err) _, found := suite.chainB.GetSimApp().IBCFeeKeeper.GetRelayerAddressForAsyncAck(suite.chainB.GetContext(), channeltypes.NewPacketId(suite.path.EndpointA.ChannelID, suite.path.EndpointA.ChannelConfig.PortID, 1)) suite.Require().False(found) + + expectedAck := types.NewIncentivizedAcknowledgement(suite.chainB.SenderAccount.GetAddress().String(), ack.Acknowledgement(), ack.Success()) + commitedAck, _ := suite.chainB.GetSimApp().GetIBCKeeper().ChannelKeeper.GetPacketAcknowledgement(suite.chainB.GetContext(), packet.DestinationPort, packet.DestinationChannel, 1) + suite.Require().Equal(commitedAck, channeltypes.CommitAcknowledgement(expectedAck.Acknowledgement())) } else { suite.Require().Error(err) } From 40ccecdf8a984563159bbff8b1d0dfeb4d2d2c49 Mon Sep 17 00:00:00 2001 From: Sean King Date: Thu, 24 Feb 2022 18:01:36 +0100 Subject: [PATCH 5/7] add test case for Get/Set counterparty address --- modules/apps/29-fee/ibc_module.go | 2 +- modules/apps/29-fee/ibc_module_test.go | 16 ++++++++++++---- modules/apps/29-fee/keeper/msg_server_test.go | 2 +- modules/apps/29-fee/keeper/relay.go | 2 +- modules/apps/29-fee/keeper/relay_test.go | 2 +- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/modules/apps/29-fee/ibc_module.go b/modules/apps/29-fee/ibc_module.go index 7bc1b326b04..e8a4a45fd40 100644 --- a/modules/apps/29-fee/ibc_module.go +++ b/modules/apps/29-fee/ibc_module.go @@ -203,7 +203,7 @@ func (im IBCModule) OnRecvPacket( } // if forwardRelayer is not found we refund recv_fee - forwardRelayer, _ := im.keeper.GetCounterpartyAddress(ctx, relayer.String(), packet.GetSourceChannel()) + forwardRelayer, _ := im.keeper.GetCounterpartyAddress(ctx, relayer.String(), packet.GetDestChannel()) return types.NewIncentivizedAcknowledgement(forwardRelayer, ack.Acknowledgement(), ack.Success()) } diff --git a/modules/apps/29-fee/ibc_module_test.go b/modules/apps/29-fee/ibc_module_test.go index 293ae29c08f..462d7702c7d 100644 --- a/modules/apps/29-fee/ibc_module_test.go +++ b/modules/apps/29-fee/ibc_module_test.go @@ -514,7 +514,7 @@ func (suite *FeeTestSuite) TestOnRecvPacket() { cbs, ok := suite.chainB.App.GetIBCKeeper().Router.GetRoute(module) suite.Require().True(ok) - suite.chainB.GetSimApp().IBCFeeKeeper.SetCounterpartyAddress(suite.chainB.GetContext(), suite.chainA.SenderAccount.GetAddress().String(), suite.chainB.SenderAccount.GetAddress().String(), suite.path.EndpointA.ChannelID) + suite.chainB.GetSimApp().IBCFeeKeeper.SetCounterpartyAddress(suite.chainB.GetContext(), suite.chainA.SenderAccount.GetAddress().String(), suite.chainB.SenderAccount.GetAddress().String(), suite.path.EndpointB.ChannelID) // malleate test case tc.malleate() @@ -522,6 +522,16 @@ func (suite *FeeTestSuite) TestOnRecvPacket() { result := cbs.OnRecvPacket(suite.chainB.GetContext(), packet, suite.chainA.SenderAccount.GetAddress()) switch { + case tc.name == "success": + forwardAddr, _ := suite.chainB.GetSimApp().IBCFeeKeeper.GetCounterpartyAddress(suite.chainB.GetContext(), suite.chainA.SenderAccount.GetAddress().String(), suite.path.EndpointB.ChannelID) + + expectedAck := types.IncentivizedAcknowledgement{ + Result: ibcmock.MockAcknowledgement.Acknowledgement(), + ForwardRelayerAddress: forwardAddr, + UnderlyingAppSuccess: true, + } + suite.Require().Equal(expectedAck, result) + case !tc.feeEnabled: suite.Require().Equal(ibcmock.MockAcknowledgement, result) @@ -534,11 +544,9 @@ func (suite *FeeTestSuite) TestOnRecvPacket() { suite.Require().Equal(relayer, suite.chainA.SenderAccount.GetAddress().String()) case !tc.forwardRelayer: - forwardAddr, _ := suite.chainB.GetSimApp().IBCFeeKeeper.GetCounterpartyAddress(suite.chainB.GetContext(), suite.chainA.SenderAccount.GetAddress().String(), suite.path.EndpointA.ChannelID) - expectedAck := types.IncentivizedAcknowledgement{ Result: ibcmock.MockAcknowledgement.Acknowledgement(), - ForwardRelayerAddress: forwardAddr, + ForwardRelayerAddress: "", UnderlyingAppSuccess: true, } suite.Require().Equal(expectedAck, result) diff --git a/modules/apps/29-fee/keeper/msg_server_test.go b/modules/apps/29-fee/keeper/msg_server_test.go index c6dc2f90856..c7551ce0154 100644 --- a/modules/apps/29-fee/keeper/msg_server_test.go +++ b/modules/apps/29-fee/keeper/msg_server_test.go @@ -23,7 +23,7 @@ func (suite *KeeperTestSuite) TestRegisterCounterpartyAddress() { func() {}, }, { - "success", + "counterparty is arbitrary string", true, func() { counterparty = "arbitrary-string" }, }, diff --git a/modules/apps/29-fee/keeper/relay.go b/modules/apps/29-fee/keeper/relay.go index 05511581d54..e2d75c3a1f8 100644 --- a/modules/apps/29-fee/keeper/relay.go +++ b/modules/apps/29-fee/keeper/relay.go @@ -33,7 +33,7 @@ func (k Keeper) WriteAcknowledgement(ctx sdk.Context, chanCap *capabilitytypes.C // it is possible that a relayer has not registered a counterparty address. // if there is no registered counterparty address then write acknowledgement with empty relayer address and refund recv_fee. - forwardRelayer, _ := k.GetCounterpartyAddress(ctx, relayer, packet.GetSourceChannel()) + forwardRelayer, _ := k.GetCounterpartyAddress(ctx, relayer, packet.GetDestChannel()) ack := types.NewIncentivizedAcknowledgement(forwardRelayer, acknowledgement.Acknowledgement(), acknowledgement.Success()) diff --git a/modules/apps/29-fee/keeper/relay_test.go b/modules/apps/29-fee/keeper/relay_test.go index 3d639473c48..9ddd7e9b828 100644 --- a/modules/apps/29-fee/keeper/relay_test.go +++ b/modules/apps/29-fee/keeper/relay_test.go @@ -16,7 +16,7 @@ func (suite *KeeperTestSuite) TestWriteAcknowledgementAsync() { "success", func() { suite.chainB.GetSimApp().IBCFeeKeeper.SetRelayerAddressForAsyncAck(suite.chainB.GetContext(), channeltypes.NewPacketId(suite.path.EndpointB.ChannelID, suite.path.EndpointB.ChannelConfig.PortID, 1), suite.chainA.SenderAccount.GetAddress().String()) - suite.chainB.GetSimApp().IBCFeeKeeper.SetCounterpartyAddress(suite.chainB.GetContext(), suite.chainA.SenderAccount.GetAddress().String(), suite.chainB.SenderAccount.GetAddress().String(), suite.path.EndpointA.ChannelID) + suite.chainB.GetSimApp().IBCFeeKeeper.SetCounterpartyAddress(suite.chainB.GetContext(), suite.chainA.SenderAccount.GetAddress().String(), suite.chainB.SenderAccount.GetAddress().String(), suite.path.EndpointB.ChannelID) }, true, }, From 5bdcd178a290f215f5370f3ae3e48b1b8d170ad9 Mon Sep 17 00:00:00 2001 From: Sean King Date: Thu, 24 Feb 2022 18:06:46 +0100 Subject: [PATCH 6/7] nit: path name --- modules/apps/29-fee/fee_test.go | 4 ++-- modules/apps/29-fee/ibc_module_test.go | 4 ++-- modules/apps/29-fee/keeper/keeper_test.go | 6 +++--- modules/apps/29-fee/keeper/relay_test.go | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/modules/apps/29-fee/fee_test.go b/modules/apps/29-fee/fee_test.go index a6e2642c30a..9369fc16743 100644 --- a/modules/apps/29-fee/fee_test.go +++ b/modules/apps/29-fee/fee_test.go @@ -22,7 +22,7 @@ type FeeTestSuite struct { chainC *ibctesting.TestChain path *ibctesting.Path - path2 *ibctesting.Path + pathAToC *ibctesting.Path } func (suite *FeeTestSuite) SetupTest() { @@ -44,7 +44,7 @@ func (suite *FeeTestSuite) SetupTest() { path.EndpointB.ChannelConfig.Version = mockFeeVersion path.EndpointA.ChannelConfig.PortID = ibctesting.MockFeePort path.EndpointB.ChannelConfig.PortID = ibctesting.MockFeePort - suite.path2 = path + suite.pathAToC = path } func TestIBCFeeTestSuite(t *testing.T) { diff --git a/modules/apps/29-fee/ibc_module_test.go b/modules/apps/29-fee/ibc_module_test.go index 462d7702c7d..6e0202a887e 100644 --- a/modules/apps/29-fee/ibc_module_test.go +++ b/modules/apps/29-fee/ibc_module_test.go @@ -498,8 +498,8 @@ func (suite *FeeTestSuite) TestOnRecvPacket() { tc := tc suite.Run(tc.name, func() { suite.SetupTest() - // setup path2 (chainA -> chainC) first in order to have different channel IDs for chainA & chainB - suite.coordinator.Setup(suite.path2) + // setup pathAToC (chainA -> chainC) first in order to have different channel IDs for chainA & chainB + suite.coordinator.Setup(suite.pathAToC) // setup path for chainA -> chainB suite.coordinator.Setup(suite.path) diff --git a/modules/apps/29-fee/keeper/keeper_test.go b/modules/apps/29-fee/keeper/keeper_test.go index adb710da0cf..c9ad4a5f10b 100644 --- a/modules/apps/29-fee/keeper/keeper_test.go +++ b/modules/apps/29-fee/keeper/keeper_test.go @@ -30,8 +30,8 @@ type KeeperTestSuite struct { chainB *ibctesting.TestChain chainC *ibctesting.TestChain - path *ibctesting.Path - path2 *ibctesting.Path + path *ibctesting.Path + pathAToC *ibctesting.Path queryClient types.QueryClient } @@ -55,7 +55,7 @@ func (suite *KeeperTestSuite) SetupTest() { path.EndpointB.ChannelConfig.Version = mockFeeVersion path.EndpointA.ChannelConfig.PortID = ibctesting.MockFeePort path.EndpointB.ChannelConfig.PortID = ibctesting.MockFeePort - suite.path2 = path + suite.pathAToC = path queryHelper := baseapp.NewQueryServerTestHelper(suite.chainA.GetContext(), suite.chainA.GetSimApp().InterfaceRegistry()) types.RegisterQueryServer(queryHelper, suite.chainA.GetSimApp().IBCFeeKeeper) diff --git a/modules/apps/29-fee/keeper/relay_test.go b/modules/apps/29-fee/keeper/relay_test.go index 9ddd7e9b828..3cfd627b520 100644 --- a/modules/apps/29-fee/keeper/relay_test.go +++ b/modules/apps/29-fee/keeper/relay_test.go @@ -33,8 +33,8 @@ func (suite *KeeperTestSuite) TestWriteAcknowledgementAsync() { suite.SetupTest() // open incentivized channels - // setup path2 (chainA -> chainC) first in order to have different channel IDs for chainA & chainB - suite.coordinator.Setup(suite.path2) + // setup pathAToC (chainA -> chainC) first in order to have different channel IDs for chainA & chainB + suite.coordinator.Setup(suite.pathAToC) // setup path for chainA -> chainB suite.coordinator.Setup(suite.path) From 599c574a4f1a6226dffba5b4e8f373152aa7fc87 Mon Sep 17 00:00:00 2001 From: Sean King Date: Thu, 24 Feb 2022 18:26:10 +0100 Subject: [PATCH 7/7] Update modules/apps/29-fee/keeper/msg_server_test.go --- modules/apps/29-fee/keeper/msg_server_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/apps/29-fee/keeper/msg_server_test.go b/modules/apps/29-fee/keeper/msg_server_test.go index c7551ce0154..1b371a2369f 100644 --- a/modules/apps/29-fee/keeper/msg_server_test.go +++ b/modules/apps/29-fee/keeper/msg_server_test.go @@ -23,7 +23,7 @@ func (suite *KeeperTestSuite) TestRegisterCounterpartyAddress() { func() {}, }, { - "counterparty is arbitrary string", + "counterparty is an arbitrary string", true, func() { counterparty = "arbitrary-string" }, },