Skip to content

Commit

Permalink
rename from voucherDenom to denom
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Rodriguez committed Jun 3, 2024
1 parent 8d85bbc commit b201934
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
14 changes: 7 additions & 7 deletions modules/apps/callbacks/replay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,8 @@ func (s *CallbacksTestSuite) TestTransferRecvPacketReplayProtection() {
}

// save initial balance of receiver
voucherDenom := transfertypes.NewDenom(sdk.DefaultBondDenom, transfertypes.NewTrace(s.path.EndpointB.ChannelConfig.PortID, s.path.EndpointB.ChannelID))
initialBalance := GetSimApp(s.chainB).BankKeeper.GetBalance(s.chainB.GetContext(), s.chainB.SenderAccount.GetAddress(), voucherDenom.IBCDenom())
denom := transfertypes.NewDenom(sdk.DefaultBondDenom, transfertypes.NewTrace(s.path.EndpointB.ChannelConfig.PortID, s.path.EndpointB.ChannelID))
initialBalance := GetSimApp(s.chainB).BankKeeper.GetBalance(s.chainB.GetContext(), s.chainB.SenderAccount.GetAddress(), denom.IBCDenom())

// execute the transfer
s.ExecuteTransfer(tc.transferMemo)
Expand All @@ -296,9 +296,9 @@ func (s *CallbacksTestSuite) TestTransferRecvPacketReplayProtection() {
s.Require().Equal(1, callbackCount)

// expected is not a malicious amount
expBalance := initialBalance.Add(sdk.NewCoin(voucherDenom.IBCDenom(), ibctesting.TestCoin.Amount))
expBalance := initialBalance.Add(sdk.NewCoin(denom.IBCDenom(), ibctesting.TestCoin.Amount))

afterBalance := GetSimApp(s.chainB).BankKeeper.GetBalance(s.chainB.GetContext(), s.chainB.SenderAccount.GetAddress(), voucherDenom.IBCDenom())
afterBalance := GetSimApp(s.chainB).BankKeeper.GetBalance(s.chainB.GetContext(), s.chainB.SenderAccount.GetAddress(), denom.IBCDenom())

s.Require().Equal(expBalance.Amount, afterBalance.Amount)
})
Expand All @@ -319,8 +319,8 @@ func (s *CallbacksTestSuite) ExecuteFailedTransfer(memo string) {
// record the balance of the escrow address before the transfer
escrowBalance := GetSimApp(s.chainA).BankKeeper.GetBalance(s.chainA.GetContext(), escrowAddress, sdk.DefaultBondDenom)
// record the balance of the receiving address before the transfer
voucherDenom := transfertypes.NewDenom(sdk.DefaultBondDenom, transfertypes.NewTrace(s.path.EndpointB.ChannelConfig.PortID, s.path.EndpointB.ChannelID))
receiverBalance := GetSimApp(s.chainB).BankKeeper.GetBalance(s.chainB.GetContext(), s.chainB.SenderAccount.GetAddress(), voucherDenom.IBCDenom())
denom := transfertypes.NewDenom(sdk.DefaultBondDenom, transfertypes.NewTrace(s.path.EndpointB.ChannelConfig.PortID, s.path.EndpointB.ChannelID))
receiverBalance := GetSimApp(s.chainB).BankKeeper.GetBalance(s.chainB.GetContext(), s.chainB.SenderAccount.GetAddress(), denom.IBCDenom())

amount := ibctesting.TestCoin
msg := transfertypes.NewMsgTransfer(
Expand All @@ -347,5 +347,5 @@ func (s *CallbacksTestSuite) ExecuteFailedTransfer(memo string) {
// check that the escrow address balance hasn't changed
s.Require().Equal(escrowBalance, GetSimApp(s.chainA).BankKeeper.GetBalance(s.chainA.GetContext(), escrowAddress, sdk.DefaultBondDenom))
// check that the receiving address balance hasn't changed
s.Require().Equal(receiverBalance, GetSimApp(s.chainB).BankKeeper.GetBalance(s.chainB.GetContext(), s.chainB.SenderAccount.GetAddress(), voucherDenom.IBCDenom()))
s.Require().Equal(receiverBalance, GetSimApp(s.chainB).BankKeeper.GetBalance(s.chainB.GetContext(), s.chainB.SenderAccount.GetAddress(), denom.IBCDenom()))
}
6 changes: 3 additions & 3 deletions modules/apps/callbacks/transfer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ func (s *CallbacksTestSuite) ExecuteTransfer(memo string) {
// record the balance of the escrow address before the transfer
escrowBalance := GetSimApp(s.chainA).BankKeeper.GetBalance(s.chainA.GetContext(), escrowAddress, sdk.DefaultBondDenom)
// record the balance of the receiving address before the transfer
voucherDenom := transfertypes.NewDenom(sdk.DefaultBondDenom, transfertypes.NewTrace(s.path.EndpointB.ChannelConfig.PortID, s.path.EndpointB.ChannelID))
receiverBalance := GetSimApp(s.chainB).BankKeeper.GetBalance(s.chainB.GetContext(), s.chainB.SenderAccount.GetAddress(), voucherDenom.IBCDenom())
denom := transfertypes.NewDenom(sdk.DefaultBondDenom, transfertypes.NewTrace(s.path.EndpointB.ChannelConfig.PortID, s.path.EndpointB.ChannelID))
receiverBalance := GetSimApp(s.chainB).BankKeeper.GetBalance(s.chainB.GetContext(), s.chainB.SenderAccount.GetAddress(), denom.IBCDenom())

amount := ibctesting.TestCoin
msg := transfertypes.NewMsgTransfer(
Expand All @@ -210,7 +210,7 @@ func (s *CallbacksTestSuite) ExecuteTransfer(memo string) {
// check that the escrow address balance increased by 100
s.Require().Equal(escrowBalance.Add(amount), GetSimApp(s.chainA).BankKeeper.GetBalance(s.chainA.GetContext(), escrowAddress, sdk.DefaultBondDenom))
// check that the receiving address balance increased by 100
s.Require().Equal(receiverBalance.AddAmount(sdkmath.NewInt(100)), GetSimApp(s.chainB).BankKeeper.GetBalance(s.chainB.GetContext(), s.chainB.SenderAccount.GetAddress(), voucherDenom.IBCDenom()))
s.Require().Equal(receiverBalance.AddAmount(sdkmath.NewInt(100)), GetSimApp(s.chainB).BankKeeper.GetBalance(s.chainB.GetContext(), s.chainB.SenderAccount.GetAddress(), denom.IBCDenom()))
}

// ExecuteTransferTimeout executes a transfer message on chainA for 100 denom.
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 @@ -263,8 +263,8 @@ func (suite *KeeperTestSuite) TestSendTransferSetsTotalEscrowAmountForSourceIBCT
suite.Require().NoError(err)

// execute
voucherDenom := types.NewDenom(sdk.DefaultBondDenom, types.NewTrace(path1.EndpointB.ChannelConfig.PortID, path1.EndpointB.ChannelID))
coin = sdk.NewCoin(voucherDenom.IBCDenom(), sdkmath.NewInt(100))
denom := types.NewDenom(sdk.DefaultBondDenom, types.NewTrace(path1.EndpointB.ChannelConfig.PortID, path1.EndpointB.ChannelID))
coin = sdk.NewCoin(denom.IBCDenom(), sdkmath.NewInt(100))
msg := types.NewMsgTransfer(
path2.EndpointB.ChannelConfig.PortID,
path2.EndpointB.ChannelID,
Expand Down

0 comments on commit b201934

Please sign in to comment.