Skip to content

Commit

Permalink
fix: partial revert of #1942 (backport #2148) (#2152)
Browse files Browse the repository at this point in the history
* fix: partial revert of #1942 (#2148)

## Description

See cosmos/interchain-accounts-demo#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/<module>/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 2d3e55d)

# Conflicts:
#	CHANGELOG.md

* fix merge conflicts

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
  • Loading branch information
mergify[bot] and colin-axner committed Aug 31, 2022
1 parent 37aa2eb commit b3a624f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
1 change: 1 addition & 0 deletions modules/apps/29-fee/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
10 changes: 0 additions & 10 deletions testing/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b3a624f

Please sign in to comment.