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 all commits
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 @@ -156,7 +156,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
4 changes: 2 additions & 2 deletions modules/apps/transfer/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ 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)
}

if msg.Forwarding.Unwind {
if msg.Forwarding.GetUnwind() {
msg, err = k.unwindHops(ctx, msg)
if err != nil {
return nil, err
Expand All @@ -45,7 +45,7 @@ func (k Keeper) Transfer(goCtx context.Context, msg *types.MsgTransfer) (*types.

sequence, err := k.sendTransfer(
ctx, msg.SourcePort, msg.SourceChannel, coins, sender, msg.Receiver, msg.TimeoutHeight, msg.TimeoutTimestamp,
msg.Memo, msg.Forwarding.Hops)
msg.Memo, msg.Forwarding.GetHops())
if err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions modules/apps/transfer/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,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 @@ -159,7 +159,7 @@ func (suite *KeeperTestSuite) TestMsgTransfer() {
tokensBz, err := json.Marshal(types.Tokens(tokens))
suite.Require().NoError(err)

forwardingHopsBz, err := json.Marshal(msg.Forwarding.Hops)
forwardingHopsBz, err := json.Marshal(msg.Forwarding.GetHops())
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
6 changes: 3 additions & 3 deletions modules/apps/transfer/types/forwarding.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ 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,
}
}

// Validate performs a basic validation of the Forwarding fields.
func (f Forwarding) Validate() error {
if err := validateHops(f.Hops); err != nil {
if err := validateHops(f.GetHops()); err != nil {
return errorsmod.Wrapf(ErrInvalidForwarding, "invalid hops in forwarding")
}

Expand Down
Loading
Loading