Merge PR #105: Fix Module Account Blacklisting in GaiaApp

This commit is contained in:
colin axner
2019-08-15 15:30:10 -07:00
committed by Alexander Bezobchuk
parent 72a5f93310
commit 5cad07140d
2 changed files with 12 additions and 2 deletions

View File

@@ -256,7 +256,7 @@ func (app *GaiaApp) LoadHeight(height int64) error {
func (app *GaiaApp) ModuleAccountAddrs() map[string]bool { func (app *GaiaApp) ModuleAccountAddrs() map[string]bool {
modAccAddrs := make(map[string]bool) modAccAddrs := make(map[string]bool)
for acc := range maccPerms { for acc := range maccPerms {
modAccAddrs[app.supplyKeeper.GetModuleAddress(acc).String()] = true modAccAddrs[supply.NewModuleAddress(acc).String()] = true
} }
return modAccAddrs return modAccAddrs

View File

@@ -5,8 +5,8 @@ import (
"testing" "testing"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/tendermint/tm-db"
"github.com/tendermint/tendermint/libs/log" "github.com/tendermint/tendermint/libs/log"
"github.com/tendermint/tm-db"
"github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/simapp" "github.com/cosmos/cosmos-sdk/simapp"
@@ -25,6 +25,16 @@ func TestGaiadExport(t *testing.T) {
require.NoError(t, err, "ExportAppStateAndValidators should not have an error") require.NoError(t, err, "ExportAppStateAndValidators should not have an error")
} }
// ensure that black listed addresses are properly set in bank keeper
func TestBlackListedAddrs(t *testing.T) {
db := db.NewMemDB()
app := NewGaiaApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, 0)
for acc := range maccPerms {
require.True(t, app.bankKeeper.BlacklistedAddr(app.supplyKeeper.GetModuleAddress(acc)))
}
}
func setGenesis(gapp *GaiaApp) error { func setGenesis(gapp *GaiaApp) error {
genesisState := simapp.NewDefaultGenesisState() genesisState := simapp.NewDefaultGenesisState()