Skip to content

Commit

Permalink
Merge pull request #732 from CosmWasm/expose-set-params
Browse files Browse the repository at this point in the history
Expose SetParams
  • Loading branch information
ethanfrey authored Jan 24, 2022
2 parents 1eb27da + 3acc8c9 commit 74f1221
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion x/wasm/keeper/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions x/wasm/keeper/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion x/wasm/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
4 changes: 2 additions & 2 deletions x/wasm/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 {
Expand Down
10 changes: 5 additions & 5 deletions x/wasm/keeper/proposal_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion x/wasm/keeper/test_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down

0 comments on commit 74f1221

Please sign in to comment.