refactor: don't use simapp.AppConfig outside simapp (#14328)

This commit is contained in:
Julien Robert 2022-12-16 07:42:00 +01:00 committed by GitHub
parent cbee1b3ea1
commit c824809168
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 21 deletions

View File

@ -52,7 +52,7 @@ func BenchmarkFullAppSimulation(b *testing.B) {
AppStateFn(app.AppCodec(), app.SimulationManager()),
simtypes.RandomAccounts, // Replace with own random account function if using keys other than secp256k1
simtestutil.SimulationOperations(app, app.AppCodec(), config),
ModuleAccountAddrs(),
BlockedAddresses(),
config,
app.AppCodec(),
)
@ -107,7 +107,7 @@ func BenchmarkInvariants(b *testing.B) {
AppStateFn(app.AppCodec(), app.SimulationManager()),
simtypes.RandomAccounts, // Replace with own random account function if using keys other than secp256k1
simtestutil.SimulationOperations(app, app.AppCodec(), config),
ModuleAccountAddrs(),
BlockedAddresses(),
config,
app.AppCodec(),
)

View File

@ -95,7 +95,7 @@ func TestFullAppSimulation(t *testing.T) {
AppStateFn(app.AppCodec(), app.SimulationManager()),
simtypes.RandomAccounts, // Replace with own random account function if using keys other than secp256k1
simtestutil.SimulationOperations(app, app.AppCodec(), config),
ModuleAccountAddrs(),
BlockedAddresses(),
config,
app.AppCodec(),
)
@ -140,7 +140,7 @@ func TestAppImportExport(t *testing.T) {
AppStateFn(app.AppCodec(), app.SimulationManager()),
simtypes.RandomAccounts, // Replace with own random account function if using keys other than secp256k1
simtestutil.SimulationOperations(app, app.AppCodec(), config),
ModuleAccountAddrs(),
BlockedAddresses(),
config,
app.AppCodec(),
)
@ -257,7 +257,7 @@ func TestAppSimulationAfterImport(t *testing.T) {
AppStateFn(app.AppCodec(), app.SimulationManager()),
simtypes.RandomAccounts, // Replace with own random account function if using keys other than secp256k1
simtestutil.SimulationOperations(app, app.AppCodec(), config),
ModuleAccountAddrs(),
BlockedAddresses(),
config,
app.AppCodec(),
)
@ -305,7 +305,7 @@ func TestAppSimulationAfterImport(t *testing.T) {
AppStateFn(app.AppCodec(), app.SimulationManager()),
simtypes.RandomAccounts, // Replace with own random account function if using keys other than secp256k1
simtestutil.SimulationOperations(newApp, newApp.AppCodec(), config),
ModuleAccountAddrs(),
BlockedAddresses(),
config,
app.AppCodec(),
)
@ -360,7 +360,7 @@ func TestAppStateDeterminism(t *testing.T) {
AppStateFn(app.AppCodec(), app.SimulationManager()),
simtypes.RandomAccounts, // Replace with own random account function if using keys other than secp256k1
simtestutil.SimulationOperations(app, app.AppCodec(), config),
ModuleAccountAddrs(),
BlockedAddresses(),
config,
app.AppCodec(),
)

View File

@ -14,7 +14,6 @@ import (
tmtypes "github.com/tendermint/tendermint/types"
dbm "github.com/tendermint/tm-db"
"cosmossdk.io/depinject"
"cosmossdk.io/math"
bam "github.com/cosmos/cosmos-sdk/baseapp"
@ -29,7 +28,6 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module/testutil"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
)
@ -217,18 +215,6 @@ func initAccountWithCoins(app *SimApp, ctx sdk.Context, addr sdk.AccAddress, coi
}
}
// ModuleAccountAddrs provides a list of blocked module accounts from configuration in AppConfig
//
// Ported from SimApp
func ModuleAccountAddrs() map[string]bool {
var bk bankkeeper.Keeper
err := depinject.Inject(AppConfig, &bk)
if err != nil {
panic("unable to load DI container")
}
return bk.GetBlockedAddresses()
}
// NewTestNetworkFixture returns a new simapp AppConstructor for network simulation tests
func NewTestNetworkFixture() network.TestFixture {
dir, err := os.MkdirTemp("", "simapp")