diff --git a/x/ccv/consumer/keeper/keeper.go b/x/ccv/consumer/keeper/keeper.go index 84167e61f8..c476db718d 100644 --- a/x/ccv/consumer/keeper/keeper.go +++ b/x/ccv/consumer/keeper/keeper.go @@ -39,7 +39,6 @@ type Keeper struct { storeKey storetypes.StoreKey // TODO: maybe needs to be removed? storeService store.KVStoreService cdc codec.BinaryCodec - paramStore paramtypes.Subspace scopedKeeper ccv.ScopedKeeper channelKeeper ccv.ChannelKeeper portKeeper ccv.PortKeeper @@ -83,7 +82,6 @@ func NewKeeper( authority: authority, storeKey: key, cdc: cdc, - paramStore: paramSpace, scopedKeeper: scopedKeeper, channelKeeper: channelKeeper, portKeeper: portKeeper, @@ -108,9 +106,8 @@ func NewKeeper( // Used only in testing. func NewNonZeroKeeper(cdc codec.BinaryCodec, key storetypes.StoreKey, paramSpace paramtypes.Subspace) Keeper { return Keeper{ - storeKey: key, - cdc: cdc, - paramStore: paramSpace, + storeKey: key, + cdc: cdc, } } @@ -120,18 +117,12 @@ func (k *Keeper) SetStandaloneStakingKeeper(sk ccv.StakingKeeper) { k.standaloneStakingKeeper = sk } -// SetParamSpace sets the param space for the consumer keeper. -// Note: this is only used for testing! -func (k *Keeper) SetParamSpace(ctx sdk.Context, ps paramtypes.Subspace) { - k.paramStore = ps -} - // Validates that the consumer keeper is initialized with non-zero and // non-nil values for all its fields. Otherwise this method will panic. func (k Keeper) mustValidateFields() { // Ensures no fields are missed in this validation // TODO: @MSalopek hangle this better - if reflect.ValueOf(k).NumField() != 20 { + if reflect.ValueOf(k).NumField() != 19 { panic(fmt.Sprintf("number of fields in consumer keeper is not 19 - have %d", reflect.ValueOf(k).NumField())) // incorrect number } @@ -139,26 +130,25 @@ func (k Keeper) mustValidateFields() { panic("validator and/or consensus address codec are nil") } - // Note 17 / 20 fields will be validated, + // Note 16 / 19 fields will be validated, // hooks are explicitly set after the constructor, // stakingKeeper is optionally set after the constructor, ccv.PanicIfZeroOrNil(k.storeKey, "storeKey") // 1 ccv.PanicIfZeroOrNil(k.cdc, "cdc") // 2 - ccv.PanicIfZeroOrNil(k.paramStore, "paramStore") // 3 - ccv.PanicIfZeroOrNil(k.scopedKeeper, "scopedKeeper") // 4 - ccv.PanicIfZeroOrNil(k.channelKeeper, "channelKeeper") // 5 - ccv.PanicIfZeroOrNil(k.portKeeper, "portKeeper") // 6 - ccv.PanicIfZeroOrNil(k.connectionKeeper, "connectionKeeper") // 7 - ccv.PanicIfZeroOrNil(k.clientKeeper, "clientKeeper") // 8 - ccv.PanicIfZeroOrNil(k.slashingKeeper, "slashingKeeper") // 9 - ccv.PanicIfZeroOrNil(k.bankKeeper, "bankKeeper") // 10 - ccv.PanicIfZeroOrNil(k.authKeeper, "authKeeper") // 11 - ccv.PanicIfZeroOrNil(k.ibcTransferKeeper, "ibcTransferKeeper") // 12 - ccv.PanicIfZeroOrNil(k.ibcCoreKeeper, "ibcCoreKeeper") // 13 - ccv.PanicIfZeroOrNil(k.feeCollectorName, "feeCollectorName") // 14 - ccv.PanicIfZeroOrNil(k.authority, "authority") // 15 - ccv.PanicIfZeroOrNil(k.validatorAddressCodec, "validatorAddressCodec") // 16 - ccv.PanicIfZeroOrNil(k.consensusAddressCodec, "consensusAddressCodec") // 17 + ccv.PanicIfZeroOrNil(k.scopedKeeper, "scopedKeeper") // 3 + ccv.PanicIfZeroOrNil(k.channelKeeper, "channelKeeper") // 4 + ccv.PanicIfZeroOrNil(k.portKeeper, "portKeeper") // 5 + ccv.PanicIfZeroOrNil(k.connectionKeeper, "connectionKeeper") // 6 + ccv.PanicIfZeroOrNil(k.clientKeeper, "clientKeeper") // 7 + ccv.PanicIfZeroOrNil(k.slashingKeeper, "slashingKeeper") // 8 + ccv.PanicIfZeroOrNil(k.bankKeeper, "bankKeeper") // 9 + ccv.PanicIfZeroOrNil(k.authKeeper, "authKeeper") // 10 + ccv.PanicIfZeroOrNil(k.ibcTransferKeeper, "ibcTransferKeeper") // 11 + ccv.PanicIfZeroOrNil(k.ibcCoreKeeper, "ibcCoreKeeper") // 12 + ccv.PanicIfZeroOrNil(k.feeCollectorName, "feeCollectorName") // 13 + ccv.PanicIfZeroOrNil(k.authority, "authority") // 14 + ccv.PanicIfZeroOrNil(k.validatorAddressCodec, "validatorAddressCodec") // 15 + ccv.PanicIfZeroOrNil(k.consensusAddressCodec, "consensusAddressCodec") // 16 } // Logger returns a module-specific logger. diff --git a/x/ccv/consumer/keeper/params.go b/x/ccv/consumer/keeper/params.go index 9bd0d1fa10..ce680e4860 100644 --- a/x/ccv/consumer/keeper/params.go +++ b/x/ccv/consumer/keeper/params.go @@ -2,36 +2,34 @@ package keeper import ( "context" + "fmt" "time" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/cosmos/interchain-security/v3/x/ccv/consumer/types" ccvtypes "github.com/cosmos/interchain-security/v3/x/ccv/types" ) // GetParams returns the params for the consumer ccv module // NOTE: it is different from the GetParams method which is required to implement StakingKeeper interface func (k Keeper) GetConsumerParams(ctx sdk.Context) ccvtypes.Params { - return ccvtypes.NewParams( - k.GetEnabled(ctx), - k.GetBlocksPerDistributionTransmission(ctx), - k.GetDistributionTransmissionChannel(ctx), - k.GetProviderFeePoolAddrStr(ctx), - k.GetCCVTimeoutPeriod(ctx), - k.GetTransferTimeoutPeriod(ctx), - k.GetConsumerRedistributionFrac(ctx), - k.GetHistoricalEntries(ctx), - k.GetUnbondingPeriod(ctx), - k.GetSoftOptOutThreshold(ctx), - k.GetRewardDenoms(ctx), - k.GetProviderRewardDenoms(ctx), - ) + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.ParametersKey()) + var params ccvtypes.Params + err := k.cdc.Unmarshal(bz, ¶ms) + if err != nil { + panic(fmt.Sprintf("error unmarshalling module parameters: %v:", err)) + } + return params } // SetParams sets the paramset for the consumer module func (k Keeper) SetParams(ctx sdk.Context, params ccvtypes.Params) { - k.paramStore.SetParamSet(ctx, ¶ms) + store := ctx.KVStore(k.storeKey) + bz := k.cdc.MustMarshal(¶ms) + store.Set(types.ParametersKey(), bz) } // GetParams implements StakingKeeper GetParams interface method @@ -44,98 +42,94 @@ func (k Keeper) GetParams(context.Context) (stakingtypes.Params, error) { // GetEnabled returns the enabled flag for the consumer module func (k Keeper) GetEnabled(ctx sdk.Context) bool { - var enabled bool - k.paramStore.Get(ctx, ccvtypes.KeyEnabled, &enabled) - return enabled + params := k.GetConsumerParams(ctx) + return params.Enabled } func (k Keeper) GetBlocksPerDistributionTransmission(ctx sdk.Context) int64 { - var bpdt int64 - k.paramStore.Get(ctx, ccvtypes.KeyBlocksPerDistributionTransmission, &bpdt) - return bpdt + params := k.GetConsumerParams(ctx) + return params.BlocksPerDistributionTransmission } func (k Keeper) SetBlocksPerDistributionTransmission(ctx sdk.Context, bpdt int64) { - k.paramStore.Set(ctx, ccvtypes.KeyBlocksPerDistributionTransmission, bpdt) + params := k.GetConsumerParams(ctx) + params.BlocksPerDistributionTransmission = bpdt + k.SetParams(ctx, params) } func (k Keeper) GetDistributionTransmissionChannel(ctx sdk.Context) string { - var s string - k.paramStore.Get(ctx, ccvtypes.KeyDistributionTransmissionChannel, &s) - return s + params := k.GetConsumerParams(ctx) + return params.DistributionTransmissionChannel } func (k Keeper) SetDistributionTransmissionChannel(ctx sdk.Context, channel string) { - k.paramStore.Set(ctx, ccvtypes.KeyDistributionTransmissionChannel, channel) + params := k.GetConsumerParams(ctx) + params.DistributionTransmissionChannel = channel + k.SetParams(ctx, params) } func (k Keeper) GetProviderFeePoolAddrStr(ctx sdk.Context) string { - var s string - k.paramStore.Get(ctx, ccvtypes.KeyProviderFeePoolAddrStr, &s) - return s + params := k.GetConsumerParams(ctx) + return params.ProviderFeePoolAddrStr } func (k Keeper) SetProviderFeePoolAddrStr(ctx sdk.Context, addr string) { - k.paramStore.Set(ctx, ccvtypes.KeyProviderFeePoolAddrStr, addr) + params := k.GetConsumerParams(ctx) + params.ProviderFeePoolAddrStr = addr + k.SetParams(ctx, params) } // GetCCVTimeoutPeriod returns the timeout period for sent ccv related ibc packets func (k Keeper) GetCCVTimeoutPeriod(ctx sdk.Context) time.Duration { - var p time.Duration - k.paramStore.Get(ctx, ccvtypes.KeyCCVTimeoutPeriod, &p) - return p + params := k.GetConsumerParams(ctx) + return params.CcvTimeoutPeriod } // GetTransferTimeoutPeriod returns the timeout period for sent transfer related ibc packets func (k Keeper) GetTransferTimeoutPeriod(ctx sdk.Context) time.Duration { - var p time.Duration - k.paramStore.Get(ctx, ccvtypes.KeyTransferTimeoutPeriod, &p) - return p + params := k.GetConsumerParams(ctx) + return params.TransferTimeoutPeriod } // GetConsumerRedistributionFrac returns the fraction of tokens allocated to the consumer redistribution // address during distribution events. The fraction is a string representing a // decimal number. For example "0.75" would represent 75%. func (k Keeper) GetConsumerRedistributionFrac(ctx sdk.Context) string { - var str string - k.paramStore.Get(ctx, ccvtypes.KeyConsumerRedistributionFrac, &str) - return str + params := k.GetConsumerParams(ctx) + return params.ConsumerRedistributionFraction } // GetHistoricalEntries returns the number of historical info entries to persist in store func (k Keeper) GetHistoricalEntries(ctx sdk.Context) int64 { - var n int64 - k.paramStore.Get(ctx, ccvtypes.KeyHistoricalEntries, &n) - return n + params := k.GetConsumerParams(ctx) + return params.HistoricalEntries } // Only used to set an unbonding period in diff tests func (k Keeper) SetUnbondingPeriod(ctx sdk.Context, period time.Duration) { - k.paramStore.Set(ctx, ccvtypes.KeyConsumerUnbondingPeriod, period) + params := k.GetConsumerParams(ctx) + params.UnbondingPeriod = period + k.SetParams(ctx, params) } func (k Keeper) GetUnbondingPeriod(ctx sdk.Context) time.Duration { - var period time.Duration - k.paramStore.Get(ctx, ccvtypes.KeyConsumerUnbondingPeriod, &period) - return period + params := k.GetConsumerParams(ctx) + return params.UnbondingPeriod } // GetSoftOptOutThreshold returns the percentage of validators at the bottom of the set // that can opt out of running the consumer chain func (k Keeper) GetSoftOptOutThreshold(ctx sdk.Context) string { - var str string - k.paramStore.Get(ctx, ccvtypes.KeySoftOptOutThreshold, &str) - return str + params := k.GetConsumerParams(ctx) + return params.SoftOptOutThreshold } func (k Keeper) GetRewardDenoms(ctx sdk.Context) []string { - var denoms []string - k.paramStore.Get(ctx, ccvtypes.KeyRewardDenoms, &denoms) - return denoms + params := k.GetConsumerParams(ctx) + return params.RewardDenoms } func (k Keeper) GetProviderRewardDenoms(ctx sdk.Context) []string { - var denoms []string - k.paramStore.Get(ctx, ccvtypes.KeyProviderRewardDenoms, &denoms) - return denoms + params := k.GetConsumerParams(ctx) + return params.ProviderRewardDenoms } diff --git a/x/ccv/provider/keeper/grpc_query.go b/x/ccv/provider/keeper/grpc_query.go index 189796738f..4e896525cc 100644 --- a/x/ccv/provider/keeper/grpc_query.go +++ b/x/ccv/provider/keeper/grpc_query.go @@ -42,10 +42,7 @@ func (k Keeper) QueryParams(goCtx context.Context, req *types.QueryParamsRequest } ctx := sdk.UnwrapSDKContext(goCtx) - params, err := k.GetParams(ctx) - if err != nil { - return nil, status.Error(codes.NotFound, "no parameters found") - } + params := k.GetParams(ctx) return &types.QueryParamsResponse{Params: params}, nil } diff --git a/x/ccv/provider/keeper/keeper.go b/x/ccv/provider/keeper/keeper.go index 996ce651cd..605cfc0fd9 100644 --- a/x/ccv/provider/keeper/keeper.go +++ b/x/ccv/provider/keeper/keeper.go @@ -42,7 +42,6 @@ type Keeper struct { storeService store.KVStoreService cdc codec.BinaryCodec - paramSpace paramtypes.Subspace scopedKeeper ccv.ScopedKeeper channelKeeper ccv.ChannelKeeper portKeeper ccv.PortKeeper @@ -79,7 +78,6 @@ func NewKeeper( cdc: cdc, storeKey: key, authority: authority, - paramSpace: paramSpace, scopedKeeper: scopedKeeper, channelKeeper: channelKeeper, portKeeper: portKeeper, @@ -114,19 +112,13 @@ func (k Keeper) ConsensusAddressCodec() addresscodec.Codec { return k.consensusAddressCodec } -// SetParamSpace sets the param space for the provider keeper. -// Note: this is only used for testing! -func (k *Keeper) SetParamSpace(ctx sdk.Context, ps paramtypes.Subspace) { - k.paramSpace = ps -} - // TODO: @MSalopek -> redo validation; some fields will be removed // Validates that the provider keeper is initialized with non-zero and // non-nil values for all its fields. Otherwise this method will panic. func (k Keeper) mustValidateFields() { // Ensures no fields are missed in this validation - if reflect.ValueOf(k).NumField() != 18 { - panic("number of fields in provider keeper is not 18") + if reflect.ValueOf(k).NumField() != 17 { + panic("number of fields in provider keeper is not 17") } // TODO: @MSalopek -> validate once connected and AccountKeeper interface is updated @@ -141,23 +133,22 @@ func (k Keeper) mustValidateFields() { ccv.PanicIfZeroOrNil(k.cdc, "cdc") // 1 ccv.PanicIfZeroOrNil(k.storeKey, "storeKey") // 2 - ccv.PanicIfZeroOrNil(k.paramSpace, "paramSpace") // 3 - ccv.PanicIfZeroOrNil(k.scopedKeeper, "scopedKeeper") // 4 - ccv.PanicIfZeroOrNil(k.channelKeeper, "channelKeeper") // 5 - ccv.PanicIfZeroOrNil(k.portKeeper, "portKeeper") // 6 - ccv.PanicIfZeroOrNil(k.connectionKeeper, "connectionKeeper") // 7 - ccv.PanicIfZeroOrNil(k.accountKeeper, "accountKeeper") // 8 - ccv.PanicIfZeroOrNil(k.clientKeeper, "clientKeeper") // 9 - ccv.PanicIfZeroOrNil(k.stakingKeeper, "stakingKeeper") // 10 - ccv.PanicIfZeroOrNil(k.slashingKeeper, "slashingKeeper") // 11 - ccv.PanicIfZeroOrNil(k.distributionKeeper, "distributionKeeper") // 12 - ccv.PanicIfZeroOrNil(k.bankKeeper, "bankKeeper") // 13 - ccv.PanicIfZeroOrNil(k.feeCollectorName, "feeCollectorName") // 14 - ccv.PanicIfZeroOrNil(k.authority, "authority") // 15 - ccv.PanicIfZeroOrNil(k.validatorAddressCodec, "validatorAddressCodec") // 16 - ccv.PanicIfZeroOrNil(k.consensusAddressCodec, "consensusAddressCodec") // 17 + ccv.PanicIfZeroOrNil(k.scopedKeeper, "scopedKeeper") // 3 + ccv.PanicIfZeroOrNil(k.channelKeeper, "channelKeeper") // 4 + ccv.PanicIfZeroOrNil(k.portKeeper, "portKeeper") // 5 + ccv.PanicIfZeroOrNil(k.connectionKeeper, "connectionKeeper") // 6 + ccv.PanicIfZeroOrNil(k.accountKeeper, "accountKeeper") // 7 + ccv.PanicIfZeroOrNil(k.clientKeeper, "clientKeeper") // 8 + ccv.PanicIfZeroOrNil(k.stakingKeeper, "stakingKeeper") // 9 + ccv.PanicIfZeroOrNil(k.slashingKeeper, "slashingKeeper") // 10 + ccv.PanicIfZeroOrNil(k.distributionKeeper, "distributionKeeper") // 11 + ccv.PanicIfZeroOrNil(k.bankKeeper, "bankKeeper") // 12 + ccv.PanicIfZeroOrNil(k.feeCollectorName, "feeCollectorName") // 13 + ccv.PanicIfZeroOrNil(k.authority, "authority") // 14 + ccv.PanicIfZeroOrNil(k.validatorAddressCodec, "validatorAddressCodec") // 15 + ccv.PanicIfZeroOrNil(k.consensusAddressCodec, "consensusAddressCodec") // 16 // TODO: @MSalopek -> validate once connected - // ccv.PanicIfZeroOrNil(k.storeService, "storeService") // 18 + // ccv.PanicIfZeroOrNil(k.storeService, "storeService") // 17 } // Logger returns a module-specific logger. diff --git a/x/ccv/provider/keeper/msg_server.go b/x/ccv/provider/keeper/msg_server.go index 2e8098cc5d..d96fd3dfb4 100644 --- a/x/ccv/provider/keeper/msg_server.go +++ b/x/ccv/provider/keeper/msg_server.go @@ -35,9 +35,7 @@ func (k msgServer) UpdateParams(goCtx context.Context, msg *types.MsgUpdateParam } ctx := sdk.UnwrapSDKContext(goCtx) - if err := k.Keeper.SetParams(ctx, msg.Params); err != nil { - return nil, err - } + k.Keeper.SetParams(ctx, msg.Params) return &types.MsgUpdateParamsResponse{}, nil } diff --git a/x/ccv/provider/keeper/params.go b/x/ccv/provider/keeper/params.go index a0bbc27679..5457465e88 100644 --- a/x/ccv/provider/keeper/params.go +++ b/x/ccv/provider/keeper/params.go @@ -1,6 +1,7 @@ package keeper import ( + "fmt" "time" ibctmtypes "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" @@ -8,100 +9,91 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/interchain-security/v3/x/ccv/provider/types" - ccvtypes "github.com/cosmos/interchain-security/v3/x/ccv/types" ) // GetTemplateClient returns the template client for provider proposals func (k Keeper) GetTemplateClient(ctx sdk.Context) *ibctmtypes.ClientState { - var cs ibctmtypes.ClientState - k.paramSpace.Get(ctx, types.KeyTemplateClient, &cs) - return &cs + params := k.GetParams(ctx) + return params.TemplateClient } // GetTrustingPeriodFraction returns a TrustingPeriodFraction // used to compute the provider IBC client's TrustingPeriod as UnbondingPeriod / TrustingPeriodFraction func (k Keeper) GetTrustingPeriodFraction(ctx sdk.Context) string { - var f string - k.paramSpace.Get(ctx, types.KeyTrustingPeriodFraction, &f) - return f + params := k.GetParams(ctx) + return params.TrustingPeriodFraction } // GetCCVTimeoutPeriod returns the timeout period for sent ibc packets func (k Keeper) GetCCVTimeoutPeriod(ctx sdk.Context) time.Duration { - var p time.Duration - k.paramSpace.Get(ctx, ccvtypes.KeyCCVTimeoutPeriod, &p) - return p + params := k.GetParams(ctx) + return params.CcvTimeoutPeriod } // GetInitTimeoutPeriod returns the init timeout period func (k Keeper) GetInitTimeoutPeriod(ctx sdk.Context) time.Duration { - var p time.Duration - k.paramSpace.Get(ctx, types.KeyInitTimeoutPeriod, &p) - return p + params := k.GetParams(ctx) + return params.InitTimeoutPeriod } // GetVscTimeoutPeriod returns the vsc timeout period func (k Keeper) GetVscTimeoutPeriod(ctx sdk.Context) time.Duration { - var p time.Duration - k.paramSpace.Get(ctx, types.KeyVscTimeoutPeriod, &p) - return p + params := k.GetParams(ctx) + return params.VscTimeoutPeriod } // SetVscTimeoutPeriod sets the vsc timeout period func (k Keeper) SetVscTimeoutPeriod(ctx sdk.Context, period time.Duration) { - k.paramSpace.Set(ctx, types.KeyVscTimeoutPeriod, period) + params := k.GetParams(ctx) + params.VscTimeoutPeriod = period + k.SetParams(ctx, params) } // GetSlashMeterReplenishPeriod returns the period in which: // Once the slash meter becomes not-full, the slash meter is replenished after this period. func (k Keeper) GetSlashMeterReplenishPeriod(ctx sdk.Context) time.Duration { - var p time.Duration - k.paramSpace.Get(ctx, types.KeySlashMeterReplenishPeriod, &p) - return p + params := k.GetParams(ctx) + return params.SlashMeterReplenishPeriod } // GetSlashMeterReplenishFraction returns the string fraction of total voting power that is replenished // to the slash meter every replenish period. This param also serves as a maximum fraction of total // voting power that the slash meter can hold. func (k Keeper) GetSlashMeterReplenishFraction(ctx sdk.Context) string { - var f string - k.paramSpace.Get(ctx, types.KeySlashMeterReplenishFraction, &f) - return f + params := k.GetParams(ctx) + return params.SlashMeterReplenishFraction } // GetMaxThrottledPackets returns the maximum amount of throttled slash or vsc matured packets // that can be queued for a single consumer before the provider chain halts. func (k Keeper) GetMaxThrottledPackets(ctx sdk.Context) int64 { - var p int64 - k.paramSpace.Get(ctx, types.KeyMaxThrottledPackets, &p) - return p + params := k.GetParams(ctx) + return params.MaxThrottledPackets } func (k Keeper) GetConsumerRewardDenomRegistrationFee(ctx sdk.Context) sdk.Coin { // Due to difficulties doing migrations in coordinated upgrades, this param is hardcoded to 10 ATOM in v1.1.0-multiden. // The below code is the proper way to store the param. A future scheduled upgrade will // need to run migrations to add the param. This will allow us to change the fee by governance. - var c sdk.Coin - k.paramSpace.Get(ctx, types.KeyConsumerRewardDenomRegistrationFee, &c) - return c + params := k.GetParams(ctx) + return params.ConsumerRewardDenomRegistrationFee } // GetParams returns the paramset for the provider module func (k Keeper) GetParams(ctx sdk.Context) types.Params { - return types.NewParams( - k.GetTemplateClient(ctx), - k.GetTrustingPeriodFraction(ctx), - k.GetCCVTimeoutPeriod(ctx), - k.GetInitTimeoutPeriod(ctx), - k.GetVscTimeoutPeriod(ctx), - k.GetSlashMeterReplenishPeriod(ctx), - k.GetSlashMeterReplenishFraction(ctx), - k.GetMaxThrottledPackets(ctx), - k.GetConsumerRewardDenomRegistrationFee(ctx), - ) + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.ParametersKey()) + var params types.Params + err := k.cdc.Unmarshal(bz, ¶ms) + if err != nil { + panic(fmt.Sprintf("error unmarshalling module parameters: %v:", err)) + } + return params } // SetParams sets the params for the provider module func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramSpace.SetParamSet(ctx, ¶ms) + store := ctx.KVStore(k.storeKey) + bz := k.cdc.MustMarshal(¶ms) + store.Set(types.ParametersKey(), bz) }