Move some Param types from Keeper to Types in staking (#6451)
This commit is contained in:
parent
76ee9b29ac
commit
c134e8974e
|
@ -63,6 +63,7 @@ older clients.
|
|||
|
||||
### API Breaking Changes
|
||||
|
||||
* (x/staking) [\#6451](https://github.com/cosmos/cosmos-sdk/pull/6451) `DefaultParamspace` and `ParamKeyTable` in staking module are moved from keeper to types to enforce consistency.
|
||||
* [\#6409](https://github.com/cosmos/cosmos-sdk/pull/6409) Rename all IsEmpty methods to Empty across the codebase and enforce consistency.
|
||||
* [\#6231](https://github.com/cosmos/cosmos-sdk/pull/6231) Simplify `AppModule` interface, `Route` and `NewHandler` methods become only `Route`
|
||||
and returns a new `Route` type.
|
||||
|
|
|
@ -204,7 +204,7 @@ func NewSimApp(
|
|||
app.ParamsKeeper = paramskeeper.NewKeeper(appCodec, keys[paramstypes.StoreKey], tkeys[paramstypes.TStoreKey])
|
||||
app.subspaces[auth.ModuleName] = app.ParamsKeeper.Subspace(auth.DefaultParamspace)
|
||||
app.subspaces[banktypes.ModuleName] = app.ParamsKeeper.Subspace(banktypes.DefaultParamspace)
|
||||
app.subspaces[stakingtypes.ModuleName] = app.ParamsKeeper.Subspace(stakingkeeper.DefaultParamspace)
|
||||
app.subspaces[stakingtypes.ModuleName] = app.ParamsKeeper.Subspace(stakingtypes.DefaultParamspace)
|
||||
app.subspaces[minttypes.ModuleName] = app.ParamsKeeper.Subspace(minttypes.DefaultParamspace)
|
||||
app.subspaces[distrtypes.ModuleName] = app.ParamsKeeper.Subspace(distrtypes.DefaultParamspace)
|
||||
app.subspaces[slashingtypes.ModuleName] = app.ParamsKeeper.Subspace(slashingtypes.DefaultParamspace)
|
||||
|
|
|
@ -39,7 +39,7 @@ func NewKeeper(
|
|||
) Keeper {
|
||||
// set KeyTable if it has not already been set
|
||||
if !ps.HasKeyTable() {
|
||||
ps = ps.WithKeyTable(ParamKeyTable())
|
||||
ps = ps.WithKeyTable(types.ParamKeyTable())
|
||||
}
|
||||
|
||||
// ensure bonded and not bonded module accounts are set
|
||||
|
|
|
@ -4,20 +4,9 @@ import (
|
|||
"time"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/staking/types"
|
||||
)
|
||||
|
||||
// Default parameter namespace
|
||||
const (
|
||||
DefaultParamspace = types.ModuleName
|
||||
)
|
||||
|
||||
// ParamTable for staking module
|
||||
func ParamKeyTable() paramtypes.KeyTable {
|
||||
return paramtypes.NewKeyTable().RegisterParamSet(&types.Params{})
|
||||
}
|
||||
|
||||
// UnbondingTime
|
||||
func (k Keeper) UnbondingTime(ctx sdk.Context) (res time.Duration) {
|
||||
k.paramstore.Get(ctx, types.KeyUnbondingTime, &res)
|
||||
|
|
|
@ -15,6 +15,9 @@ import (
|
|||
|
||||
// Staking params default values
|
||||
const (
|
||||
// Default parameter namespace
|
||||
DefaultParamspace = ModuleName
|
||||
|
||||
// DefaultUnbondingTime reflects three weeks in seconds as the default
|
||||
// unbonding time.
|
||||
// TODO: Justify our choice of default here.
|
||||
|
@ -42,6 +45,11 @@ var (
|
|||
|
||||
var _ paramtypes.ParamSet = (*Params)(nil)
|
||||
|
||||
// ParamTable for staking module
|
||||
func ParamKeyTable() paramtypes.KeyTable {
|
||||
return paramtypes.NewKeyTable().RegisterParamSet(&Params{})
|
||||
}
|
||||
|
||||
// NewParams creates a new Params instance
|
||||
func NewParams(unbondingTime time.Duration, maxValidators, maxEntries, historicalEntries uint32, bondDenom string) Params {
|
||||
return Params{
|
||||
|
|
Loading…
Reference in New Issue