Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: move back to nullable forwarding. #6733

Merged
merged 4 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions e2e/tests/transfer/authz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func (suite *AuthzTransferTestSuite) TestAuthz_MsgTransfer_Succeeds() {
suite.GetTimeoutHeight(ctx, chainB),
0,
"",
transfertypes.Forwarding{},
nil,
)

protoAny, err := codectypes.NewAnyWithValue(transferMsg)
Expand Down Expand Up @@ -192,7 +192,7 @@ func (suite *AuthzTransferTestSuite) TestAuthz_MsgTransfer_Succeeds() {
suite.GetTimeoutHeight(ctx, chainB),
0,
"",
transfertypes.Forwarding{},
nil,
)

protoAny, err := codectypes.NewAnyWithValue(transferMsg)
Expand Down Expand Up @@ -276,7 +276,7 @@ func (suite *AuthzTransferTestSuite) TestAuthz_InvalidTransferAuthorizations() {
suite.GetTimeoutHeight(ctx, chainB),
0,
"",
transfertypes.Forwarding{},
nil,
)

protoAny, err := codectypes.NewAnyWithValue(transferMsg)
Expand Down Expand Up @@ -337,7 +337,7 @@ func (suite *AuthzTransferTestSuite) TestAuthz_InvalidTransferAuthorizations() {
suite.GetTimeoutHeight(ctx, chainB),
0,
"",
transfertypes.Forwarding{},
nil,
)

protoAny, err := codectypes.NewAnyWithValue(transferMsg)
Expand Down
5 changes: 2 additions & 3 deletions e2e/tests/transfer/incentivized_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"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"
channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"
)

Expand Down Expand Up @@ -217,7 +216,7 @@ func (s *IncentivizedTransferTestSuite) TestMsgPayPacketFee_InvalidReceiverAccou
s.GetTimeoutHeight(ctx, chainB),
0,
"",
transfertypes.Forwarding{},
nil,
)
txResp := s.BroadcastMessages(ctx, chainA, chainAWallet, msgTransfer)
// this message should be successful, as receiver account is not validated on the sending chain.
Expand Down Expand Up @@ -356,7 +355,7 @@ func (s *IncentivizedTransferTestSuite) TestMultiMsg_MsgPayPacketFeeSingleSender
s.GetTimeoutHeight(ctx, chainB),
0,
"",
transfertypes.Forwarding{},
nil,
)
resp := s.BroadcastMessages(ctx, chainA, chainAWallet, msgPayPacketFee, msgTransfer)
s.AssertTxSuccess(resp)
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/transfer/upgradesv1_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ func (s *TransferChannelUpgradesV1TestSuite) TestChannelUpgrade_WithFeeMiddlewar
s.GetTimeoutHeight(ctx, chainB),
0,
"",
transfertypes.Forwarding{},
nil,
)
resp := s.BroadcastMessages(ctx, chainA, chainAWallet, msgPayPacketFee, msgTransfer)
s.AssertTxSuccess(resp)
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/transfer/upgradesv2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ func (s *TransferChannelUpgradesTestSuite) TestChannelUpgrade_WithFeeMiddleware_
s.GetTimeoutHeight(ctx, chainB),
0,
"",
transfertypes.Forwarding{},
nil,
)
resp := s.BroadcastMessages(ctx, chainA, chainAWallet, msgPayPacketFee, msgTransfer)
s.AssertTxSuccess(resp)
Expand Down
3 changes: 1 addition & 2 deletions e2e/tests/upgrades/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (
"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"
v7migrations "github.com/cosmos/ibc-go/v8/modules/core/02-client/migrations/v7"
clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
connectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types"
Expand Down Expand Up @@ -979,7 +978,7 @@ func (s *UpgradeTestSuite) TestV8ToV8_1ChainUpgrade_ChannelUpgrades() {
s.GetTimeoutHeight(ctx, chainB),
0,
"",
transfertypes.Forwarding{},
nil,
)
resp := s.BroadcastMessages(ctx, chainA, chainAWallet, msgPayPacketFee, msgTransfer)
s.AssertTxSuccess(resp)
Expand Down
2 changes: 1 addition & 1 deletion e2e/testsuite/testsuite.go
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,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, forwarding transfertypes.Forwarding) *transfertypes.MsgTransfer {
func GetMsgTransfer(portID, channelID, version string, tokens sdk.Coins, sender, receiver string, timeoutHeight clienttypes.Height, timeoutTimestamp uint64, memo string, forwarding *transfertypes.Forwarding) *transfertypes.MsgTransfer {
if len(tokens) == 0 {
panic(errors.New("tokens cannot be empty"))
}
Expand Down
3 changes: 1 addition & 2 deletions e2e/testsuite/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import (
"github.com/cosmos/ibc-go/e2e/testsuite/sanitize"
"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"
)
Expand Down Expand Up @@ -300,7 +299,7 @@ func (s *E2ETestSuite) Transfer(ctx context.Context, chain ibc.Chain, user ibc.W
transferVersion = version.AppVersion
}

msg := GetMsgTransfer(portID, channelID, transferVersion, tokens, sender, receiver, timeoutHeight, timeoutTimestamp, memo, transfertypes.Forwarding{})
msg := GetMsgTransfer(portID, channelID, transferVersion, tokens, sender, receiver, timeoutHeight, timeoutTimestamp, memo, nil)

return s.BroadcastMessages(ctx, chain, user, msg)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ func (suite *KeeperTestSuite) TestOnRecvPacket() {
suite.chainB.GetTimeoutHeight(),
0,
"",
transfertypes.Forwarding{},
nil,
)

data, err := icatypes.SerializeCosmosTx(suite.chainA.GetSimApp().AppCodec(), []proto.Message{msg}, encoding)
Expand Down Expand Up @@ -389,7 +389,7 @@ func (suite *KeeperTestSuite) TestOnRecvPacket() {
suite.chainB.GetTimeoutHeight(),
0,
"",
transfertypes.Forwarding{},
nil,
)

data, err := icatypes.SerializeCosmosTx(suite.chainA.GetSimApp().AppCodec(), []proto.Message{msg}, encoding)
Expand Down
2 changes: 1 addition & 1 deletion modules/apps/29-fee/keeper/events_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func (suite *KeeperTestSuite) TestDistributeFeeEvent() {
path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID,
sdk.NewCoins(ibctesting.TestCoin), suite.chainA.SenderAccount.GetAddress().String(), suite.chainB.SenderAccount.GetAddress().String(),
clienttypes.NewHeight(1, 100), 0, "",
transfertypes.Forwarding{},
nil,
)

res, err := suite.chainA.SendMsgs(msgPayPacketFee, msgTransfer)
Expand Down
4 changes: 2 additions & 2 deletions modules/apps/29-fee/transfer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (suite *FeeTestSuite) TestFeeTransfer() {

msgs := []sdk.Msg{
types.NewMsgPayPacketFee(fee, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, suite.chainA.SenderAccount.GetAddress().String(), nil),
transfertypes.NewMsgTransfer(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, tc.coinsToTransfer, suite.chainA.SenderAccount.GetAddress().String(), suite.chainB.SenderAccount.GetAddress().String(), clienttypes.NewHeight(1, 100), 0, "", transfertypes.Forwarding{}),
transfertypes.NewMsgTransfer(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, tc.coinsToTransfer, suite.chainA.SenderAccount.GetAddress().String(), suite.chainB.SenderAccount.GetAddress().String(), clienttypes.NewHeight(1, 100), 0, "", nil),
}

res, err := suite.chainA.SendMsgs(msgs...)
Expand Down Expand Up @@ -157,7 +157,7 @@ func (suite *FeeTestSuite) TestTransferFeeUpgrade() {
fee := types.NewFee(defaultRecvFee, defaultAckFee, defaultTimeoutFee)
msgs := []sdk.Msg{
types.NewMsgPayPacketFee(fee, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, suite.chainA.SenderAccount.GetAddress().String(), nil),
transfertypes.NewMsgTransfer(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, sdk.NewCoins(ibctesting.TestCoin), suite.chainA.SenderAccount.GetAddress().String(), suite.chainB.SenderAccount.GetAddress().String(), clienttypes.NewHeight(1, 100), 0, "", transfertypes.Forwarding{}),
transfertypes.NewMsgTransfer(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, sdk.NewCoins(ibctesting.TestCoin), suite.chainA.SenderAccount.GetAddress().String(), suite.chainB.SenderAccount.GetAddress().String(), clienttypes.NewHeight(1, 100), 0, "", nil),
}

res, err := suite.chainA.SendMsgs(msgs...)
Expand Down
2 changes: 1 addition & 1 deletion modules/apps/callbacks/ibc_middleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ func (s *CallbacksTestSuite) TestOnTimeoutPacket() {
sdk.NewCoins(ibctesting.TestCoin), s.chainA.SenderAccount.GetAddress().String(),
s.chainB.SenderAccount.GetAddress().String(), clienttypes.ZeroHeight(), timeoutTimestamp,
fmt.Sprintf(`{"src_callback": {"address":"%s", "gas_limit":"%d"}}`, ibctesting.TestAccAddress, userGasLimit), // set user gas limit above panic level in mock contract keeper
transfertypes.Forwarding{},
nil,
)

res, err := s.chainA.SendMsgs(msg)
Expand Down
2 changes: 1 addition & 1 deletion modules/apps/callbacks/replay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ func (s *CallbacksTestSuite) ExecuteFailedTransfer(memo string) {
s.chainA.SenderAccount.GetAddress().String(),
s.chainB.SenderAccount.GetAddress().String(),
clienttypes.NewHeight(1, 100), 0, memo,
transfertypes.Forwarding{},
nil,
)

res, err := s.chainA.SendMsgs(msg)
Expand Down
4 changes: 2 additions & 2 deletions modules/apps/callbacks/transfer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ func (s *CallbacksTestSuite) ExecuteTransfer(memo string) {
s.chainA.SenderAccount.GetAddress().String(),
s.chainB.SenderAccount.GetAddress().String(),
clienttypes.NewHeight(1, 100), 0, memo,
transfertypes.Forwarding{},
nil,
)

res, err := s.chainA.SendMsgs(msg)
Expand Down Expand Up @@ -228,7 +228,7 @@ func (s *CallbacksTestSuite) ExecuteTransferTimeout(memo string) {
s.chainA.SenderAccount.GetAddress().String(),
s.chainB.SenderAccount.GetAddress().String(),
timeoutHeight, timeoutTimestamp, memo,
transfertypes.Forwarding{},
nil,
)

res, err := s.chainA.SendMsgs(msg)
Expand Down
10 changes: 5 additions & 5 deletions modules/apps/transfer/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,22 +143,22 @@ to first unwind IBC tokens to their native chain and then forward them to the fi

// parseForwarding parses the forwarding flag into a Forwarding object or nil if the flag is not specified. If the flag cannot
// be parsed or the hops aren't in the portID/channelID format an error is returned.
func parseForwarding(cmd *cobra.Command) (types.Forwarding, error) {
func parseForwarding(cmd *cobra.Command) (*types.Forwarding, error) {
var hops []types.Hop

forwardingString, err := cmd.Flags().GetString(flagForwarding)
if err != nil {
return types.Forwarding{}, err
return nil, err
}
if strings.TrimSpace(forwardingString) == "" {
return types.Forwarding{}, nil
return nil, nil
}

pairs := strings.Split(forwardingString, ",")
for _, pair := range pairs {
pairSplit := strings.Split(pair, "/")
if len(pairSplit) != 2 {
return types.Forwarding{}, fmt.Errorf("expected a portID/channelID pair, found %s", pair)
return nil, fmt.Errorf("expected a portID/channelID pair, found %s", pair)
}

hop := types.NewHop(pairSplit[0], pairSplit[1])
Expand All @@ -167,7 +167,7 @@ func parseForwarding(cmd *cobra.Command) (types.Forwarding, error) {

unwind, err := cmd.Flags().GetBool(flagUnwind)
if err != nil {
return types.Forwarding{}, err
return nil, err
}

return types.NewForwarding(unwind, hops...), nil
Expand Down
2 changes: 1 addition & 1 deletion modules/apps/transfer/ibc_module_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ func (suite *TransferTestSuite) TestOnTimeoutPacket() {
timeoutHeight,
0,
"",
types.Forwarding{},
nil,
)
res, err := suite.chainA.SendMsgs(msg)
suite.Require().NoError(err) // message committed
Expand Down
2 changes: 1 addition & 1 deletion modules/apps/transfer/keeper/forwarding.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

// forwardPacket forwards a fungible FungibleTokenPacketDataV2 to the next hop in the forwarding path.
func (k Keeper) forwardPacket(ctx sdk.Context, data types.FungibleTokenPacketDataV2, packet channeltypes.Packet, receivedCoins sdk.Coins) error {
var nextForwardingPath types.Forwarding
var nextForwardingPath *types.Forwarding
if len(data.Forwarding.Hops) > 1 {
// remove the first hop since we are going to send to the first hop now and we want to propagate the rest of the hops to the receiver
nextForwardingPath = types.NewForwarding(false, data.Forwarding.Hops[1:]...)
Expand Down
2 changes: 1 addition & 1 deletion modules/apps/transfer/keeper/invariants_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (suite *KeeperTestSuite) TestTotalEscrowPerDenomInvariant() {
suite.chainA.SenderAccount.GetAddress().String(),
suite.chainB.SenderAccount.GetAddress().String(),
suite.chainA.GetTimeoutHeight(), 0, "",
types.Forwarding{},
nil,
)

res, err := suite.chainA.SendMsgs(msg)
Expand Down
2 changes: 1 addition & 1 deletion modules/apps/transfer/keeper/mbt_relay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ func (suite *KeeperTestSuite) TestModelBasedRelay() {
tc.packet.Data.Receiver,
suite.chainA.GetTimeoutHeight(), 0, // only use timeout height
"",
types.Forwarding{},
nil,
)

_, err = suite.chainB.GetSimApp().TransferKeeper.Transfer(suite.chainB.GetContext(), msg)
Expand Down
5 changes: 5 additions & 0 deletions modules/apps/transfer/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ func (k Keeper) Transfer(goCtx context.Context, msg *types.MsgTransfer) (*types.
return nil, errorsmod.Wrapf(ibcerrors.ErrUnauthorized, "%s is not allowed to send funds", sender)
}

// Initialize empty pointer with empty forwarding information
if msg.Forwarding == nil {
msg.Forwarding = types.NewForwarding(false)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

really do not like this, though

Copy link
Contributor

@bznein bznein Jul 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this needed for?>

If it's only for the check below (and for the call to sednTransfer, maybe it can be slightly cleaner like this?

var hops []types.Hops
if msg.Forwarding  != nil {
      hops = msg.Forwarding.Hops 
      if msg.Forwarding.Unwind {
         ....
       } 
}

	sequence, err := k.sendTransfer(
		ctx, msg.SourcePort, msg.SourceChannel, coins, sender, msg.Receiver, msg.TimeoutHeight, msg.TimeoutTimestamp,
		msg.Memo, hops)

Still not super clean, but maybe marginally better?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we'd also need to move assignment to hops after that unwind call considering it could modify it but yea, think this couild be an alt if people have preferences.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be fine with:

if msg.Forwarding != nil && msg.Forwarding.Unwind

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mainly did this because we forward hops after when calling into sendTransfer and didn't want two nil checks.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe also pretty dirty, but could do something like

func (f *Forwarding) Unwind() {
  if f == nil {
    return false
  }
  return f.Unwind 
}

Perfectly happy with the inline check colin suggested though 👍

Copy link
Contributor Author

@DimitrisJim DimitrisJim Jul 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, I definitely prefer this. Will probably do for Hops too.

lol, forgot proto generates these for us 🤦


if msg.Forwarding.Unwind {
msg, err = k.unwindHops(ctx, msg)
if err != nil {
Expand Down
8 changes: 6 additions & 2 deletions modules/apps/transfer/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func (suite *KeeperTestSuite) TestMsgTransfer() {
suite.chainB.SenderAccount.GetAddress().String(),
suite.chainB.GetTimeoutHeight(), 0, // only use timeout height
"memo",
types.Forwarding{},
nil,
)

// send some coins of the second denom from bank module to the sender account as well
Expand All @@ -162,7 +162,11 @@ func (suite *KeeperTestSuite) TestMsgTransfer() {
tokensBz, err := json.Marshal(types.Tokens(tokens))
suite.Require().NoError(err)

forwardingHopsBz, err := json.Marshal(msg.Forwarding.Hops)
var forwardingHops []types.Hop
if msg.Forwarding != nil {
forwardingHops = msg.Forwarding.Hops
}
forwardingHopsBz, err := json.Marshal(forwardingHops)
suite.Require().NoError(err)

res, err := suite.chainA.GetSimApp().TransferKeeper.Transfer(ctx, msg)
Expand Down
6 changes: 2 additions & 4 deletions modules/apps/transfer/keeper/relay_forwarding_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ func (suite *KeeperTestSuite) TestAcknowledgementFailureWithMiddleChainAsNativeT
setupReceiver.GetAddress().String(),
suite.chainB.GetTimeoutHeight(),
0, "",
types.Forwarding{},
nil,
)

result, err := suite.chainB.SendMsgs(setupTransferMsg)
Expand Down Expand Up @@ -899,9 +899,7 @@ func (suite *KeeperTestSuite) TestOnTimeoutPacketForwarding() {

originalABalance := suite.chainA.GetSimApp().BankKeeper.GetBalance(suite.chainA.GetContext(), sender.GetAddress(), coin.Denom)

forwarding := types.Forwarding{
Hops: []types.Hop{types.NewHop(pathBtoC.EndpointA.ChannelConfig.PortID, pathBtoC.EndpointA.ChannelID)},
}
forwarding := types.NewForwarding(false, types.NewHop(pathBtoC.EndpointA.ChannelConfig.PortID, pathBtoC.EndpointA.ChannelID))

transferMsg := types.NewMsgTransfer(
pathAtoB.EndpointA.ChannelConfig.PortID,
Expand Down
4 changes: 2 additions & 2 deletions modules/apps/transfer/keeper/relay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
)

var (
emptyForwarding = types.Forwarding{}
emptyForwarding *types.Forwarding
emptyForwardingPacketData = types.ForwardingPacketData{}
)

Expand All @@ -36,7 +36,7 @@ func (suite *KeeperTestSuite) TestSendTransfer() {
sender sdk.AccAddress
timeoutHeight clienttypes.Height
memo string
forwarding types.Forwarding
forwarding *types.Forwarding
expEscrowAmount sdkmath.Int // total amount in escrow for denom on receiving chain
)

Expand Down
6 changes: 3 additions & 3 deletions modules/apps/transfer/transfer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (suite *TransferTestSuite) TestHandleMsgTransfer() {
}

// send from chainA to chainB
msg := types.NewMsgTransfer(pathAToB.EndpointA.ChannelConfig.PortID, pathAToB.EndpointA.ChannelID, originalCoins, suite.chainA.SenderAccount.GetAddress().String(), suite.chainB.SenderAccount.GetAddress().String(), timeoutHeight, 0, "", types.Forwarding{})
msg := types.NewMsgTransfer(pathAToB.EndpointA.ChannelConfig.PortID, pathAToB.EndpointA.ChannelID, originalCoins, suite.chainA.SenderAccount.GetAddress().String(), suite.chainB.SenderAccount.GetAddress().String(), timeoutHeight, 0, "", nil)
res, err := suite.chainA.SendMsgs(msg)
suite.Require().NoError(err) // message committed

Expand Down Expand Up @@ -120,7 +120,7 @@ func (suite *TransferTestSuite) TestHandleMsgTransfer() {
traceBToC := types.NewHop(pathBToC.EndpointB.ChannelConfig.PortID, pathBToC.EndpointB.ChannelID)

// send from chainB to chainC
msg = types.NewMsgTransfer(pathBToC.EndpointA.ChannelConfig.PortID, pathBToC.EndpointA.ChannelID, coinsSentFromAToB, suite.chainB.SenderAccount.GetAddress().String(), suite.chainC.SenderAccount.GetAddress().String(), timeoutHeight, 0, "", types.Forwarding{})
msg = types.NewMsgTransfer(pathBToC.EndpointA.ChannelConfig.PortID, pathBToC.EndpointA.ChannelID, coinsSentFromAToB, suite.chainB.SenderAccount.GetAddress().String(), suite.chainC.SenderAccount.GetAddress().String(), timeoutHeight, 0, "", nil)
res, err = suite.chainB.SendMsgs(msg)
suite.Require().NoError(err) // message committed

Expand Down Expand Up @@ -149,7 +149,7 @@ func (suite *TransferTestSuite) TestHandleMsgTransfer() {
}

// send from chainC back to chainB
msg = types.NewMsgTransfer(pathBToC.EndpointB.ChannelConfig.PortID, pathBToC.EndpointB.ChannelID, coinsSentFromBToC, suite.chainC.SenderAccount.GetAddress().String(), suite.chainB.SenderAccount.GetAddress().String(), timeoutHeight, 0, "", types.Forwarding{})
msg = types.NewMsgTransfer(pathBToC.EndpointB.ChannelConfig.PortID, pathBToC.EndpointB.ChannelID, coinsSentFromBToC, suite.chainC.SenderAccount.GetAddress().String(), suite.chainB.SenderAccount.GetAddress().String(), timeoutHeight, 0, "", nil)
res, err = suite.chainC.SendMsgs(msg)
suite.Require().NoError(err) // message committed

Expand Down
4 changes: 2 additions & 2 deletions modules/apps/transfer/types/forwarding.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
const MaximumNumberOfForwardingHops = 8 // denotes the maximum number of forwarding hops allowed

// NewForwarding creates a new Forwarding instance given an unwind value and a variable number of hops.
func NewForwarding(unwind bool, hops ...Hop) Forwarding {
return Forwarding{
func NewForwarding(unwind bool, hops ...Hop) *Forwarding {
return &Forwarding{
Unwind: unwind,
Hops: hops,
}
Expand Down
2 changes: 1 addition & 1 deletion modules/apps/transfer/types/forwarding_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var validHop = types.NewHop(types.PortID, ibctesting.FirstChannelID)
func TestForwarding_Validate(t *testing.T) {
tests := []struct {
name string
forwarding types.Forwarding
forwarding *types.Forwarding
expError error
}{
{
Expand Down
Loading
Loading