Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: clean-up app config #14454

Merged
merged 1 commit into from
Dec 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions baseapp/block_gas_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
"github.com/cosmos/cosmos-sdk/runtime"
store "github.com/cosmos/cosmos-sdk/store/types"
"github.com/cosmos/cosmos-sdk/testutil/configurator"
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
"github.com/cosmos/cosmos-sdk/testutil/testdata"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -80,9 +81,14 @@ func TestBaseApp_BlockGas(t *testing.T) {
err error
)

appConfig := depinject.Configs(makeTestConfig())

err = depinject.Inject(appConfig,
err = depinject.Inject(configurator.NewAppConfig(
configurator.AuthModule(),
configurator.TxModule(),
configurator.ParamsModule(),
configurator.ConsensusModule(),
configurator.BankModule(),
configurator.StakingModule(),
),
&bankKeeper,
&accountKeeper,
&interfaceRegistry,
Expand Down
88 changes: 0 additions & 88 deletions baseapp/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,6 @@ import (

runtimev1alpha1 "cosmossdk.io/api/cosmos/app/runtime/v1alpha1"
appv1alpha1 "cosmossdk.io/api/cosmos/app/v1alpha1"
authmodulev1 "cosmossdk.io/api/cosmos/auth/module/v1"
bankmodulev1 "cosmossdk.io/api/cosmos/bank/module/v1"
consensusmodulev1 "cosmossdk.io/api/cosmos/consensus/module/v1"
mintmodulev1 "cosmossdk.io/api/cosmos/mint/module/v1"
paramsmodulev1 "cosmossdk.io/api/cosmos/params/module/v1"
stakingmodulev1 "cosmossdk.io/api/cosmos/staking/module/v1"
txconfigv1 "cosmossdk.io/api/cosmos/tx/config/v1"
"cosmossdk.io/core/appconfig"
"cosmossdk.io/depinject"
dbm "github.com/cosmos/cosmos-db"
Expand Down Expand Up @@ -52,10 +45,8 @@ import (
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
_ "github.com/cosmos/cosmos-sdk/x/consensus"
_ "github.com/cosmos/cosmos-sdk/x/mint"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
_ "github.com/cosmos/cosmos-sdk/x/params"
_ "github.com/cosmos/cosmos-sdk/x/staking"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
)

var ParamStoreKey = []byte("paramstore")
Expand Down Expand Up @@ -99,85 +90,6 @@ func GenesisStateWithSingleValidator(t *testing.T, codec codec.Codec, builder *r
return genesisState
}

func makeTestConfig() depinject.Config {
return appconfig.Compose(&appv1alpha1.Config{
Modules: []*appv1alpha1.ModuleConfig{
{
Name: "runtime",
Config: appconfig.WrapAny(&runtimev1alpha1.Module{
AppName: "BaseAppApp",
BeginBlockers: []string{
"mint",
"staking",
"auth",
"bank",
"params",
"consensus",
},
EndBlockers: []string{
"staking",
"auth",
"bank",
"mint",
"params",
"consensus",
},
OverrideStoreKeys: []*runtimev1alpha1.StoreKeyConfig{
{
ModuleName: "auth",
KvStoreKey: "acc",
},
},
InitGenesis: []string{
"auth",
"bank",
"staking",
"mint",
"params",
"consensus",
},
}),
},
{
Name: "auth",
Config: appconfig.WrapAny(&authmodulev1.Module{
Bech32Prefix: "cosmos",
ModuleAccountPermissions: []*authmodulev1.ModuleAccountPermission{
{Account: authtypes.FeeCollectorName},
{Account: minttypes.ModuleName, Permissions: []string{authtypes.Minter}},
{Account: stakingtypes.BondedPoolName, Permissions: []string{authtypes.Burner, stakingtypes.ModuleName}},
{Account: stakingtypes.NotBondedPoolName, Permissions: []string{authtypes.Burner, stakingtypes.ModuleName}},
},
}),
},
{
Name: "bank",
Config: appconfig.WrapAny(&bankmodulev1.Module{}),
},
{
Name: "params",
Config: appconfig.WrapAny(&paramsmodulev1.Module{}),
},
{
Name: "staking",
Config: appconfig.WrapAny(&stakingmodulev1.Module{}),
},
{
Name: "mint",
Config: appconfig.WrapAny(&mintmodulev1.Module{}),
},
{
Name: "consensus",
Config: appconfig.WrapAny(&consensusmodulev1.Module{}),
},
{
Name: "tx",
Config: appconfig.WrapAny(&txconfigv1.Config{}),
},
},
})
}

func makeMinimalConfig() depinject.Config {
var mempoolOpt runtime.BaseAppOption = baseapp.SetMempool(mempool.NewSenderNonceMempool())
return depinject.Configs(
Expand Down
28 changes: 9 additions & 19 deletions x/auth/testutil/app_config.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package testutil

import (
_ "github.com/cosmos/cosmos-sdk/x/auth" // import auth as a blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import auth as a blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/auth/vesting" // import vesting as a blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/bank" // import bank as a blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/consensus" // import consensus as a blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/feegrant/module" // import feegrant as a blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/genutil" // import genutil as a blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/params" // import params as a blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/staking" // import staking as a blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/auth" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/auth/vesting" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/bank" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/consensus" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/feegrant/module" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/genutil" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/params" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/staking" // import as blank for app wiring

"cosmossdk.io/core/appconfig"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
Expand Down Expand Up @@ -43,23 +43,13 @@ var AppConfig = appconfig.Compose(&appv1alpha1.Config{
AppName: "AuthApp",
BeginBlockers: []string{
stakingtypes.ModuleName,
authtypes.ModuleName,
banktypes.ModuleName,
genutiltypes.ModuleName,
feegrant.ModuleName,
paramstypes.ModuleName,
consensustypes.ModuleName,
vestingtypes.ModuleName,
},
EndBlockers: []string{
stakingtypes.ModuleName,
authtypes.ModuleName,
banktypes.ModuleName,
genutiltypes.ModuleName,
feegrant.ModuleName,
paramstypes.ModuleName,
consensustypes.ModuleName,
vestingtypes.ModuleName,
},
InitGenesis: []string{
authtypes.ModuleName,
Expand Down
30 changes: 10 additions & 20 deletions x/authz/testutil/app_config.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package testutil

import (
_ "github.com/cosmos/cosmos-sdk/x/auth" // import auth as a blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import auth tx config as a blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/authz/module" // import authz as a blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/bank" // import bank as a blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/consensus" // import consensus as a blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/genutil" // import genutil as a blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/gov" // import gov as a blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/mint" // import mint as a blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/params" // import params as a blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/staking" // import staking as a blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/auth" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/authz/module" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/bank" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/consensus" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/genutil" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/gov" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/mint" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/params" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/staking" // import as blank for app wiring

txconfigv1 "cosmossdk.io/api/cosmos/tx/config/v1"
"cosmossdk.io/core/appconfig"
Expand Down Expand Up @@ -45,22 +45,12 @@ var AppConfig = appconfig.Compose(&appv1alpha1.Config{
BeginBlockers: []string{
minttypes.ModuleName,
stakingtypes.ModuleName,
authtypes.ModuleName,
banktypes.ModuleName,
genutiltypes.ModuleName,
authz.ModuleName,
paramstypes.ModuleName,
consensustypes.ModuleName,
},
EndBlockers: []string{
minttypes.ModuleName,
stakingtypes.ModuleName,
authtypes.ModuleName,
banktypes.ModuleName,
genutiltypes.ModuleName,
authz.ModuleName,
paramstypes.ModuleName,
consensustypes.ModuleName,
},
InitGenesis: []string{
authtypes.ModuleName,
Expand Down
25 changes: 8 additions & 17 deletions x/capability/testutil/app_config.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package testutil

import (
_ "github.com/cosmos/cosmos-sdk/x/auth" // import auth as a blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import auth tx config as a blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/bank" // import bank as a blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/capability" // import capability as a blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/consensus" // import consensus as a blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/genutil" // import genutil as a blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/params" // import params as a blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/staking" // import staking as a blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/auth" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/bank" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/capability" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/consensus" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/genutil" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/params" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/staking" // import as blank for app wiring

"cosmossdk.io/core/appconfig"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
Expand Down Expand Up @@ -40,20 +40,11 @@ var AppConfig = appconfig.Compose(&appv1alpha1.Config{
BeginBlockers: []string{
capabilitytypes.ModuleName,
stakingtypes.ModuleName,
authtypes.ModuleName,
banktypes.ModuleName,
genutiltypes.ModuleName,
paramstypes.ModuleName,
consensustypes.ModuleName,
},
EndBlockers: []string{
stakingtypes.ModuleName,
capabilitytypes.ModuleName,
authtypes.ModuleName,
banktypes.ModuleName,
genutiltypes.ModuleName,
paramstypes.ModuleName,
consensustypes.ModuleName,
},
InitGenesis: []string{
capabilitytypes.ModuleName,
Expand Down
28 changes: 9 additions & 19 deletions x/distribution/testutil/app_config.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package testutil

import (
_ "github.com/cosmos/cosmos-sdk/x/auth" // import auth as a blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import auth tx config as a blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/bank" // import bank as a blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/consensus" // import consensus as a blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/distribution" // import distribution as a blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/genutil" // import genutil as a blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/mint" // import mint as a blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/params" // import params as a blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/staking" // import staking as a blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/auth" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/bank" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/consensus" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/distribution" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/genutil" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/mint" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/params" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/staking" // import as blank for app wiring

"cosmossdk.io/core/appconfig"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
Expand Down Expand Up @@ -44,21 +44,11 @@ var AppConfig = appconfig.Compose(&appv1alpha1.Config{
minttypes.ModuleName,
distrtypes.ModuleName,
stakingtypes.ModuleName,
authtypes.ModuleName,
banktypes.ModuleName,
genutiltypes.ModuleName,
paramstypes.ModuleName,
consensustypes.ModuleName,
},
EndBlockers: []string{
stakingtypes.ModuleName,
authtypes.ModuleName,
banktypes.ModuleName,
distrtypes.ModuleName,
minttypes.ModuleName,
genutiltypes.ModuleName,
paramstypes.ModuleName,
consensustypes.ModuleName,
},
InitGenesis: []string{
authtypes.ModuleName,
Expand Down
28 changes: 9 additions & 19 deletions x/evidence/testutil/app_config.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package testutil

import (
_ "github.com/cosmos/cosmos-sdk/x/auth" // import auth as a blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import auth tx config as a blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/bank" // import bank as a blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/consensus" // import consensus as a blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/evidence" // import evidence as a blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/genutil" // import genutil as a blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/params" // import params as a blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/slashing" // import slashing as a blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/staking" // import staking as a blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/auth" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/bank" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/consensus" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/evidence" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/genutil" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/params" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/slashing" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/staking" // import as blank for app wiring

"cosmossdk.io/core/appconfig"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
Expand Down Expand Up @@ -45,21 +45,11 @@ var AppConfig = appconfig.Compose(&appv1alpha1.Config{
slashingtypes.ModuleName,
evidencetypes.ModuleName,
stakingtypes.ModuleName,
authtypes.ModuleName,
banktypes.ModuleName,
genutiltypes.ModuleName,
paramstypes.ModuleName,
consensustypes.ModuleName,
},
EndBlockers: []string{
stakingtypes.ModuleName,
authtypes.ModuleName,
banktypes.ModuleName,
slashingtypes.ModuleName,
genutiltypes.ModuleName,
evidencetypes.ModuleName,
paramstypes.ModuleName,
consensustypes.ModuleName,
},
InitGenesis: []string{
authtypes.ModuleName,
Expand Down
Loading