Merge pull request from GHSA-mvm6-gfm2-89xj
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
This commit is contained in:
parent
0e3ff45380
commit
e73cf2b410
@ -130,11 +130,6 @@ var (
|
||||
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
|
||||
govtypes.ModuleName: {authtypes.Burner},
|
||||
}
|
||||
|
||||
// module accounts that are allowed to receive tokens
|
||||
allowedReceivingModAcc = map[string]bool{
|
||||
distrtypes.ModuleName: true,
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
@ -242,7 +237,7 @@ func NewSimApp(
|
||||
appCodec, keys[authtypes.StoreKey], app.GetSubspace(authtypes.ModuleName), authtypes.ProtoBaseAccount, maccPerms,
|
||||
)
|
||||
app.BankKeeper = bankkeeper.NewBaseKeeper(
|
||||
appCodec, keys[banktypes.StoreKey], app.AccountKeeper, app.GetSubspace(banktypes.ModuleName), app.BlockedAddrs(),
|
||||
appCodec, keys[banktypes.StoreKey], app.AccountKeeper, app.GetSubspace(banktypes.ModuleName), app.ModuleAccountAddrs(),
|
||||
)
|
||||
stakingKeeper := stakingkeeper.NewKeeper(
|
||||
appCodec, keys[stakingtypes.StoreKey], app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName),
|
||||
@ -444,17 +439,6 @@ func (app *SimApp) ModuleAccountAddrs() map[string]bool {
|
||||
return modAccAddrs
|
||||
}
|
||||
|
||||
// BlockedAddrs returns all the app's module account addresses that are not
|
||||
// allowed to receive external tokens.
|
||||
func (app *SimApp) BlockedAddrs() map[string]bool {
|
||||
blockedAddrs := make(map[string]bool)
|
||||
for acc := range maccPerms {
|
||||
blockedAddrs[authtypes.NewModuleAddress(acc).String()] = !allowedReceivingModAcc[acc]
|
||||
}
|
||||
|
||||
return blockedAddrs
|
||||
}
|
||||
|
||||
// LegacyAmino returns SimApp's amino codec.
|
||||
//
|
||||
// NOTE: This is solely to be used for testing purposes as it may be desirable
|
||||
|
||||
@ -38,8 +38,11 @@ func TestSimAppExportAndBlockedAddrs(t *testing.T) {
|
||||
app := NewSimApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, map[int64]bool{}, DefaultNodeHome, 0, encCfg, EmptyAppOptions{})
|
||||
|
||||
for acc := range maccPerms {
|
||||
require.Equal(t, !allowedReceivingModAcc[acc], app.BankKeeper.BlockedAddr(app.AccountKeeper.GetModuleAddress(acc)),
|
||||
"ensure that blocked addresses are properly set in bank keeper")
|
||||
require.True(
|
||||
t,
|
||||
app.BankKeeper.BlockedAddr(app.AccountKeeper.GetModuleAddress(acc)),
|
||||
"ensure that blocked addresses are properly set in bank keeper",
|
||||
)
|
||||
}
|
||||
|
||||
genesisState := NewDefaultGenesisState(encCfg.Marshaler)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user