Skip to content

Commit

Permalink
tests(transfer): remove denom trace usage from relay_tests. (#6507)
Browse files Browse the repository at this point in the history
Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
  • Loading branch information
DimitrisJim and colin-axner authored Jun 5, 2024
1 parent cf2a3de commit 14cfc6d
Showing 1 changed file with 21 additions and 25 deletions.
46 changes: 21 additions & 25 deletions modules/apps/transfer/keeper/relay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -616,20 +616,21 @@ func (suite *KeeperTestSuite) TestOnRecvPacketSetsTotalEscrowAmountForSourceIBCT
path2 := ibctesting.NewTransferPath(suite.chainA, suite.chainB)
path2.Setup()

// denomTrace path: {transfer/channel-1/transfer/channel-0}
denomTrace := types.DenomTrace{
BaseDenom: sdk.DefaultBondDenom,
Path: fmt.Sprintf("%s/%s/%s/%s", path2.EndpointA.ChannelConfig.PortID, path2.EndpointA.ChannelID, path1.EndpointB.ChannelConfig.PortID, path1.EndpointB.ChannelID),
}
// denom path: {transfer/channel-1/transfer/channel-0}
denom := types.NewDenom(
sdk.DefaultBondDenom,
types.NewTrace(path2.EndpointA.ChannelConfig.PortID, path2.EndpointA.ChannelID),
types.NewTrace(path1.EndpointB.ChannelConfig.PortID, path1.EndpointB.ChannelID),
)

denom := types.ExtractDenomFromPath(denomTrace.GetFullDenomPath())
data := types.NewFungibleTokenPacketDataV2(
[]types.Token{
{
Denom: denom,
Amount: amount.String(),
},
}, suite.chainA.SenderAccount.GetAddress().String(), suite.chainB.SenderAccount.GetAddress().String(), "")

packet := channeltypes.NewPacket(
data.GetBytes(),
seq,
Expand All @@ -641,13 +642,14 @@ func (suite *KeeperTestSuite) TestOnRecvPacketSetsTotalEscrowAmountForSourceIBCT
)

// fund escrow account for transfer and channel-1 on chain B
// denomTrace path: transfer/channel-0
denomTrace = types.DenomTrace{
BaseDenom: sdk.DefaultBondDenom,
Path: fmt.Sprintf("%s/%s", path1.EndpointB.ChannelConfig.PortID, path1.EndpointB.ChannelID),
}
// denom path: transfer/channel-0
denom = types.NewDenom(
sdk.DefaultBondDenom,
types.NewTrace(path1.EndpointB.ChannelConfig.PortID, path1.EndpointB.ChannelID),
)

escrowAddress := types.GetEscrowAddress(path2.EndpointB.ChannelConfig.PortID, path2.EndpointB.ChannelID)
coin := sdk.NewCoin(denomTrace.IBCDenom(), amount)
coin := sdk.NewCoin(denom.IBCDenom(), amount)
suite.Require().NoError(
banktestutil.FundAccount(
suite.chainB.GetContext(),
Expand Down Expand Up @@ -830,13 +832,11 @@ func (suite *KeeperTestSuite) TestOnAcknowledgementPacketSetsTotalEscrowAmountFo
path2.Setup()

// fund escrow account for transfer and channel-1 on chain B
// denomTrace path = transfer/channel-0
denomTrace := types.DenomTrace{
BaseDenom: sdk.DefaultBondDenom,
Path: fmt.Sprintf("%s/%s", path1.EndpointB.ChannelConfig.PortID, path1.EndpointB.ChannelID),
}
// denom path: transfer/channel-0
denom := types.NewDenom(sdk.DefaultBondDenom, types.NewTrace(path1.EndpointB.ChannelConfig.PortID, path1.EndpointB.ChannelID))

escrowAddress := types.GetEscrowAddress(path2.EndpointB.ChannelConfig.PortID, path2.EndpointB.ChannelID)
coin := sdk.NewCoin(denomTrace.IBCDenom(), amount)
coin := sdk.NewCoin(denom.IBCDenom(), amount)
suite.Require().NoError(
banktestutil.FundAccount(
suite.chainB.GetContext(),
Expand All @@ -846,7 +846,6 @@ func (suite *KeeperTestSuite) TestOnAcknowledgementPacketSetsTotalEscrowAmountFo
),
)

denom := types.ExtractDenomFromPath(denomTrace.GetFullDenomPath())
data := types.NewFungibleTokenPacketDataV2(
[]types.Token{
{
Expand Down Expand Up @@ -1063,12 +1062,10 @@ func (suite *KeeperTestSuite) TestOnTimeoutPacketSetsTotalEscrowAmountForSourceI
path2.Setup()

// fund escrow account for transfer and channel-1 on chain B
denomTrace := types.DenomTrace{
BaseDenom: sdk.DefaultBondDenom,
Path: fmt.Sprintf("%s/%s", path1.EndpointB.ChannelConfig.PortID, path1.EndpointB.ChannelID),
}
denom := types.NewDenom(sdk.DefaultBondDenom, types.NewTrace(path1.EndpointB.ChannelConfig.PortID, path1.EndpointB.ChannelID))

escrowAddress := types.GetEscrowAddress(path2.EndpointB.ChannelConfig.PortID, path2.EndpointB.ChannelID)
coin := sdk.NewCoin(denomTrace.IBCDenom(), amount)
coin := sdk.NewCoin(denom.IBCDenom(), amount)
suite.Require().NoError(
banktestutil.FundAccount(
suite.chainB.GetContext(),
Expand All @@ -1078,7 +1075,6 @@ func (suite *KeeperTestSuite) TestOnTimeoutPacketSetsTotalEscrowAmountForSourceI
),
)

denom := types.ExtractDenomFromPath(denomTrace.GetFullDenomPath())
data := types.NewFungibleTokenPacketDataV2(
[]types.Token{
{
Expand Down

0 comments on commit 14cfc6d

Please sign in to comment.