Skip to content

Commit

Permalink
minor: remove unused test
Browse files Browse the repository at this point in the history
  • Loading branch information
vuong177 committed May 30, 2023
1 parent 06a81f5 commit bf07110
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 114 deletions.
2 changes: 1 addition & 1 deletion x/mint/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func BeginBlocker(ctx sdk.Context, k keeper.Keeper, ic types.InflationCalculatio
// send the minted coins to the fee collector account
err := k.AddCollectedFees(ctx, mintedCoins)
if err != nil {
return
k.Logger(ctx).Info("Not enough incentive tokens in the mint pool to distribute")
}

if mintedCoin.Amount.IsInt64() {
Expand Down
113 changes: 0 additions & 113 deletions x/transfermiddleware/relay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,119 +12,6 @@ import (
"github.com/stretchr/testify/suite"
)

func (suite *TransferMiddlewareTestSuite) TestSendTransfer() {
var (
transferAmount = sdk.NewInt(1000000000)
// when transfer via sdk transfer from A (module) -> B (contract)
timeoutHeight = clienttypes.NewHeight(1, 110)
pathAtoB *customibctesting.Path
pathCtoB *customibctesting.Path
path *customibctesting.Path
srcPort string
srcChannel string
chain *customibctesting.TestChain
expDenom string
// pathBtoC = NewTransferPath(suite.chainB, suite.chainC)
)

testCases := []struct {
name string
malleate func()
}{
{
"Receiver is Parachain chain",
func() {
path = pathAtoB
srcPort = pathAtoB.EndpointB.ChannelConfig.PortID
srcChannel = pathAtoB.EndpointB.ChannelID
chain = suite.chainA
expDenom = sdk.DefaultBondDenom
},
},
{
"Receiver is cosmos chain chain",
func() {
path = pathCtoB
srcPort = pathCtoB.EndpointB.ChannelConfig.PortID
srcChannel = pathCtoB.EndpointB.ChannelID
chain = suite.chainC
expDenom = "ibc/C053D637CCA2A2BA030E2C5EE1B28A16F71CCB0E45E8BE52766DC1B241B77878"
},
},
}
for _, tc := range testCases {
suite.Run(tc.name, func() {
suite.SetupTest()
pathAtoB = NewTransferPath(suite.chainA, suite.chainB)
suite.coordinator.Setup(pathAtoB)
pathCtoB = NewTransferPath(suite.chainC, suite.chainB)
suite.coordinator.Setup(pathCtoB)
// Add parachain token info
chainBtransMiddleware := suite.chainB.TransferMiddleware()
err := chainBtransMiddleware.AddParachainIBCInfo(suite.chainB.GetContext(), "ibc/C053D637CCA2A2BA030E2C5EE1B28A16F71CCB0E45E8BE52766DC1B241B77878", pathAtoB.EndpointB.ChannelID, sdk.DefaultBondDenom)
suite.Require().NoError(err)
// send coin from A to B

msg := ibctransfertypes.NewMsgTransfer(
pathAtoB.EndpointA.ChannelConfig.PortID,
pathAtoB.EndpointA.ChannelID,
sdk.NewCoin(sdk.DefaultBondDenom, transferAmount),
suite.chainA.SenderAccount.GetAddress().String(),
suite.chainB.SenderAccount.GetAddress().String(),
timeoutHeight,
0,
"",
)
_, err = suite.chainA.SendMsgs(msg)
suite.Require().NoError(err)
suite.Require().NoError(err, pathAtoB.EndpointB.UpdateClient())

// then
suite.Require().Equal(1, len(suite.chainA.PendingSendPackets))
suite.Require().Equal(0, len(suite.chainB.PendingSendPackets))

// and when relay to chain A and handle Ack on chain B
err = suite.coordinator.RelayAndAckPendingPackets(pathAtoB)
suite.Require().NoError(err)

// then
suite.Require().Equal(0, len(suite.chainA.PendingSendPackets))
suite.Require().Equal(0, len(suite.chainB.PendingSendPackets))

tc.malleate()

testAcc2 := RandomAccountAddress(suite.T())
msg = ibctransfertypes.NewMsgTransfer(
srcPort,
srcChannel,
sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(500000)),
suite.chainB.SenderAccount.GetAddress().String(),
testAcc2.String(),
timeoutHeight,
0,
"",
)
_, err = suite.chainB.SendMsgs(msg)
suite.Require().NoError(err)
suite.Require().NoError(err, path.EndpointB.UpdateClient())

suite.Require().Equal(1, len(suite.chainB.PendingSendPackets))
suite.Require().Equal(0, len(chain.PendingSendPackets))

// and when relay to chain B and handle Ack on chain A
err = suite.coordinator.RelayAndAckPendingPacketsReverse(path)
suite.Require().NoError(err)

suite.Require().Equal(0, len(suite.chainB.PendingSendPackets))
suite.Require().Equal(0, len(chain.PendingSendPackets))

balance := chain.AllBalances(testAcc2)
expBalance := sdk.NewCoins(sdk.NewCoin(expDenom, sdk.NewInt(500000)))
suite.Require().Equal(expBalance, balance)
})
}
}

// TODO: use testsuite here.
func (suite *TransferMiddlewareTestSuite) TestOnrecvPacket() {
var (
Expand Down

0 comments on commit bf07110

Please sign in to comment.