Expose SetParams as I will need that for migration code outside of this package

This commit is contained in:
Ethan Frey
2022-01-24 13:46:18 +01:00
parent 1eb27da462
commit 3acc8c960c
6 changed files with 12 additions and 12 deletions

View File

@@ -18,7 +18,7 @@ type ValidatorSetSource interface {
// CONTRACT: all types of accounts must have been already initialized/created
func InitGenesis(ctx sdk.Context, keeper *Keeper, data types.GenesisState, stakingKeeper ValidatorSetSource, msgHandler sdk.Handler) ([]abci.ValidatorUpdate, error) {
contractKeeper := NewGovPermissionKeeper(keeper)
keeper.setParams(ctx, data.Params)
keeper.SetParams(ctx, data.Params)
var maxCodeID uint64
for i, code := range data.Codes {
err := keeper.importCode(ctx, code.CodeID, code.CodeInfo, code.CodeBytes)

View File

@@ -46,7 +46,7 @@ func TestGenesisExportImport(t *testing.T) {
// store some test data
f := fuzz.New().Funcs(ModelFuzzers...)
wasmKeeper.setParams(srcCtx, types.DefaultParams())
wasmKeeper.SetParams(srcCtx, types.DefaultParams())
for i := 0; i < 25; i++ {
var (
@@ -88,7 +88,7 @@ func TestGenesisExportImport(t *testing.T) {
}
var wasmParams types.Params
f.NilChance(0).Fuzz(&wasmParams)
wasmKeeper.setParams(srcCtx, wasmParams)
wasmKeeper.SetParams(srcCtx, wasmParams)
// export
exportedState := ExportGenesis(srcCtx, wasmKeeper)

View File

@@ -152,7 +152,7 @@ func (k Keeper) GetParams(ctx sdk.Context) types.Params {
return params
}
func (k Keeper) setParams(ctx sdk.Context, ps types.Params) {
func (k Keeper) SetParams(ctx sdk.Context, ps types.Params) {
k.paramSpace.SetParamSet(ctx, &ps)
}

View File

@@ -123,7 +123,7 @@ func TestCreateStoresInstantiatePermission(t *testing.T) {
t.Run(msg, func(t *testing.T) {
ctx, keepers := CreateTestInput(t, false, SupportedFeatures)
accKeeper, keeper, bankKeeper := keepers.AccountKeeper, keepers.ContractKeeper, keepers.BankKeeper
keepers.WasmKeeper.setParams(ctx, types.Params{
keepers.WasmKeeper.SetParams(ctx, types.Params{
CodeUploadAccess: types.AllowEverybody,
InstantiateDefaultPermission: spec.srcPermission,
MaxWasmCodeSize: types.DefaultMaxWasmCodeSize,
@@ -174,7 +174,7 @@ func TestCreateWithParamPermissions(t *testing.T) {
t.Run(msg, func(t *testing.T) {
params := types.DefaultParams()
params.CodeUploadAccess = spec.srcPermission
keepers.WasmKeeper.setParams(ctx, params)
keepers.WasmKeeper.SetParams(ctx, params)
_, err := keeper.Create(ctx, creator, hackatomWasm, nil)
require.True(t, spec.expError.Is(err), err)
if spec.expError != nil {

View File

@@ -24,7 +24,7 @@ import (
func TestStoreCodeProposal(t *testing.T) {
ctx, keepers := CreateTestInput(t, false, "staking")
govKeeper, wasmKeeper := keepers.GovKeeper, keepers.WasmKeeper
wasmKeeper.setParams(ctx, types.Params{
wasmKeeper.SetParams(ctx, types.Params{
CodeUploadAccess: types.AllowNobody,
InstantiateDefaultPermission: types.AccessTypeNobody,
MaxWasmCodeSize: types.DefaultMaxWasmCodeSize,
@@ -62,7 +62,7 @@ func TestStoreCodeProposal(t *testing.T) {
func TestInstantiateProposal(t *testing.T) {
ctx, keepers := CreateTestInput(t, false, "staking")
govKeeper, wasmKeeper := keepers.GovKeeper, keepers.WasmKeeper
wasmKeeper.setParams(ctx, types.Params{
wasmKeeper.SetParams(ctx, types.Params{
CodeUploadAccess: types.AllowNobody,
InstantiateDefaultPermission: types.AccessTypeNobody,
MaxWasmCodeSize: types.DefaultMaxWasmCodeSize,
@@ -126,7 +126,7 @@ func TestInstantiateProposal(t *testing.T) {
func TestMigrateProposal(t *testing.T) {
ctx, keepers := CreateTestInput(t, false, "staking")
govKeeper, wasmKeeper := keepers.GovKeeper, keepers.WasmKeeper
wasmKeeper.setParams(ctx, types.Params{
wasmKeeper.SetParams(ctx, types.Params{
CodeUploadAccess: types.AllowNobody,
InstantiateDefaultPermission: types.AccessTypeNobody,
MaxWasmCodeSize: types.DefaultMaxWasmCodeSize,
@@ -266,7 +266,7 @@ func TestAdminProposals(t *testing.T) {
t.Run(msg, func(t *testing.T) {
ctx, keepers := CreateTestInput(t, false, "staking")
govKeeper, wasmKeeper := keepers.GovKeeper, keepers.WasmKeeper
wasmKeeper.setParams(ctx, types.Params{
wasmKeeper.SetParams(ctx, types.Params{
CodeUploadAccess: types.AllowNobody,
InstantiateDefaultPermission: types.AccessTypeNobody,
MaxWasmCodeSize: types.DefaultMaxWasmCodeSize,
@@ -340,7 +340,7 @@ func TestUpdateParamsProposal(t *testing.T) {
}
for msg, spec := range specs {
t.Run(msg, func(t *testing.T) {
wasmKeeper.setParams(ctx, types.DefaultParams())
wasmKeeper.SetParams(ctx, types.DefaultParams())
proposal := proposal.ParameterChangeProposal{
Title: "Foo",

View File

@@ -383,7 +383,7 @@ func createTestInput(
supportedFeatures,
opts...,
)
keeper.setParams(ctx, types.DefaultParams())
keeper.SetParams(ctx, types.DefaultParams())
// add wasm handler so we can loop-back (contracts calling contracts)
contractKeeper := NewDefaultPermissionKeeper(&keeper)
router.AddRoute(sdk.NewRoute(types.RouterKey, TestHandler(contractKeeper)))