Skip to content

Commit

Permalink
chore: rename ForwardingInfo to Forwarding
Browse files Browse the repository at this point in the history
  • Loading branch information
damiannolan committed Jun 12, 2024
1 parent ec472cf commit e483b9a
Show file tree
Hide file tree
Showing 13 changed files with 146 additions and 153 deletions.
20 changes: 9 additions & 11 deletions e2e/testsuite/testsuite.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 (
Expand Down Expand Up @@ -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"))
}
Expand Down
2 changes: 1 addition & 1 deletion modules/apps/transfer/keeper/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
12 changes: 5 additions & 7 deletions modules/apps/transfer/keeper/relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
}
Expand Down Expand Up @@ -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:
Expand Down
11 changes: 5 additions & 6 deletions modules/apps/transfer/keeper/relay_forwarding_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 1 addition & 2 deletions modules/apps/transfer/types/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion modules/apps/transfer/types/packet.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func NewFungibleTokenPacketDataV2(
tokens []Token,
sender, receiver string,
memo string,
forwardingPath *ForwardingInfo,
forwardingPath *Forwarding,
) FungibleTokenPacketDataV2 {
return FungibleTokenPacketDataV2{
Tokens: tokens,
Expand Down
56 changes: 28 additions & 28 deletions modules/apps/transfer/types/packet.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions modules/apps/transfer/types/packet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ func TestFungibleTokenPacketDataV2ValidateBasic(t *testing.T) {
sender,
receiver,
"",
&types.ForwardingInfo{
&types.Forwarding{
Hops: []*types.Hop{
{
PortId: "transfer",
Expand Down Expand Up @@ -399,7 +399,7 @@ func TestFungibleTokenPacketDataV2ValidateBasic(t *testing.T) {
sender,
receiver,
"memo",
&types.ForwardingInfo{
&types.Forwarding{
Hops: []*types.Hop{
{
PortId: "transfer",
Expand Down
Loading

0 comments on commit e483b9a

Please sign in to comment.