Skip to content

Commit

Permalink
x/params: remove alias.go usage (#6415)
Browse files Browse the repository at this point in the history
  • Loading branch information
dauTT authored Jun 12, 2020
1 parent 55a7226 commit 3228c3b
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 54 deletions.
16 changes: 9 additions & 7 deletions simapp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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{
Expand All @@ -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)
Expand Down Expand Up @@ -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]
}

Expand Down
12 changes: 6 additions & 6 deletions std/consensus_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@ 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
// the BaseApp's ParamStore. The KeyTable registers the types along with the
// 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,
),
)
Expand Down
35 changes: 0 additions & 35 deletions x/params/alias.go

This file was deleted.

14 changes: 8 additions & 6 deletions x/params/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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)
}

Expand All @@ -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,
Expand All @@ -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) {}
Expand Down

0 comments on commit 3228c3b

Please sign in to comment.