From b3a624fe70b9d789578762bfde9be9ca5c0435db Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 31 Aug 2022 16:41:49 +0200 Subject: [PATCH] fix: partial revert of #1942 (backport #2148) (#2152) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 (cherry picked from commit 2d3e55dcaa06181310c8a988a227a97ea09c0827) # Conflicts: # CHANGELOG.md * fix merge conflicts Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com> --- modules/apps/29-fee/keeper/msg_server_test.go | 1 + testing/chain.go | 10 ---------- 2 files changed, 1 insertion(+), 10 deletions(-) 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 581923cd549..9a6d8263d45 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