From 3acc8c960cc5b5bc091d35c42a9ae136f156185c Mon Sep 17 00:00:00 2001 From: Ethan Frey Date: Mon, 24 Jan 2022 13:46:18 +0100 Subject: [PATCH] Expose SetParams as I will need that for migration code outside of this package --- x/wasm/keeper/genesis.go | 2 +- x/wasm/keeper/genesis_test.go | 4 ++-- x/wasm/keeper/keeper.go | 2 +- x/wasm/keeper/keeper_test.go | 4 ++-- x/wasm/keeper/proposal_integration_test.go | 10 +++++----- x/wasm/keeper/test_common.go | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/x/wasm/keeper/genesis.go b/x/wasm/keeper/genesis.go index 9d6edb4550..15978a9170 100644 --- a/x/wasm/keeper/genesis.go +++ b/x/wasm/keeper/genesis.go @@ -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) diff --git a/x/wasm/keeper/genesis_test.go b/x/wasm/keeper/genesis_test.go index d51dbb29a5..2e03231c9a 100644 --- a/x/wasm/keeper/genesis_test.go +++ b/x/wasm/keeper/genesis_test.go @@ -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) diff --git a/x/wasm/keeper/keeper.go b/x/wasm/keeper/keeper.go index eca80ef97a..5980782eec 100644 --- a/x/wasm/keeper/keeper.go +++ b/x/wasm/keeper/keeper.go @@ -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) } diff --git a/x/wasm/keeper/keeper_test.go b/x/wasm/keeper/keeper_test.go index d7443f663d..773ae765fd 100644 --- a/x/wasm/keeper/keeper_test.go +++ b/x/wasm/keeper/keeper_test.go @@ -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 { diff --git a/x/wasm/keeper/proposal_integration_test.go b/x/wasm/keeper/proposal_integration_test.go index d912224808..9338c1dc80 100644 --- a/x/wasm/keeper/proposal_integration_test.go +++ b/x/wasm/keeper/proposal_integration_test.go @@ -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", diff --git a/x/wasm/keeper/test_common.go b/x/wasm/keeper/test_common.go index f2df9c40cc..062c167e98 100644 --- a/x/wasm/keeper/test_common.go +++ b/x/wasm/keeper/test_common.go @@ -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)))