From 2d3e55dcaa06181310c8a988a227a97ea09c0827 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?colin=20axn=C3=A9r?= <25233464+colin-axner@users.noreply.github.com> Date: Wed, 31 Aug 2022 11:52:27 +0200 Subject: [PATCH] fix: partial revert of #1942 (#2148) ## Description See https://github.com/cosmos/interchain-accounts-demo/issues/129 Adding mock module account in chain setup was assuming that the `NewTestChain` func was using a SimApp() which custom apps do not. Proper way to fund mock module at chain startup for us would be via modifying the default genesis (though we would need to modify the existing SetupChainWithGenesis to not assume the default auth/bank genesis is empty. I decided to take the easier route of just fixing the one test case using the mock module balance closes: #XXXX --- Before we can merge this PR, please make sure that all the following items have been checked off. If any of the checklist items are not applicable, please leave them but write a little note why. - [ ] Targeted PR against correct branch (see [CONTRIBUTING.md](https://github.com/cosmos/ibc-go/blob/master/CONTRIBUTING.md#pr-targeting)) - [ ] Linked to Github issue with discussion and accepted design OR link to spec that describes this work. - [ ] Code follows the [module structure standards](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules/structure.md). - [ ] Wrote unit and integration [tests](https://github.com/cosmos/ibc-go/blob/master/CONTRIBUTING.md#testing) - [ ] Updated relevant documentation (`docs/`) or specification (`x//spec/`) - [ ] Added relevant `godoc` [comments](https://blog.golang.org/godoc-documenting-go-code). - [ ] Added a relevant changelog entry to the `Unreleased` section in `CHANGELOG.md` - [ ] Re-reviewed `Files changed` in the Github PR explorer - [ ] Review `Codecov Report` in the comment section below once CI passes --- CHANGELOG.md | 1 - modules/apps/29-fee/keeper/msg_server_test.go | 1 + testing/chain.go | 10 ---------- 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5abb0cba86f..3646daf806e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -131,7 +131,6 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Improvements -* (testing) [\#1942](https://github.com/cosmos/ibc-go/pull/1942) Add a balance for the mock module account upon testing package initialization. * (app/20-transfer) [\#1680](https://github.com/cosmos/ibc-go/pull/1680) Adds migration to correct any malformed trace path information of tokens with denoms that contains slashes. The transfer module consensus version has been bumped to 2. * (app/20-transfer) [\#1730](https://github.com/cosmos/ibc-go/pull/1730) parse the ics20 denomination provided via a packet using the channel identifier format specified by ibc-go. * (cleanup) [\#1335](https://github.com/cosmos/ibc-go/pull/1335/) `gofumpt -w -l .` to standardize the code layout more strictly than `go fmt ./...` diff --git a/modules/apps/29-fee/keeper/msg_server_test.go b/modules/apps/29-fee/keeper/msg_server_test.go index bb28c1153f9..2623f1b2e5b 100644 --- a/modules/apps/29-fee/keeper/msg_server_test.go +++ b/modules/apps/29-fee/keeper/msg_server_test.go @@ -200,6 +200,7 @@ func (suite *KeeperTestSuite) TestPayPacketFee() { { "refund account is module account", func() { + suite.chainA.GetSimApp().BankKeeper.SendCoinsFromAccountToModule(suite.chainA.GetContext(), suite.chainA.SenderAccount.GetAddress(), ibcmock.ModuleName, fee.Total()) msg.Signer = suite.chainA.GetSimApp().AccountKeeper.GetModuleAddress(ibcmock.ModuleName).String() expPacketFee := types.NewPacketFee(fee, msg.Signer, nil) expFeesInEscrow = []types.PacketFee{expPacketFee} diff --git a/testing/chain.go b/testing/chain.go index 3cd574b4268..f86e4d0c19f 100644 --- a/testing/chain.go +++ b/testing/chain.go @@ -120,12 +120,6 @@ func NewTestChainWithValSet(t *testing.T, coord *Coordinator, chainID string, va senderAccs = append(senderAccs, senderAcc) } - // add mock module account balance - genBals = append(genBals, banktypes.Balance{ - Address: authtypes.NewModuleAddress(mock.ModuleName).String(), - Coins: sdk.Coins{sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(1000000000))}, - }) - app := SetupWithGenesisValSet(t, valSet, genAccs, chainID, sdk.DefaultPowerReduction, genBals...) // create current header and call begin block @@ -155,10 +149,6 @@ func NewTestChainWithValSet(t *testing.T, coord *Coordinator, chainID string, va SenderAccounts: senderAccs, } - // creates mock module account - mockModuleAcc := chain.GetSimApp().AccountKeeper.GetModuleAccount(chain.GetContext(), mock.ModuleName) - require.NotNil(t, mockModuleAcc) - coord.CommitBlock(chain) return chain