x/params: remove alias.go usage (#6415)

This commit is contained in:
dauTT 2020-06-12 15:52:04 +02:00 committed by GitHub
parent 55a7226535
commit 3228c3b12a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 54 deletions

View File

@ -33,6 +33,8 @@ import (
"github.com/cosmos/cosmos-sdk/x/mint"
"github.com/cosmos/cosmos-sdk/x/params"
paramsclient "github.com/cosmos/cosmos-sdk/x/params/client"
paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper"
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
paramproposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal"
"github.com/cosmos/cosmos-sdk/x/slashing"
"github.com/cosmos/cosmos-sdk/x/staking"
@ -109,7 +111,7 @@ type SimApp struct {
memKeys map[string]*sdk.MemoryStoreKey
// subspaces
subspaces map[string]params.Subspace
subspaces map[string]paramstypes.Subspace
// keepers
AccountKeeper auth.AccountKeeper
@ -122,7 +124,7 @@ type SimApp struct {
GovKeeper gov.Keeper
CrisisKeeper crisis.Keeper
UpgradeKeeper upgradekeeper.Keeper
ParamsKeeper params.Keeper
ParamsKeeper paramskeeper.Keeper
IBCKeeper *ibc.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly
EvidenceKeeper evidence.Keeper
TransferKeeper transfer.Keeper
@ -154,10 +156,10 @@ func NewSimApp(
keys := sdk.NewKVStoreKeys(
auth.StoreKey, bank.StoreKey, staking.StoreKey,
mint.StoreKey, distr.StoreKey, slashing.StoreKey,
gov.StoreKey, params.StoreKey, ibc.StoreKey, upgradetypes.StoreKey,
gov.StoreKey, paramstypes.StoreKey, ibc.StoreKey, upgradetypes.StoreKey,
evidence.StoreKey, transfer.StoreKey, capability.StoreKey,
)
tkeys := sdk.NewTransientStoreKeys(params.TStoreKey)
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey)
memKeys := sdk.NewMemoryStoreKeys(capability.MemStoreKey)
app := &SimApp{
@ -168,11 +170,11 @@ func NewSimApp(
keys: keys,
tkeys: tkeys,
memKeys: memKeys,
subspaces: make(map[string]params.Subspace),
subspaces: make(map[string]paramstypes.Subspace),
}
// init params keeper and subspaces
app.ParamsKeeper = params.NewKeeper(appCodec, keys[params.StoreKey], tkeys[params.TStoreKey])
app.ParamsKeeper = paramskeeper.NewKeeper(appCodec, keys[paramstypes.StoreKey], tkeys[paramstypes.TStoreKey])
app.subspaces[auth.ModuleName] = app.ParamsKeeper.Subspace(auth.DefaultParamspace)
app.subspaces[bank.ModuleName] = app.ParamsKeeper.Subspace(bank.DefaultParamspace)
app.subspaces[staking.ModuleName] = app.ParamsKeeper.Subspace(staking.DefaultParamspace)
@ -464,7 +466,7 @@ func (app *SimApp) GetMemKey(storeKey string) *sdk.MemoryStoreKey {
// GetSubspace returns a param subspace for a given module name.
//
// NOTE: This is solely to be used for testing purposes.
func (app *SimApp) GetSubspace(moduleName string) params.Subspace {
func (app *SimApp) GetSubspace(moduleName string) paramstypes.Subspace {
return app.subspaces[moduleName]
}

View File

@ -4,7 +4,7 @@ import (
abci "github.com/tendermint/tendermint/abci/types"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/x/params"
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
)
// ConsensusParamsKeyTable returns an x/params module keyTable to be used in
@ -12,15 +12,15 @@ import (
// standard validation functions. Applications can choose to adopt this KeyTable
// or provider their own when the existing validation functions do not suite their
// needs.
func ConsensusParamsKeyTable() params.KeyTable {
return params.NewKeyTable(
params.NewParamSetPair(
func ConsensusParamsKeyTable() paramstypes.KeyTable {
return paramstypes.NewKeyTable(
paramstypes.NewParamSetPair(
baseapp.ParamStoreKeyBlockParams, abci.BlockParams{}, baseapp.ValidateBlockParams,
),
params.NewParamSetPair(
paramstypes.NewParamSetPair(
baseapp.ParamStoreKeyEvidenceParams, abci.EvidenceParams{}, baseapp.ValidateEvidenceParams,
),
params.NewParamSetPair(
paramstypes.NewParamSetPair(
baseapp.ParamStoreKeyValidatorParams, abci.ValidatorParams{}, baseapp.ValidateValidatorParams,
),
)

View File

@ -1,35 +0,0 @@
package params
import (
"github.com/cosmos/cosmos-sdk/x/params/keeper"
"github.com/cosmos/cosmos-sdk/x/params/types"
)
const (
StoreKey = types.StoreKey
TStoreKey = types.TStoreKey
ModuleName = types.ModuleName
QuerierRoute = types.QuerierRoute
)
var (
// functions aliases
NewKeeper = keeper.NewKeeper
NewParamSetPair = types.NewParamSetPair
NewKeyTable = types.NewKeyTable
NewQuerySubspaceParams = types.NewQuerySubspaceParams
NewQuerier = keeper.NewQuerier
NewSubspaceParamsResponse = types.NewSubspaceParamsResponse
)
type (
Keeper = keeper.Keeper
ParamSetPair = types.ParamSetPair
ParamSetPairs = types.ParamSetPairs
ParamSet = types.ParamSet
Subspace = types.Subspace
ReadOnlySubspace = types.ReadOnlySubspace
KeyTable = types.KeyTable
QuerySubspaceParams = types.QuerySubspaceParams
SubspaceParamsResponse = types.SubspaceParamsResponse
)

View File

@ -12,11 +12,13 @@ import (
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/types"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
"github.com/cosmos/cosmos-sdk/x/params/keeper"
"github.com/cosmos/cosmos-sdk/x/params/simulation"
"github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/cosmos/cosmos-sdk/x/params/types/proposal"
)
@ -56,7 +58,7 @@ func (AppModuleBasic) GetTxCmd(_ client.Context) *cobra.Command { return nil }
// GetQueryCmd returns no root query command for the params module.
func (AppModuleBasic) GetQueryCmd(clientCtx client.Context) *cobra.Command { return nil }
func (am AppModuleBasic) RegisterInterfaceTypes(registry types.InterfaceRegistry) {
func (am AppModuleBasic) RegisterInterfaceTypes(registry codectypes.InterfaceRegistry) {
proposal.RegisterInterfaces(registry)
}
@ -66,11 +68,11 @@ func (am AppModuleBasic) RegisterInterfaceTypes(registry types.InterfaceRegistry
type AppModule struct {
AppModuleBasic
keeper Keeper
keeper keeper.Keeper
}
// NewAppModule creates a new AppModule object
func NewAppModule(k Keeper) AppModule {
func NewAppModule(k keeper.Keeper) AppModule {
return AppModule{
AppModuleBasic: AppModuleBasic{},
keeper: k,
@ -90,11 +92,11 @@ func (AppModule) Route() sdk.Route { return sdk.Route{} }
func (AppModule) GenerateGenesisState(simState *module.SimulationState) {}
// QuerierRoute returns the x/param module's querier route name.
func (AppModule) QuerierRoute() string { return QuerierRoute }
func (AppModule) QuerierRoute() string { return types.QuerierRoute }
// NewQuerierHandler returns the x/params querier handler.
func (am AppModule) NewQuerierHandler() sdk.Querier {
return NewQuerier(am.keeper)
return keeper.NewQuerier(am.keeper)
}
func (am AppModule) RegisterQueryService(grpc.Server) {}