diff --git a/app/app.go b/app/app.go
index c798d8ea51..a519f3afd8 100644
--- a/app/app.go
+++ b/app/app.go
@@ -124,7 +124,7 @@ import (
"github.com/CosmWasm/wasmd/x/wasm"
wasmclient "github.com/CosmWasm/wasmd/x/wasm/client"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
- wasmTypes "github.com/CosmWasm/wasmd/x/wasm/types"
+ wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
)
const appName = "WasmApp"
@@ -489,7 +489,7 @@ func NewWasmApp(
// See: https://docs.cosmos.network/main/modules/gov#proposal-messages
govRouter := govv1beta1.NewRouter()
govRouter.AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler).
- AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)).
+ AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)). // This should be removed. It is still in place to avoid failures of modules that have not yet been upgraded.
AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.UpgradeKeeper)).
AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper))
@@ -588,7 +588,6 @@ func NewWasmApp(
app.WasmKeeper = wasm.NewKeeper(
appCodec,
keys[wasm.StoreKey],
- app.GetSubspace(wasm.ModuleName),
app.AccountKeeper,
app.BankKeeper,
app.StakingKeeper,
@@ -602,6 +601,7 @@ func NewWasmApp(
wasmDir,
wasmConfig,
availableCapabilities,
+ authtypes.NewModuleAddress(govtypes.ModuleName).String(),
wasmOpts...,
)
@@ -678,7 +678,7 @@ func NewWasmApp(
groupmodule.NewAppModule(appCodec, app.GroupKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
nftmodule.NewAppModule(appCodec, app.NFTKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
consensus.NewAppModule(appCodec, app.ConsensusParamsKeeper),
- wasm.NewAppModule(appCodec, &app.WasmKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.MsgServiceRouter()),
+ wasm.NewAppModule(appCodec, &app.WasmKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.MsgServiceRouter(), app.GetSubspace(wasmtypes.ModuleName)),
ibc.NewAppModule(app.IBCKeeper),
transfer.NewAppModule(app.TransferKeeper),
ibcfee.NewAppModule(app.IBCFeeKeeper),
@@ -843,7 +843,7 @@ func NewWasmApp(
return app
}
-func (app *WasmApp) setAnteHandler(txConfig client.TxConfig, wasmConfig wasmTypes.WasmConfig, txCounterStoreKey storetypes.StoreKey) {
+func (app *WasmApp) setAnteHandler(txConfig client.TxConfig, wasmConfig wasmtypes.WasmConfig, txCounterStoreKey storetypes.StoreKey) {
anteHandler, err := NewAnteHandler(
HandlerOptions{
HandlerOptions: ante.HandlerOptions{
diff --git a/cmd/wasmd/root.go b/cmd/wasmd/root.go
index 1f50897fb5..9cc9c87a8b 100644
--- a/cmd/wasmd/root.go
+++ b/cmd/wasmd/root.go
@@ -6,7 +6,6 @@ import (
"os"
rosettaCmd "cosmossdk.io/tools/rosetta/cmd"
-
dbm "github.com/cometbft/cometbft-db"
tmcfg "github.com/cometbft/cometbft/config"
"github.com/cometbft/cometbft/libs/log"
diff --git a/docs/proto/proto-docs.md b/docs/proto/proto-docs.md
index 9c609e8b4a..b0ad0b0445 100644
--- a/docs/proto/proto-docs.md
+++ b/docs/proto/proto-docs.md
@@ -98,6 +98,8 @@
- [MsgUpdateAdminResponse](#cosmwasm.wasm.v1.MsgUpdateAdminResponse)
- [MsgUpdateInstantiateConfig](#cosmwasm.wasm.v1.MsgUpdateInstantiateConfig)
- [MsgUpdateInstantiateConfigResponse](#cosmwasm.wasm.v1.MsgUpdateInstantiateConfigResponse)
+ - [MsgUpdateParams](#cosmwasm.wasm.v1.MsgUpdateParams)
+ - [MsgUpdateParamsResponse](#cosmwasm.wasm.v1.MsgUpdateParamsResponse)
- [Msg](#cosmwasm.wasm.v1.Msg)
@@ -1551,6 +1553,39 @@ MsgUpdateInstantiateConfigResponse returns empty data
+
+
+
+### MsgUpdateParams
+MsgUpdateParams is the Msg/UpdateParams request type.
+
+Since: 0.40
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| `authority` | [string](#string) | | authority is the address of the governance account. |
+| `params` | [Params](#cosmwasm.wasm.v1.Params) | | params defines the x/wasm parameters to update.
+
+NOTE: All parameters must be supplied. |
+
+
+
+
+
+
+
+
+### MsgUpdateParamsResponse
+MsgUpdateParamsResponse defines the response structure for executing a
+MsgUpdateParams message.
+
+Since: 0.40
+
+
+
+
+
@@ -1573,6 +1608,9 @@ Msg defines the wasm Msg service.
| `UpdateAdmin` | [MsgUpdateAdmin](#cosmwasm.wasm.v1.MsgUpdateAdmin) | [MsgUpdateAdminResponse](#cosmwasm.wasm.v1.MsgUpdateAdminResponse) | UpdateAdmin sets a new admin for a smart contract | |
| `ClearAdmin` | [MsgClearAdmin](#cosmwasm.wasm.v1.MsgClearAdmin) | [MsgClearAdminResponse](#cosmwasm.wasm.v1.MsgClearAdminResponse) | ClearAdmin removes any admin stored for a smart contract | |
| `UpdateInstantiateConfig` | [MsgUpdateInstantiateConfig](#cosmwasm.wasm.v1.MsgUpdateInstantiateConfig) | [MsgUpdateInstantiateConfigResponse](#cosmwasm.wasm.v1.MsgUpdateInstantiateConfigResponse) | UpdateInstantiateConfig updates instantiate config for a smart contract | |
+| `UpdateParams` | [MsgUpdateParams](#cosmwasm.wasm.v1.MsgUpdateParams) | [MsgUpdateParamsResponse](#cosmwasm.wasm.v1.MsgUpdateParamsResponse) | UpdateParams defines a governance operation for updating the x/wasm module parameters. The authority is defined in the keeper.
+
+Since: 0.40 | |
diff --git a/proto/cosmwasm/wasm/v1/tx.proto b/proto/cosmwasm/wasm/v1/tx.proto
index cf829aaf06..5b86535a21 100644
--- a/proto/cosmwasm/wasm/v1/tx.proto
+++ b/proto/cosmwasm/wasm/v1/tx.proto
@@ -5,6 +5,7 @@ import "cosmos/base/v1beta1/coin.proto";
import "cosmos/msg/v1/msg.proto";
import "gogoproto/gogo.proto";
import "cosmwasm/wasm/v1/types.proto";
+import "cosmos_proto/cosmos.proto";
option go_package = "github.com/CosmWasm/wasmd/x/wasm/types";
option (gogoproto.goproto_getters_all) = false;
@@ -32,6 +33,11 @@ service Msg {
// UpdateInstantiateConfig updates instantiate config for a smart contract
rpc UpdateInstantiateConfig(MsgUpdateInstantiateConfig)
returns (MsgUpdateInstantiateConfigResponse);
+ // UpdateParams defines a governance operation for updating the x/wasm
+ // module parameters. The authority is defined in the keeper.
+ //
+ // Since: 0.40
+ rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
}
// MsgStoreCode submit Wasm code to the system
@@ -206,4 +212,25 @@ message MsgUpdateInstantiateConfig {
}
// MsgUpdateInstantiateConfigResponse returns empty data
-message MsgUpdateInstantiateConfigResponse {}
\ No newline at end of file
+message MsgUpdateInstantiateConfigResponse {}
+
+// MsgUpdateParams is the Msg/UpdateParams request type.
+//
+// Since: 0.40
+message MsgUpdateParams {
+ option (cosmos.msg.v1.signer) = "authority";
+
+ // authority is the address of the governance account.
+ string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
+
+ // params defines the x/wasm parameters to update.
+ //
+ // NOTE: All parameters must be supplied.
+ Params params = 2 [ (gogoproto.nullable) = false ];
+}
+
+// MsgUpdateParamsResponse defines the response structure for executing a
+// MsgUpdateParams message.
+//
+// Since: 0.40
+message MsgUpdateParamsResponse {}
\ No newline at end of file
diff --git a/x/wasm/exported/exported.go b/x/wasm/exported/exported.go
new file mode 100644
index 0000000000..000114e619
--- /dev/null
+++ b/x/wasm/exported/exported.go
@@ -0,0 +1,18 @@
+package exported
+
+import (
+ sdk "github.com/cosmos/cosmos-sdk/types"
+ paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
+)
+
+type (
+ ParamSet = paramtypes.ParamSet
+
+ // Subspace defines an interface that implements the legacy x/params Subspace
+ // type.
+ //
+ // NOTE: This is used solely for migration of x/params managed parameters.
+ Subspace interface {
+ GetParamSet(ctx sdk.Context, ps ParamSet)
+ }
+)
diff --git a/x/wasm/keeper/genesis.go b/x/wasm/keeper/genesis.go
index a7948e845e..60f5d99316 100644
--- a/x/wasm/keeper/genesis.go
+++ b/x/wasm/keeper/genesis.go
@@ -18,7 +18,11 @@ type ValidatorSetSource interface {
// CONTRACT: all types of accounts must have been already initialized/created
func InitGenesis(ctx sdk.Context, keeper *Keeper, data types.GenesisState) ([]abci.ValidatorUpdate, error) {
contractKeeper := NewGovPermissionKeeper(keeper)
- keeper.SetParams(ctx, data.Params)
+ err := keeper.SetParams(ctx, data.Params)
+ if err != nil {
+ return nil, errorsmod.Wrapf(err, "set 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 adb35c5c7d..aaab0e952e 100644
--- a/x/wasm/keeper/genesis_test.go
+++ b/x/wasm/keeper/genesis_test.go
@@ -13,6 +13,7 @@ import (
"github.com/cosmos/cosmos-sdk/baseapp"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
+ govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
"github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
dbm "github.com/cometbft/cometbft-db"
@@ -21,9 +22,8 @@ import (
"github.com/cosmos/cosmos-sdk/store"
sdk "github.com/cosmos/cosmos-sdk/types"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
+ authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
- paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper"
- paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
fuzz "github.com/google/gofuzz"
"github.com/stretchr/testify/assert"
@@ -36,7 +36,7 @@ import (
const firstCodeID = 1
func TestGenesisExportImport(t *testing.T) {
- wasmKeeper, srcCtx, srcStoreKeys := setupKeeper(t)
+ wasmKeeper, srcCtx := setupKeeper(t)
contractKeeper := NewGovPermissionKeeper(wasmKeeper)
wasmCode, err := os.ReadFile("./testdata/hackatom.wasm")
@@ -105,7 +105,7 @@ func TestGenesisExportImport(t *testing.T) {
require.NoError(t, err)
// setup new instances
- dstKeeper, dstCtx, dstStoreKeys := setupKeeper(t)
+ dstKeeper, dstCtx := setupKeeper(t)
// reset contract code index in source DB for comparison with dest DB
wasmKeeper.IterateContractInfo(srcCtx, func(address sdk.AccAddress, info wasmTypes.ContractInfo) bool {
@@ -124,23 +124,22 @@ func TestGenesisExportImport(t *testing.T) {
InitGenesis(dstCtx, dstKeeper, importState)
// compare whole DB
- for j := range srcStoreKeys {
- srcIT := srcCtx.KVStore(srcStoreKeys[j]).Iterator(nil, nil)
- dstIT := dstCtx.KVStore(dstStoreKeys[j]).Iterator(nil, nil)
-
- for i := 0; srcIT.Valid(); i++ {
- require.True(t, dstIT.Valid(), "[%s] destination DB has less elements than source. Missing: %x", srcStoreKeys[j].Name(), srcIT.Key())
- require.Equal(t, srcIT.Key(), dstIT.Key(), i)
- require.Equal(t, srcIT.Value(), dstIT.Value(), "[%s] element (%d): %X", srcStoreKeys[j].Name(), i, srcIT.Key())
- dstIT.Next()
- srcIT.Next()
- }
- if !assert.False(t, dstIT.Valid()) {
- t.Fatalf("dest Iterator still has key :%X", dstIT.Key())
- }
- srcIT.Close()
- dstIT.Close()
+
+ srcIT := srcCtx.KVStore(wasmKeeper.storeKey).Iterator(nil, nil)
+ dstIT := dstCtx.KVStore(dstKeeper.storeKey).Iterator(nil, nil)
+
+ for i := 0; srcIT.Valid(); i++ {
+ require.True(t, dstIT.Valid(), "[%s] destination DB has less elements than source. Missing: %x", wasmKeeper.storeKey.Name(), srcIT.Key())
+ require.Equal(t, srcIT.Key(), dstIT.Key(), i)
+ require.Equal(t, srcIT.Value(), dstIT.Value(), "[%s] element (%d): %X", wasmKeeper.storeKey.Name(), i, srcIT.Key())
+ dstIT.Next()
+ srcIT.Next()
}
+ if !assert.False(t, dstIT.Valid()) {
+ t.Fatalf("dest Iterator still has key :%X", dstIT.Key())
+ }
+ srcIT.Close()
+ dstIT.Close()
}
func TestGenesisInit(t *testing.T) {
@@ -458,7 +457,7 @@ func TestGenesisInit(t *testing.T) {
}
for msg, spec := range specs {
t.Run(msg, func(t *testing.T) {
- keeper, ctx, _ := setupKeeper(t)
+ keeper, ctx := setupKeeper(t)
require.NoError(t, types.ValidateGenesis(spec.src))
_, gotErr := InitGenesis(ctx, keeper, spec.src)
@@ -538,7 +537,7 @@ func TestImportContractWithCodeHistoryPreserved(t *testing.T) {
{"id_key": "BGxhc3RDb250cmFjdElk", "value": "3"}
]
}`
- keeper, ctx, _ := setupKeeper(t)
+ keeper, ctx := setupKeeper(t)
wasmCode, err := os.ReadFile("./testdata/hackatom.wasm")
require.NoError(t, err)
@@ -618,22 +617,17 @@ func TestImportContractWithCodeHistoryPreserved(t *testing.T) {
assert.Equal(t, uint64(3), keeper.PeekAutoIncrementID(ctx, types.KeyLastInstanceID))
}
-func setupKeeper(t *testing.T) (*Keeper, sdk.Context, []storetypes.StoreKey) {
+func setupKeeper(t *testing.T) (*Keeper, sdk.Context) {
t.Helper()
tempDir, err := os.MkdirTemp("", "wasm")
require.NoError(t, err)
t.Cleanup(func() { os.RemoveAll(tempDir) })
- var (
- keyParams = sdk.NewKVStoreKey(paramtypes.StoreKey)
- tkeyParams = sdk.NewTransientStoreKey(paramtypes.TStoreKey)
- keyWasm = sdk.NewKVStoreKey(wasmTypes.StoreKey)
- )
+
+ keyWasm := sdk.NewKVStoreKey(wasmTypes.StoreKey)
db := dbm.NewMemDB()
ms := store.NewCommitMultiStore(db)
ms.MountStoreWithDB(keyWasm, storetypes.StoreTypeIAVL, db)
- ms.MountStoreWithDB(keyParams, storetypes.StoreTypeIAVL, db)
- ms.MountStoreWithDB(tkeyParams, storetypes.StoreTypeTransient, db)
require.NoError(t, ms.LoadLatestVersion())
ctx := sdk.NewContext(ms, tmproto.Header{
@@ -651,12 +645,10 @@ func setupKeeper(t *testing.T) (*Keeper, sdk.Context, []storetypes.StoreKey) {
v1beta1.RegisterInterfaces(encodingConfig.InterfaceRegistry)
wasmConfig := wasmTypes.DefaultWasmConfig()
- pk := paramskeeper.NewKeeper(encodingConfig.Marshaler, encodingConfig.Amino, keyParams, tkeyParams)
srcKeeper := NewKeeper(
encodingConfig.Marshaler,
keyWasm,
- pk.Subspace(wasmTypes.ModuleName).WithKeyTable(types.ParamKeyTable()),
authkeeper.AccountKeeper{},
&bankkeeper.BaseKeeper{},
stakingkeeper.Keeper{},
@@ -670,8 +662,9 @@ func setupKeeper(t *testing.T) (*Keeper, sdk.Context, []storetypes.StoreKey) {
tempDir,
wasmConfig,
AvailableCapabilities,
+ authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)
- return &srcKeeper, ctx, []storetypes.StoreKey{keyWasm, keyParams}
+ return &srcKeeper, ctx
}
type StakingKeeperMock struct {
diff --git a/x/wasm/keeper/keeper.go b/x/wasm/keeper/keeper.go
index c20c733bf0..5257933a49 100644
--- a/x/wasm/keeper/keeper.go
+++ b/x/wasm/keeper/keeper.go
@@ -25,7 +25,6 @@ import (
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
vestingexported "github.com/cosmos/cosmos-sdk/x/auth/vesting/exported"
- paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/CosmWasm/wasmd/x/wasm/ioutils"
"github.com/CosmWasm/wasmd/x/wasm/types"
@@ -99,34 +98,55 @@ type Keeper struct {
messenger Messenger
// queryGasLimit is the max wasmvm gas that can be spent on executing a query with a contract
queryGasLimit uint64
- paramSpace paramtypes.Subspace
gasRegister GasRegister
maxQueryStackSize uint32
acceptedAccountTypes map[reflect.Type]struct{}
accountPruner AccountPruner
+ // the address capable of executing a MsgUpdateParams message. Typically, this
+ // should be the x/gov module account.
+ authority string
}
func (k Keeper) getUploadAccessConfig(ctx sdk.Context) types.AccessConfig {
- var a types.AccessConfig
- k.paramSpace.Get(ctx, types.ParamStoreKeyUploadAccess, &a)
- return a
+ return k.GetParams(ctx).CodeUploadAccess
}
func (k Keeper) getInstantiateAccessConfig(ctx sdk.Context) types.AccessType {
- var a types.AccessType
- k.paramSpace.Get(ctx, types.ParamStoreKeyInstantiateAccess, &a)
- return a
+ return k.GetParams(ctx).InstantiateDefaultPermission
}
// GetParams returns the total set of wasm parameters.
func (k Keeper) GetParams(ctx sdk.Context) types.Params {
var params types.Params
- k.paramSpace.GetParamSet(ctx, ¶ms)
+ store := ctx.KVStore(k.storeKey)
+ bz := store.Get(types.ParamsKey)
+ if bz == nil {
+ return params
+ }
+
+ k.cdc.MustUnmarshal(bz, ¶ms)
return params
}
-func (k Keeper) SetParams(ctx sdk.Context, ps types.Params) {
- k.paramSpace.SetParamSet(ctx, &ps)
+// SetParams sets all wasm parameters.
+func (k Keeper) SetParams(ctx sdk.Context, ps types.Params) error {
+ if err := ps.ValidateBasic(); err != nil {
+ return err
+ }
+
+ store := ctx.KVStore(k.storeKey)
+ bz, err := k.cdc.Marshal(&ps)
+ if err != nil {
+ return err
+ }
+ store.Set(types.ParamsKey, bz)
+
+ return nil
+}
+
+// GetAuthority returns the x/wasm module's authority.
+func (k Keeper) GetAuthority() string {
+ return k.authority
}
func (k Keeper) create(ctx sdk.Context, creator sdk.AccAddress, wasmCode []byte, instantiateAccess *types.AccessConfig, authZ AuthorizationPolicy) (codeID uint64, checksum []byte, err error) {
diff --git a/x/wasm/keeper/keeper_cgo.go b/x/wasm/keeper/keeper_cgo.go
index f7c7e613cb..dd402bc11c 100644
--- a/x/wasm/keeper/keeper_cgo.go
+++ b/x/wasm/keeper/keeper_cgo.go
@@ -9,7 +9,6 @@ import (
wasmvm "github.com/CosmWasm/wasmvm"
"github.com/cosmos/cosmos-sdk/codec"
- paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/CosmWasm/wasmd/x/wasm/types"
)
@@ -19,7 +18,6 @@ import (
func NewKeeper(
cdc codec.Codec,
storeKey storetypes.StoreKey,
- paramSpace paramtypes.Subspace,
accountKeeper types.AccountKeeper,
bankKeeper types.BankKeeper,
stakingKeeper types.StakingKeeper,
@@ -33,6 +31,7 @@ func NewKeeper(
homeDir string,
wasmConfig types.WasmConfig,
availableCapabilities string,
+ authority string,
opts ...Option,
) Keeper {
wasmer, err := wasmvm.NewVM(filepath.Join(homeDir, "wasm"), availableCapabilities, contractMemoryLimit, wasmConfig.ContractDebugMode, wasmConfig.MemoryCacheSize)
@@ -51,10 +50,10 @@ func NewKeeper(
capabilityKeeper: capabilityKeeper,
messenger: NewDefaultMessageHandler(router, channelKeeper, capabilityKeeper, bankKeeper, cdc, portSource),
queryGasLimit: wasmConfig.SmartQueryGasLimit,
- paramSpace: paramSpace,
gasRegister: NewDefaultWasmGasRegister(),
maxQueryStackSize: types.DefaultMaxQueryStackSize,
acceptedAccountTypes: defaultAcceptedAccountTypes,
+ authority: authority,
}
keeper.wasmVMQueryHandler = DefaultQueryPlugins(bankKeeper, stakingKeeper, distrKeeper, channelKeeper, keeper)
for _, o := range opts {
diff --git a/x/wasm/keeper/keeper_no_cgo.go b/x/wasm/keeper/keeper_no_cgo.go
index 0b8eb1c678..30d06c014d 100644
--- a/x/wasm/keeper/keeper_no_cgo.go
+++ b/x/wasm/keeper/keeper_no_cgo.go
@@ -5,7 +5,6 @@ package keeper
import (
"github.com/cosmos/cosmos-sdk/codec"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
- paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/CosmWasm/wasmd/x/wasm/types"
)
@@ -15,7 +14,6 @@ import (
func NewKeeper(
cdc codec.Codec,
storeKey storetypes.StoreKey,
- paramSpace paramtypes.Subspace,
accountKeeper types.AccountKeeper,
bankKeeper types.BankKeeper,
stakingKeeper types.StakingKeeper,
@@ -29,6 +27,7 @@ func NewKeeper(
homeDir string,
wasmConfig types.WasmConfig,
availableCapabilities string,
+ authority string,
opts ...Option,
) Keeper {
panic("not implemented, please build with cgo enabled")
diff --git a/x/wasm/keeper/keeper_test.go b/x/wasm/keeper/keeper_test.go
index 24c80c9239..37a30a70af 100644
--- a/x/wasm/keeper/keeper_test.go
+++ b/x/wasm/keeper/keeper_test.go
@@ -748,7 +748,7 @@ func TestInstantiateWithContractFactoryChildQueriesParent(t *testing.T) {
// overwrite wasmvm in router
router := baseapp.NewMsgServiceRouter()
router.SetInterfaceRegistry(keepers.EncodingConfig.InterfaceRegistry)
- types.RegisterMsgServer(router, NewMsgServerImpl(NewDefaultPermissionKeeper(keeper)))
+ types.RegisterMsgServer(router, newMsgServerImpl(NewDefaultPermissionKeeper(keeper), *keeper))
keeper.messenger = NewDefaultMessageHandler(router, nil, nil, nil, keepers.EncodingConfig.Marshaler, nil)
// overwrite wasmvm in response handler
keeper.wasmVMResponseHandler = NewDefaultWasmVMContractResponseHandler(NewMessageDispatcher(keeper.messenger, keeper))
diff --git a/x/wasm/keeper/migrations.go b/x/wasm/keeper/migrations.go
index ffb80cc2ed..0e56c7120e 100644
--- a/x/wasm/keeper/migrations.go
+++ b/x/wasm/keeper/migrations.go
@@ -3,25 +3,30 @@ package keeper
import (
sdk "github.com/cosmos/cosmos-sdk/types"
- "github.com/CosmWasm/wasmd/x/wasm/types"
+ v1 "github.com/CosmWasm/wasmd/x/wasm/migrations/v1"
+ v2 "github.com/CosmWasm/wasmd/x/wasm/migrations/v2"
+
+ "github.com/CosmWasm/wasmd/x/wasm/exported"
)
// Migrator is a struct for handling in-place store migrations.
type Migrator struct {
- keeper Keeper
+ keeper Keeper
+ legacySubspace exported.Subspace
}
// NewMigrator returns a new Migrator.
-func NewMigrator(keeper Keeper) Migrator {
- return Migrator{keeper: keeper}
+func NewMigrator(keeper Keeper, legacySubspace exported.Subspace) Migrator {
+ return Migrator{keeper: keeper, legacySubspace: legacySubspace}
}
// Migrate1to2 migrates from version 1 to 2.
func (m Migrator) Migrate1to2(ctx sdk.Context) error {
- m.keeper.IterateContractInfo(ctx, func(contractAddr sdk.AccAddress, contractInfo types.ContractInfo) bool {
- creator := sdk.MustAccAddressFromBech32(contractInfo.Creator)
- m.keeper.addToContractCreatorSecondaryIndex(ctx, creator, contractInfo.Created, contractAddr)
- return false
- })
- return nil
+ return v1.NewMigrator(m.keeper, m.keeper.addToContractCreatorSecondaryIndex).Migrate1to2(ctx)
+}
+
+// Migrate2to3 migrates the x/wasm module state from the consensus
+// version 2 to version 3.
+func (m Migrator) Migrate2to3(ctx sdk.Context) error {
+ return v2.MigrateStore(ctx, m.keeper.storeKey, m.legacySubspace, m.keeper.cdc)
}
diff --git a/x/wasm/keeper/migrations_integration_test.go b/x/wasm/keeper/migrations_integration_test.go
new file mode 100644
index 0000000000..68ec878459
--- /dev/null
+++ b/x/wasm/keeper/migrations_integration_test.go
@@ -0,0 +1,71 @@
+package keeper_test
+
+import (
+ "testing"
+
+ "github.com/CosmWasm/wasmd/x/wasm/types"
+
+ tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
+ sdk "github.com/cosmos/cosmos-sdk/types"
+ "github.com/cosmos/cosmos-sdk/types/module"
+ upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
+ "github.com/stretchr/testify/assert"
+ "github.com/stretchr/testify/require"
+
+ "github.com/CosmWasm/wasmd/app"
+ "github.com/CosmWasm/wasmd/x/wasm"
+)
+
+func TestModuleMigrations(t *testing.T) {
+ wasmApp := app.Setup(t)
+ upgradeHandler := func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
+ return wasmApp.ModuleManager.RunMigrations(ctx, wasmApp.Configurator(), fromVM)
+ }
+
+ specs := map[string]struct {
+ setup func(ctx sdk.Context)
+ startVersion uint64
+ exp types.Params
+ }{
+ "with legacy params migrated": {
+ startVersion: 1,
+ setup: func(ctx sdk.Context) {
+ params := types.Params{
+ CodeUploadAccess: types.AllowNobody,
+ InstantiateDefaultPermission: types.AccessTypeNobody,
+ }
+ sp, _ := wasmApp.ParamsKeeper.GetSubspace(types.ModuleName)
+ sp.SetParamSet(ctx, ¶ms)
+ },
+ exp: types.Params{
+ CodeUploadAccess: types.AllowNobody,
+ InstantiateDefaultPermission: types.AccessTypeNobody,
+ },
+ },
+ "fresh from genesis": {
+ startVersion: wasmApp.ModuleManager.GetVersionMap()[types.ModuleName], // latest
+ setup: func(ctx sdk.Context) {},
+ exp: types.DefaultParams(),
+ },
+ }
+ for name, spec := range specs {
+ t.Run(name, func(t *testing.T) {
+ ctx, _ := wasmApp.BaseApp.NewContext(false, tmproto.Header{}).CacheContext()
+ spec.setup(ctx)
+
+ fromVM := wasmApp.UpgradeKeeper.GetModuleVersionMap(ctx)
+ fromVM[wasm.ModuleName] = spec.startVersion
+ upgradeHandler(ctx, upgradetypes.Plan{Name: "testing"}, fromVM)
+
+ // when
+ gotVM, err := wasmApp.ModuleManager.RunMigrations(ctx, wasmApp.Configurator(), fromVM)
+
+ // then
+ require.NoError(t, err)
+ var expModuleVersion uint64 = 3
+ assert.Equal(t, expModuleVersion, gotVM[wasm.ModuleName])
+ gotParams := wasmApp.WasmKeeper.GetParams(ctx)
+ assert.Equal(t, spec.exp, gotParams)
+ })
+ }
+}
diff --git a/x/wasm/keeper/msg_server.go b/x/wasm/keeper/msg_server.go
index 42dbeb94c6..bfc3e8b445 100644
--- a/x/wasm/keeper/msg_server.go
+++ b/x/wasm/keeper/msg_server.go
@@ -11,14 +11,29 @@ import (
var _ types.MsgServer = msgServer{}
+// abstract type
+type paramStore interface {
+ GetAuthority() string
+ SetParams(ctx sdk.Context, params types.Params) error
+}
+
+// grpc message server implementation
type msgServer struct {
- keeper types.ContractOpsKeeper
+ keeper types.ContractOpsKeeper
+ paramStore paramStore
+}
+
+// NewMsgServerImpl default constructor
+func NewMsgServerImpl(k *Keeper) types.MsgServer {
+ return newMsgServerImpl(NewDefaultPermissionKeeper(k), k)
}
-func NewMsgServerImpl(k types.ContractOpsKeeper) types.MsgServer {
- return &msgServer{keeper: k}
+// newMsgServerImpl internal constructor to overwrite interfaces for testing
+func newMsgServerImpl(k types.ContractOpsKeeper, p paramStore) types.MsgServer {
+ return &msgServer{keeper: k, paramStore: p}
}
+// StoreCode stores a new wasm code on chain
func (m msgServer) StoreCode(goCtx context.Context, msg *types.MsgStoreCode) (*types.MsgStoreCodeResponse, error) {
if err := msg.ValidateBasic(); err != nil {
return nil, err
@@ -208,3 +223,18 @@ func (m msgServer) UpdateInstantiateConfig(goCtx context.Context, msg *types.Msg
return &types.MsgUpdateInstantiateConfigResponse{}, nil
}
+
+// UpdateParams updates the module parameters
+func (m msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) {
+ authority := m.paramStore.GetAuthority()
+ if authority != req.Authority {
+ return nil, errorsmod.Wrapf(types.ErrInvalid, "invalid authority; expected %s, got %s", authority, req.Authority)
+ }
+
+ ctx := sdk.UnwrapSDKContext(goCtx)
+ if err := m.paramStore.SetParams(ctx, req.Params); err != nil {
+ return nil, err
+ }
+
+ return &types.MsgUpdateParamsResponse{}, nil
+}
diff --git a/x/wasm/keeper/msg_server_integration_test.go b/x/wasm/keeper/msg_server_integration_test.go
index 7c21bb3f8e..9e6765608e 100644
--- a/x/wasm/keeper/msg_server_integration_test.go
+++ b/x/wasm/keeper/msg_server_integration_test.go
@@ -6,6 +6,8 @@ import (
"testing"
"github.com/cosmos/cosmos-sdk/testutil/testdata"
+ sdk "github.com/cosmos/cosmos-sdk/types"
+ govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
"github.com/stretchr/testify/assert"
@@ -44,3 +46,92 @@ func TestStoreCode(t *testing.T) {
assert.Equal(t, sender.String(), info.Creator)
assert.Equal(t, types.DefaultParams().InstantiateDefaultPermission.With(sender), info.InstantiateConfig)
}
+
+func TestUpdateParams(t *testing.T) {
+ wasmApp := app.Setup(t)
+ ctx := wasmApp.BaseApp.NewContext(false, tmproto.Header{})
+
+ var (
+ myAddress sdk.AccAddress = make([]byte, types.ContractAddrLen)
+ oneAddressAccessConfig = types.AccessTypeOnlyAddress.With(myAddress)
+ govAuthority = wasmApp.AccountKeeper.GetModuleAddress(govtypes.ModuleName).String()
+ )
+
+ specs := map[string]struct {
+ src types.MsgUpdateParams
+ expUploadConfig types.AccessConfig
+ expInstantiateType types.AccessType
+ }{
+ "update upload permission param": {
+ src: types.MsgUpdateParams{
+ Authority: govAuthority,
+ Params: types.Params{
+ CodeUploadAccess: types.AllowNobody,
+ InstantiateDefaultPermission: types.AccessTypeEverybody,
+ },
+ },
+ expUploadConfig: types.AllowNobody,
+ expInstantiateType: types.AccessTypeEverybody,
+ },
+ "update upload permission with same as current value": {
+ src: types.MsgUpdateParams{
+ Authority: govAuthority,
+ Params: types.Params{
+ CodeUploadAccess: types.AllowEverybody,
+ InstantiateDefaultPermission: types.AccessTypeEverybody,
+ },
+ },
+ expUploadConfig: types.AllowEverybody,
+ expInstantiateType: types.AccessTypeEverybody,
+ },
+ "update upload permission param with address": {
+ src: types.MsgUpdateParams{
+ Authority: govAuthority,
+ Params: types.Params{
+ CodeUploadAccess: oneAddressAccessConfig,
+ InstantiateDefaultPermission: types.AccessTypeEverybody,
+ },
+ },
+ expUploadConfig: oneAddressAccessConfig,
+ expInstantiateType: types.AccessTypeEverybody,
+ },
+ "update instantiate param": {
+ src: types.MsgUpdateParams{
+ Authority: govAuthority,
+ Params: types.Params{
+ CodeUploadAccess: types.AllowEverybody,
+ InstantiateDefaultPermission: types.AccessTypeNobody,
+ },
+ },
+ expUploadConfig: types.AllowEverybody,
+ expInstantiateType: types.AccessTypeNobody,
+ },
+ "update instantiate param as default": {
+ src: types.MsgUpdateParams{
+ Authority: govAuthority,
+ Params: types.Params{
+ CodeUploadAccess: types.AllowEverybody,
+ InstantiateDefaultPermission: types.AccessTypeEverybody,
+ },
+ },
+ expUploadConfig: types.AllowEverybody,
+ expInstantiateType: types.AccessTypeEverybody,
+ },
+ }
+ for msg, spec := range specs {
+ t.Run(msg, func(t *testing.T) {
+ wasmApp.WasmKeeper.SetParams(ctx, types.DefaultParams())
+
+ // when
+ rsp, err := wasmApp.MsgServiceRouter().Handler(&spec.src)(ctx, &spec.src)
+ require.NoError(t, err)
+ var result types.MsgUpdateParamsResponse
+ require.NoError(t, wasmApp.AppCodec().Unmarshal(rsp.Data, &result))
+
+ // then
+ assert.True(t, spec.expUploadConfig.Equals(wasmApp.WasmKeeper.GetParams(ctx).CodeUploadAccess),
+ "got %#v not %#v", wasmApp.WasmKeeper.GetParams(ctx).CodeUploadAccess, spec.expUploadConfig)
+ assert.Equal(t, spec.expInstantiateType, wasmApp.WasmKeeper.GetParams(ctx).InstantiateDefaultPermission)
+ })
+ }
+}
diff --git a/x/wasm/keeper/options_test.go b/x/wasm/keeper/options_test.go
index 0486d34827..903e0615ff 100644
--- a/x/wasm/keeper/options_test.go
+++ b/x/wasm/keeper/options_test.go
@@ -8,7 +8,6 @@ import (
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
- paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -103,7 +102,7 @@ func TestConstructorOptions(t *testing.T) {
}
for name, spec := range specs {
t.Run(name, func(t *testing.T) {
- k := NewKeeper(nil, nil, paramtypes.NewSubspace(nil, nil, nil, nil, ""), authkeeper.AccountKeeper{}, &bankkeeper.BaseKeeper{}, stakingkeeper.Keeper{}, nil, nil, nil, nil, nil, nil, nil, "tempDir", types.DefaultWasmConfig(), AvailableCapabilities, spec.srcOpt)
+ k := NewKeeper(nil, nil, authkeeper.AccountKeeper{}, &bankkeeper.BaseKeeper{}, stakingkeeper.Keeper{}, nil, nil, nil, nil, nil, nil, nil, "tempDir", types.DefaultWasmConfig(), AvailableCapabilities, "", spec.srcOpt)
spec.verify(t, k)
})
}
diff --git a/x/wasm/keeper/proposal_integration_test.go b/x/wasm/keeper/proposal_integration_test.go
index 2296f41b6d..fc05c054d8 100644
--- a/x/wasm/keeper/proposal_integration_test.go
+++ b/x/wasm/keeper/proposal_integration_test.go
@@ -14,8 +14,6 @@ import (
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
"github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
- "github.com/cosmos/cosmos-sdk/x/params/client/utils"
- "github.com/cosmos/cosmos-sdk/x/params/types/proposal"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -643,98 +641,6 @@ func TestAdminProposals(t *testing.T) {
}
}
-func TestUpdateParamsProposal(t *testing.T) {
- ctx, keepers := CreateTestInput(t, false, "staking")
- wasmKeeper := keepers.WasmKeeper
-
- var (
- legacyAmino = keepers.EncodingConfig.Amino
- myAddress sdk.AccAddress = make([]byte, types.ContractAddrLen)
- oneAddressAccessConfig = types.AccessTypeOnlyAddress.With(myAddress)
- )
-
- specs := map[string]struct {
- src proposal.ParamChange
- expUploadConfig types.AccessConfig
- expInstantiateType types.AccessType
- }{
- "update upload permission param": {
- src: proposal.ParamChange{
- Subspace: types.ModuleName,
- Key: string(types.ParamStoreKeyUploadAccess),
- Value: string(legacyAmino.MustMarshalJSON(&types.AllowNobody)),
- },
- expUploadConfig: types.AllowNobody,
- expInstantiateType: types.AccessTypeEverybody,
- },
- "update upload permission with same as current value": {
- src: proposal.ParamChange{
- Subspace: types.ModuleName,
- Key: string(types.ParamStoreKeyUploadAccess),
- Value: string(legacyAmino.MustMarshalJSON(&types.AllowEverybody)),
- },
- expUploadConfig: types.AllowEverybody,
- expInstantiateType: types.AccessTypeEverybody,
- },
- "update upload permission param with address": {
- src: proposal.ParamChange{
- Subspace: types.ModuleName,
- Key: string(types.ParamStoreKeyUploadAccess),
- Value: string(legacyAmino.MustMarshalJSON(&oneAddressAccessConfig)),
- },
- expUploadConfig: oneAddressAccessConfig,
- expInstantiateType: types.AccessTypeEverybody,
- },
- "update instantiate param": {
- src: proposal.ParamChange{
- Subspace: types.ModuleName,
- Key: string(types.ParamStoreKeyInstantiateAccess),
- Value: string(legacyAmino.MustMarshalJSON(types.AccessTypeNobody)),
- },
- expUploadConfig: types.AllowEverybody,
- expInstantiateType: types.AccessTypeNobody,
- },
- "update instantiate param as default": {
- src: proposal.ParamChange{
- Subspace: types.ModuleName,
- Key: string(types.ParamStoreKeyInstantiateAccess),
- Value: string(legacyAmino.MustMarshalJSON(types.AccessTypeEverybody)),
- },
- expUploadConfig: types.AllowEverybody,
- expInstantiateType: types.AccessTypeEverybody,
- },
- }
- for msg, spec := range specs {
- t.Run(msg, func(t *testing.T) {
- wasmKeeper.SetParams(ctx, types.DefaultParams())
-
- // encode + decode as CLI to play nice with amino
- bz := legacyAmino.MustMarshalJSON(&utils.ParamChangeProposalJSON{
- Title: "Foo",
- Description: "Bar",
- Changes: []utils.ParamChangeJSON{{Subspace: spec.src.Subspace, Key: spec.src.Key, Value: json.RawMessage(spec.src.Value)}},
- })
- t.Log(string(bz))
-
- var jsonProposal utils.ParamChangeProposalJSON
- require.NoError(t, legacyAmino.UnmarshalJSON(bz, &jsonProposal))
- src := &proposal.ParameterChangeProposal{
- Title: jsonProposal.Title,
- Description: jsonProposal.Description,
- Changes: jsonProposal.Changes.ToParamChanges(),
- }
-
- // when
- mustSubmitAndExecuteLegacyProposal(t, ctx, src, myAddress.String(), keepers)
-
- // then
- assert.True(t, spec.expUploadConfig.Equals(wasmKeeper.getUploadAccessConfig(ctx)),
- "got %#v not %#v", wasmKeeper.getUploadAccessConfig(ctx), spec.expUploadConfig)
- assert.Equal(t, spec.expInstantiateType, wasmKeeper.getInstantiateAccessConfig(ctx))
- })
- }
-}
-
func TestPinCodesProposal(t *testing.T) {
ctx, keepers := CreateTestInput(t, false, "staking")
wasmKeeper := keepers.WasmKeeper
diff --git a/x/wasm/keeper/test_common.go b/x/wasm/keeper/test_common.go
index ee45ef7329..bb0baba623 100644
--- a/x/wasm/keeper/test_common.go
+++ b/x/wasm/keeper/test_common.go
@@ -9,6 +9,8 @@ import (
"testing"
"time"
+ "github.com/CosmWasm/wasmd/x/wasm/keeper/testdata"
+
icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types"
icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types"
@@ -194,6 +196,7 @@ type TestKeepers struct {
Faucet *TestFaucet
MultiStore sdk.CommitMultiStore
ScopedWasmKeeper capabilitykeeper.ScopedKeeper
+ WasmStoreKey *storetypes.KVStoreKey
}
// CreateDefaultTestInput common settings for CreateTestInput
@@ -418,7 +421,6 @@ func createTestInput(
keeper := NewKeeper(
appCodec,
keys[types.StoreKey],
- subspace(types.ModuleName),
accountKeeper,
bankKeeper,
stakingKeeper,
@@ -432,9 +434,11 @@ func createTestInput(
tempDir,
wasmConfig,
availableCapabilities,
+ authtypes.NewModuleAddress(govtypes.ModuleName).String(),
opts...,
)
- keeper.SetParams(ctx, types.DefaultParams())
+ require.NoError(t, keeper.SetParams(ctx, types.DefaultParams()))
+
// add wasm handler so we can loop-back (contracts calling contracts)
contractKeeper := NewDefaultPermissionKeeper(&keeper)
@@ -464,7 +468,7 @@ func createTestInput(
gov.NewAppModule(appCodec, govKeeper, accountKeeper, bankKeeper, subspace(govtypes.ModuleName)),
)
am.RegisterServices(module.NewConfigurator(appCodec, msgRouter, querier))
- types.RegisterMsgServer(msgRouter, NewMsgServerImpl(NewDefaultPermissionKeeper(keeper)))
+ types.RegisterMsgServer(msgRouter, newMsgServerImpl(NewDefaultPermissionKeeper(keeper), keeper))
types.RegisterQueryServer(querier, NewGrpcQuerier(appCodec, keys[types.ModuleName], keeper, keeper.queryGasLimit))
keepers := TestKeepers{
@@ -481,6 +485,7 @@ func createTestInput(
Faucet: faucet,
MultiStore: ms,
ScopedWasmKeeper: scopedWasmKeeper,
+ WasmStoreKey: keys[types.StoreKey],
}
return ctx, keepers
}
@@ -593,29 +598,32 @@ type ExampleContract struct {
}
func StoreHackatomExampleContract(t testing.TB, ctx sdk.Context, keepers TestKeepers) ExampleContract {
- return StoreExampleContract(t, ctx, keepers, "./testdata/hackatom.wasm")
+ return StoreExampleContractWasm(t, ctx, keepers, testdata.HackatomContractWasm())
}
func StoreBurnerExampleContract(t testing.TB, ctx sdk.Context, keepers TestKeepers) ExampleContract {
- return StoreExampleContract(t, ctx, keepers, "./testdata/burner.wasm")
+ return StoreExampleContractWasm(t, ctx, keepers, testdata.BurnerContractWasm())
}
func StoreIBCReflectContract(t testing.TB, ctx sdk.Context, keepers TestKeepers) ExampleContract {
- return StoreExampleContract(t, ctx, keepers, "./testdata/ibc_reflect.wasm")
+ return StoreExampleContractWasm(t, ctx, keepers, testdata.IBCReflectContractWasm())
}
func StoreReflectContract(t testing.TB, ctx sdk.Context, keepers TestKeepers) ExampleContract {
- return StoreExampleContract(t, ctx, keepers, "./testdata/reflect.wasm")
+ return StoreExampleContractWasm(t, ctx, keepers, testdata.ReflectContractWasm())
}
func StoreExampleContract(t testing.TB, ctx sdk.Context, keepers TestKeepers, wasmFile string) ExampleContract {
+ wasmCode, err := os.ReadFile(wasmFile)
+ require.NoError(t, err)
+ return StoreExampleContractWasm(t, ctx, keepers, wasmCode)
+}
+
+func StoreExampleContractWasm(t testing.TB, ctx sdk.Context, keepers TestKeepers, wasmCode []byte) ExampleContract {
anyAmount := sdk.NewCoins(sdk.NewInt64Coin("denom", 1000))
creator, _, creatorAddr := keyPubAddr()
fundAccounts(t, ctx, keepers.AccountKeeper, keepers.BankKeeper, creatorAddr, anyAmount)
- wasmCode, err := os.ReadFile(wasmFile)
- require.NoError(t, err)
-
codeID, _, err := keepers.ContractKeeper.Create(ctx, creatorAddr, wasmCode, nil)
require.NoError(t, err)
hash := keepers.WasmKeeper.GetCodeInfo(ctx, codeID).CodeHash
diff --git a/x/wasm/keeper/testdata/reflect.go b/x/wasm/keeper/testdata/contracts.go
similarity index 74%
rename from x/wasm/keeper/testdata/reflect.go
rename to x/wasm/keeper/testdata/contracts.go
index 2074ef96fd..6073e4d530 100644
--- a/x/wasm/keeper/testdata/reflect.go
+++ b/x/wasm/keeper/testdata/contracts.go
@@ -7,14 +7,20 @@ import (
"github.com/cosmos/cosmos-sdk/types"
)
-//go:embed reflect.wasm
-var reflectContract []byte
-
-//go:embed reflect_1_1.wasm
-var migrateReflectContract []byte
-
-//go:embed cyberpunk.wasm
-var cyberpunkContract []byte
+var (
+ //go:embed reflect.wasm
+ reflectContract []byte
+ //go:embed reflect_1_1.wasm
+ migrateReflectContract []byte
+ //go:embed cyberpunk.wasm
+ cyberpunkContract []byte
+ //go:embed ibc_reflect.wasm
+ ibcReflectContract []byte
+ //go:embed burner.wasm
+ burnerContract []byte
+ //go:embed hackatom.wasm
+ hackatomContract []byte
+)
func ReflectContractWasm() []byte {
return reflectContract
@@ -28,6 +34,18 @@ func CyberpunkContractWasm() []byte {
return cyberpunkContract
}
+func IBCReflectContractWasm() []byte {
+ return ibcReflectContract
+}
+
+func BurnerContractWasm() []byte {
+ return burnerContract
+}
+
+func HackatomContractWasm() []byte {
+ return hackatomContract
+}
+
// ReflectHandleMsg is used to encode handle messages
type ReflectHandleMsg struct {
Reflect *ReflectPayload `json:"reflect_msg,omitempty"`
diff --git a/x/wasm/migrations/v1/store.go b/x/wasm/migrations/v1/store.go
new file mode 100644
index 0000000000..f970d85c09
--- /dev/null
+++ b/x/wasm/migrations/v1/store.go
@@ -0,0 +1,36 @@
+package v1
+
+import (
+ sdk "github.com/cosmos/cosmos-sdk/types"
+
+ "github.com/CosmWasm/wasmd/x/wasm/types"
+)
+
+// AddToSecondIndexFn creates a secondary index entry for the creator fo the contract
+type AddToSecondIndexFn func(ctx sdk.Context, creatorAddress sdk.AccAddress, position *types.AbsoluteTxPosition, contractAddress sdk.AccAddress)
+
+// Keeper abstract keeper
+type wasmKeeper interface {
+ IterateContractInfo(ctx sdk.Context, cb func(sdk.AccAddress, types.ContractInfo) bool)
+}
+
+// Migrator is a struct for handling in-place store migrations.
+type Migrator struct {
+ keeper wasmKeeper
+ addToSecondIndexFn AddToSecondIndexFn
+}
+
+// NewMigrator returns a new Migrator.
+func NewMigrator(k wasmKeeper, fn AddToSecondIndexFn) Migrator {
+ return Migrator{keeper: k, addToSecondIndexFn: fn}
+}
+
+// Migrate1to2 migrates from version 1 to 2.
+func (m Migrator) Migrate1to2(ctx sdk.Context) error {
+ m.keeper.IterateContractInfo(ctx, func(contractAddr sdk.AccAddress, contractInfo types.ContractInfo) bool {
+ creator := sdk.MustAccAddressFromBech32(contractInfo.Creator)
+ m.addToSecondIndexFn(ctx, creator, contractInfo.Created, contractAddr)
+ return false
+ })
+ return nil
+}
diff --git a/x/wasm/keeper/migrate_test.go b/x/wasm/migrations/v1/store_test.go
similarity index 65%
rename from x/wasm/keeper/migrate_test.go
rename to x/wasm/migrations/v1/store_test.go
index 3b762c49d0..114d5d0b79 100644
--- a/x/wasm/keeper/migrate_test.go
+++ b/x/wasm/migrations/v1/store_test.go
@@ -1,10 +1,12 @@
-package keeper
+package v1_test
import (
"bytes"
"encoding/json"
"testing"
+ "github.com/CosmWasm/wasmd/x/wasm/keeper"
+
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/address"
"github.com/stretchr/testify/require"
@@ -13,17 +15,18 @@ import (
)
func TestMigrate1To2(t *testing.T) {
- ctx, keepers := CreateTestInput(t, false, AvailableCapabilities)
+ const AvailableCapabilities = "iterator,staking,stargate,cosmwasm_1_1"
+ ctx, keepers := keeper.CreateTestInput(t, false, AvailableCapabilities)
wasmKeeper := keepers.WasmKeeper
deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000))
creator := sdk.AccAddress(bytes.Repeat([]byte{1}, address.Len))
keepers.Faucet.Fund(ctx, creator, deposit...)
- example := StoreHackatomExampleContract(t, ctx, keepers)
+ example := keeper.StoreHackatomExampleContract(t, ctx, keepers)
- initMsg := HackatomExampleInitMsg{
- Verifier: RandomAccountAddress(t),
- Beneficiary: RandomAccountAddress(t),
+ initMsg := keeper.HackatomExampleInitMsg{
+ Verifier: keeper.RandomAccountAddress(t),
+ Beneficiary: keeper.RandomAccountAddress(t),
}
initMsgBz, err := json.Marshal(initMsg)
require.NoError(t, err)
@@ -42,13 +45,13 @@ func TestMigrate1To2(t *testing.T) {
info3 := wasmKeeper.GetContractInfo(ctx, gotContractAddr3)
// remove key
- ctx.KVStore(wasmKeeper.storeKey).Delete(types.GetContractByCreatorSecondaryIndexKey(creator, info1.Created.Bytes(), gotContractAddr1))
- ctx.KVStore(wasmKeeper.storeKey).Delete(types.GetContractByCreatorSecondaryIndexKey(creator, info2.Created.Bytes(), gotContractAddr2))
- ctx.KVStore(wasmKeeper.storeKey).Delete(types.GetContractByCreatorSecondaryIndexKey(creator, info3.Created.Bytes(), gotContractAddr3))
+ ctx.KVStore(keepers.WasmStoreKey).Delete(types.GetContractByCreatorSecondaryIndexKey(creator, info1.Created.Bytes(), gotContractAddr1))
+ ctx.KVStore(keepers.WasmStoreKey).Delete(types.GetContractByCreatorSecondaryIndexKey(creator, info2.Created.Bytes(), gotContractAddr2))
+ ctx.KVStore(keepers.WasmStoreKey).Delete(types.GetContractByCreatorSecondaryIndexKey(creator, info3.Created.Bytes(), gotContractAddr3))
// migrator
- migrator := NewMigrator(*wasmKeeper)
- migrator.Migrate1to2(ctx)
+ keeper.NewMigrator(*wasmKeeper, nil).Migrate1to2(ctx)
+ require.NoError(t, err)
// check new store
var allContract []string
diff --git a/x/wasm/migrations/v2/store.go b/x/wasm/migrations/v2/store.go
new file mode 100644
index 0000000000..64c94ba837
--- /dev/null
+++ b/x/wasm/migrations/v2/store.go
@@ -0,0 +1,33 @@
+package v2
+
+import (
+ "github.com/cosmos/cosmos-sdk/codec"
+ storetypes "github.com/cosmos/cosmos-sdk/store/types"
+ sdk "github.com/cosmos/cosmos-sdk/types"
+
+ "github.com/CosmWasm/wasmd/x/wasm/exported"
+ "github.com/CosmWasm/wasmd/x/wasm/types"
+)
+
+// MigrateStore migrates the x/wasm module state from the consensus version 2 to
+// version 3. Specifically, it takes the parameters that are currently stored
+// and managed by the x/params module and stores them directly into the x/wasm
+// module state.
+func MigrateStore(ctx sdk.Context, storeKey storetypes.StoreKey, legacySubspace exported.Subspace, cdc codec.BinaryCodec) error {
+ store := ctx.KVStore(storeKey)
+ var currParams types.Params
+ legacySubspace.GetParamSet(ctx, &currParams)
+
+ if err := currParams.ValidateBasic(); err != nil {
+ return err
+ }
+
+ bz, err := cdc.Marshal(&currParams)
+ if err != nil {
+ return err
+ }
+
+ store.Set(types.ParamsKey, bz)
+
+ return nil
+}
diff --git a/x/wasm/migrations/v2/store_test.go b/x/wasm/migrations/v2/store_test.go
new file mode 100644
index 0000000000..3f21bf4555
--- /dev/null
+++ b/x/wasm/migrations/v2/store_test.go
@@ -0,0 +1,44 @@
+package v2_test
+
+import (
+ "testing"
+
+ "github.com/stretchr/testify/require"
+
+ "github.com/cosmos/cosmos-sdk/testutil"
+ sdk "github.com/cosmos/cosmos-sdk/types"
+ moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil"
+
+ "github.com/CosmWasm/wasmd/x/wasm"
+ "github.com/CosmWasm/wasmd/x/wasm/exported"
+ v2 "github.com/CosmWasm/wasmd/x/wasm/migrations/v2"
+ "github.com/CosmWasm/wasmd/x/wasm/types"
+)
+
+type mockSubspace struct {
+ ps types.Params
+}
+
+func newMockSubspace(ps types.Params) mockSubspace {
+ return mockSubspace{ps: ps}
+}
+
+func (ms mockSubspace) GetParamSet(ctx sdk.Context, ps exported.ParamSet) {
+ *ps.(*types.Params) = ms.ps
+}
+
+func TestMigrate(t *testing.T) {
+ cdc := moduletestutil.MakeTestEncodingConfig(wasm.AppModuleBasic{}).Codec
+ storeKey := sdk.NewKVStoreKey(types.StoreKey)
+ tKey := sdk.NewTransientStoreKey("transient_test")
+ ctx := testutil.DefaultContext(storeKey, tKey)
+ store := ctx.KVStore(storeKey)
+
+ legacySubspace := newMockSubspace(types.DefaultParams())
+ require.NoError(t, v2.MigrateStore(ctx, storeKey, legacySubspace, cdc))
+
+ var res types.Params
+ bz := store.Get(types.ParamsKey)
+ require.NoError(t, cdc.Unmarshal(bz, &res))
+ require.Equal(t, legacySubspace.ps, res)
+}
diff --git a/x/wasm/module.go b/x/wasm/module.go
index 99a02f7f30..6bf49b3d73 100644
--- a/x/wasm/module.go
+++ b/x/wasm/module.go
@@ -26,6 +26,7 @@ import (
"github.com/spf13/cobra"
"github.com/CosmWasm/wasmd/x/wasm/client/cli"
+ "github.com/CosmWasm/wasmd/x/wasm/exported"
"github.com/CosmWasm/wasmd/x/wasm/keeper"
"github.com/CosmWasm/wasmd/x/wasm/simulation"
"github.com/CosmWasm/wasmd/x/wasm/types"
@@ -107,6 +108,8 @@ type AppModule struct {
accountKeeper types.AccountKeeper // for simulation
bankKeeper simulation.BankKeeper
router keeper.MessageRouter
+ // legacySubspace is used solely for migration of x/params managed parameters
+ legacySubspace exported.Subspace
}
// NewAppModule creates a new AppModule object
@@ -117,6 +120,7 @@ func NewAppModule(
ak types.AccountKeeper,
bk simulation.BankKeeper,
router *baseapp.MsgServiceRouter,
+ ss exported.Subspace,
) AppModule {
return AppModule{
AppModuleBasic: AppModuleBasic{},
@@ -126,6 +130,7 @@ func NewAppModule(
accountKeeper: ak,
bankKeeper: bk,
router: router,
+ legacySubspace: ss,
}
}
@@ -141,17 +146,21 @@ func (am AppModule) IsAppModule() { // marker
// module. It should be incremented on each consensus-breaking change
// introduced by the module. To avoid wrong/empty versions, the initial version
// should be set to 1.
-func (AppModule) ConsensusVersion() uint64 { return 2 }
+func (AppModule) ConsensusVersion() uint64 { return 3 }
func (am AppModule) RegisterServices(cfg module.Configurator) {
- types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(keeper.NewDefaultPermissionKeeper(am.keeper)))
+ types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper))
types.RegisterQueryServer(cfg.QueryServer(), NewQuerier(am.keeper))
- m := keeper.NewMigrator(*am.keeper)
+ m := keeper.NewMigrator(*am.keeper, am.legacySubspace)
err := cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2)
if err != nil {
panic(err)
}
+ err = cfg.RegisterMigration(types.ModuleName, 2, m.Migrate2to3)
+ if err != nil {
+ panic(err)
+ }
}
// RegisterInvariants registers the wasm module invariants.
@@ -200,6 +209,8 @@ func (AppModule) GenerateGenesisState(simState *module.SimulationState) {
}
// ProposalContents doesn't return any content functions for governance proposals.
+//
+//nolint:staticcheck
func (am AppModule) ProposalContents(simState module.SimulationState) []simtypes.WeightedProposalContent {
return simulation.ProposalContents(am.bankKeeper, am.keeper)
}
diff --git a/x/wasm/module_integration_test.go b/x/wasm/module_integration_test.go
deleted file mode 100644
index 50af758f3e..0000000000
--- a/x/wasm/module_integration_test.go
+++ /dev/null
@@ -1,31 +0,0 @@
-package wasm_test
-
-import (
- "testing"
-
- tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
- sdk "github.com/cosmos/cosmos-sdk/types"
- "github.com/cosmos/cosmos-sdk/types/module"
- upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
- "github.com/stretchr/testify/assert"
- "github.com/stretchr/testify/require"
-
- "github.com/CosmWasm/wasmd/app"
- "github.com/CosmWasm/wasmd/x/wasm"
-)
-
-func TestModuleMigrations(t *testing.T) {
- wasmApp := app.Setup(t)
- ctx := wasmApp.BaseApp.NewContext(false, tmproto.Header{})
- upgradeHandler := func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
- return wasmApp.ModuleManager.RunMigrations(ctx, wasmApp.Configurator(), fromVM)
- }
- fromVM := wasmApp.UpgradeKeeper.GetModuleVersionMap(ctx)
- fromVM[wasm.ModuleName] = 1 // start with initial version
- upgradeHandler(ctx, upgradetypes.Plan{Name: "testing"}, fromVM)
- // when
- gotVM, err := wasmApp.ModuleManager.RunMigrations(ctx, wasmApp.Configurator(), fromVM)
- // then
- require.NoError(t, err)
- assert.Equal(t, uint64(2), gotVM[wasm.ModuleName])
-}
diff --git a/x/wasm/module_test.go b/x/wasm/module_test.go
index 772e14752e..9419712f12 100644
--- a/x/wasm/module_test.go
+++ b/x/wasm/module_test.go
@@ -25,11 +25,24 @@ import (
"github.com/stretchr/testify/require"
"github.com/CosmWasm/wasmd/app/params"
+ "github.com/CosmWasm/wasmd/x/wasm/exported"
"github.com/CosmWasm/wasmd/x/wasm/keeper"
"github.com/CosmWasm/wasmd/x/wasm/keeper/testdata"
"github.com/CosmWasm/wasmd/x/wasm/types"
)
+type mockSubspace struct {
+ ps types.Params
+}
+
+func newMockSubspace(ps types.Params) mockSubspace {
+ return mockSubspace{ps: ps}
+}
+
+func (ms mockSubspace) GetParamSet(ctx sdk.Context, ps exported.ParamSet) {
+ *ps.(*types.Params) = ms.ps
+}
+
type testData struct {
module AppModule
ctx sdk.Context
@@ -51,7 +64,7 @@ func setupTest(t *testing.T) testData {
queryRouter.SetInterfaceRegistry(encConf.InterfaceRegistry)
serviceRouter.SetInterfaceRegistry(encConf.InterfaceRegistry)
data := testData{
- module: NewAppModule(encConf.Marshaler, keepers.WasmKeeper, keepers.StakingKeeper, keepers.AccountKeeper, keepers.BankKeeper, nil),
+ module: NewAppModule(encConf.Marshaler, keepers.WasmKeeper, keepers.StakingKeeper, keepers.AccountKeeper, keepers.BankKeeper, nil, newMockSubspace(types.DefaultParams())),
ctx: ctx,
acctKeeper: keepers.AccountKeeper,
keeper: *keepers.WasmKeeper,
diff --git a/x/wasm/simulation/proposals.go b/x/wasm/simulation/proposals.go
index 7c1582b467..6c53f3acf7 100644
--- a/x/wasm/simulation/proposals.go
+++ b/x/wasm/simulation/proposals.go
@@ -26,6 +26,7 @@ const (
WeightStoreAndInstantiateContractProposal = "weight_store_and_instantiate_contract_proposal"
)
+//nolint:staticcheck
func ProposalContents(bk BankKeeper, wasmKeeper WasmKeeper) []simtypes.WeightedProposalContent {
return []simtypes.WeightedProposalContent{
// simulation.NewWeightedProposalContent(
@@ -123,6 +124,8 @@ func ProposalContents(bk BankKeeper, wasmKeeper WasmKeeper) []simtypes.WeightedP
// simulate store code proposal (unused now)
// Current problem: out of gas (defaul gaswanted config of gov SimulateMsgSubmitProposal is 10_000_000)
// but this proposal may need more than it
+//
+//nolint:staticcheck
func SimulateStoreCodeProposal(wasmKeeper WasmKeeper) simtypes.ContentSimulatorFn {
return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) simtypes.Content {
simAccount, _ := simtypes.RandomAcc(r, accs)
@@ -146,6 +149,8 @@ func SimulateStoreCodeProposal(wasmKeeper WasmKeeper) simtypes.ContentSimulatorF
}
// Simulate instantiate contract proposal
+//
+//nolint:staticcheck
func SimulateInstantiateContractProposal(bk BankKeeper, wasmKeeper WasmKeeper, codeSelector CodeIDSelector) simtypes.ContentSimulatorFn {
return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) simtypes.Content {
simAccount, _ := simtypes.RandomAcc(r, accs)
@@ -171,6 +176,8 @@ func SimulateInstantiateContractProposal(bk BankKeeper, wasmKeeper WasmKeeper, c
}
// Simulate execute contract proposal
+//
+//nolint:staticcheck
func SimulateExecuteContractProposal(
bk BankKeeper,
wasmKeeper WasmKeeper,
@@ -231,6 +238,8 @@ func DefaultSimulateUpdateAdminProposalContractSelector(
}
// Simulate update admin contract proposal
+//
+//nolint:staticcheck
func SimulateUpdateAdminProposal(wasmKeeper WasmKeeper, contractSelector UpdateAdminContractSelector) simtypes.ContentSimulatorFn {
return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) simtypes.Content {
simAccount, _ := simtypes.RandomAcc(r, accs)
@@ -263,6 +272,8 @@ func DefaultSimulateContractSelector(
}
// Simulate clear admin proposal
+//
+//nolint:staticcheck
func SimulateClearAdminProposal(wasmKeeper WasmKeeper, contractSelector ClearAdminContractSelector) simtypes.ContentSimulatorFn {
return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) simtypes.Content {
ctAddress := contractSelector(ctx, wasmKeeper)
@@ -281,6 +292,8 @@ func SimulateClearAdminProposal(wasmKeeper WasmKeeper, contractSelector ClearAdm
type MigrateContractProposalContractSelector func(sdk.Context, WasmKeeper) sdk.AccAddress
// Simulate migrate contract proposal
+//
+//nolint:staticcheck
func SimulateMigrateContractProposal(wasmKeeper WasmKeeper, contractSelector MigrateContractProposalContractSelector, codeSelector CodeIDSelector) simtypes.ContentSimulatorFn {
return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) simtypes.Content {
ctAddress := contractSelector(ctx, wasmKeeper)
@@ -306,6 +319,8 @@ func SimulateMigrateContractProposal(wasmKeeper WasmKeeper, contractSelector Mig
type SudoContractProposalContractSelector func(sdk.Context, WasmKeeper) sdk.AccAddress
// Simulate sudo contract proposal
+//
+//nolint:staticcheck
func SimulateSudoContractProposal(wasmKeeper WasmKeeper, contractSelector SudoContractProposalContractSelector) simtypes.ContentSimulatorFn {
return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) simtypes.Content {
ctAddress := contractSelector(ctx, wasmKeeper)
@@ -323,6 +338,8 @@ func SimulateSudoContractProposal(wasmKeeper WasmKeeper, contractSelector SudoCo
}
// Simulate pin contract proposal
+//
+//nolint:staticcheck
func SimulatePinContractProposal(wasmKeeper WasmKeeper, codeSelector CodeIDSelector) simtypes.ContentSimulatorFn {
return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) simtypes.Content {
codeID := codeSelector(ctx, wasmKeeper)
@@ -339,6 +356,8 @@ func SimulatePinContractProposal(wasmKeeper WasmKeeper, codeSelector CodeIDSelec
}
// Simulate unpin contract proposal
+//
+//nolint:staticcheck
func SimulateUnpinContractProposal(wasmKeeper WasmKeeper, codeSelector CodeIDSelector) simtypes.ContentSimulatorFn {
return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) simtypes.Content {
codeID := codeSelector(ctx, wasmKeeper)
@@ -355,6 +374,8 @@ func SimulateUnpinContractProposal(wasmKeeper WasmKeeper, codeSelector CodeIDSel
}
// Simulate update instantiate config proposal
+//
+//nolint:staticcheck
func SimulateUpdateInstantiateConfigProposal(wasmKeeper WasmKeeper, codeSelector CodeIDSelector) simtypes.ContentSimulatorFn {
return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) simtypes.Content {
codeID := codeSelector(ctx, wasmKeeper)
@@ -379,6 +400,7 @@ func SimulateUpdateInstantiateConfigProposal(wasmKeeper WasmKeeper, codeSelector
}
}
+//nolint:staticcheck
func SimulateStoreAndInstantiateContractProposal(wasmKeeper WasmKeeper) simtypes.ContentSimulatorFn {
return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) simtypes.Content {
simAccount, _ := simtypes.RandomAcc(r, accs)
diff --git a/x/wasm/types/codec.go b/x/wasm/types/codec.go
index 0050a677f5..29da4391b2 100644
--- a/x/wasm/types/codec.go
+++ b/x/wasm/types/codec.go
@@ -23,6 +23,7 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { //nolint:staticcheck
cdc.RegisterConcrete(&MsgUpdateAdmin{}, "wasm/MsgUpdateAdmin", nil)
cdc.RegisterConcrete(&MsgClearAdmin{}, "wasm/MsgClearAdmin", nil)
cdc.RegisterConcrete(&MsgUpdateInstantiateConfig{}, "wasm/MsgUpdateInstantiateConfig", nil)
+ cdc.RegisterConcrete(&MsgUpdateParams{}, "wasm/MsgUpdateParams", nil)
cdc.RegisterConcrete(&PinCodesProposal{}, "wasm/PinCodesProposal", nil)
cdc.RegisterConcrete(&UnpinCodesProposal{}, "wasm/UnpinCodesProposal", nil)
@@ -66,6 +67,7 @@ func RegisterInterfaces(registry types.InterfaceRegistry) {
&MsgIBCCloseChannel{},
&MsgIBCSend{},
&MsgUpdateInstantiateConfig{},
+ &MsgUpdateParams{},
)
registry.RegisterImplementations(
(*v1beta1.Content)(nil),
diff --git a/x/wasm/types/keys.go b/x/wasm/types/keys.go
index 95078e1445..ec4f4082a9 100644
--- a/x/wasm/types/keys.go
+++ b/x/wasm/types/keys.go
@@ -33,6 +33,7 @@ var (
PinnedCodeIndexPrefix = []byte{0x07}
TXCounterPrefix = []byte{0x08}
ContractsByCreatorPrefix = []byte{0x09}
+ ParamsKey = []byte{0x10}
KeyLastCodeID = append(SequenceKeyPrefix, []byte("lastCodeId")...)
KeyLastInstanceID = append(SequenceKeyPrefix, []byte("lastContractId")...)
diff --git a/x/wasm/types/params.go b/x/wasm/types/params.go
index ef89bc0609..d06ba7e205 100644
--- a/x/wasm/types/params.go
+++ b/x/wasm/types/params.go
@@ -6,17 +6,11 @@ import (
errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
- paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/cosmos/gogoproto/jsonpb"
"github.com/pkg/errors"
"gopkg.in/yaml.v2"
)
-var (
- ParamStoreKeyUploadAccess = []byte("uploadAccess")
- ParamStoreKeyInstantiateAccess = []byte("instantiateAccess")
-)
-
var AllAccessTypes = []AccessType{
AccessTypeNobody,
AccessTypeOnlyAddress,
@@ -98,11 +92,6 @@ var (
AllowNobody = AccessConfig{Permission: AccessTypeNobody}
)
-// Deprecated: Type declaration for parameters
-func ParamKeyTable() paramtypes.KeyTable {
- return paramtypes.NewKeyTable().RegisterParamSet(&Params{})
-}
-
// DefaultParams returns default wasm parameters
func DefaultParams() Params {
return Params{
@@ -119,14 +108,6 @@ func (p Params) String() string {
return string(out)
}
-// ParamSetPairs returns the parameter set pairs.
-func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs {
- return paramtypes.ParamSetPairs{
- paramtypes.NewParamSetPair(ParamStoreKeyUploadAccess, &p.CodeUploadAccess, validateAccessConfig),
- paramtypes.NewParamSetPair(ParamStoreKeyInstantiateAccess, &p.InstantiateDefaultPermission, validateAccessType),
- }
-}
-
// ValidateBasic performs basic validation on wasm parameters
func (p Params) ValidateBasic() error {
if err := validateAccessType(p.InstantiateDefaultPermission); err != nil {
diff --git a/x/wasm/types/params_legacy.go b/x/wasm/types/params_legacy.go
new file mode 100644
index 0000000000..db38cb8bee
--- /dev/null
+++ b/x/wasm/types/params_legacy.go
@@ -0,0 +1,26 @@
+/*
+NOTE: Usage of x/params to manage parameters is deprecated in favor of x/gov
+controlled execution of MsgUpdateParams messages. These types remains solely
+for migration purposes and will be removed in a future release.
+*/
+package types
+
+import paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
+
+var (
+ ParamStoreKeyUploadAccess = []byte("uploadAccess")
+ ParamStoreKeyInstantiateAccess = []byte("instantiateAccess")
+)
+
+// Deprecated: Type declaration for parameters
+func ParamKeyTable() paramtypes.KeyTable {
+ return paramtypes.NewKeyTable().RegisterParamSet(&Params{})
+}
+
+// ParamSetPairs returns the parameter set pairs.
+func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs {
+ return paramtypes.ParamSetPairs{
+ paramtypes.NewParamSetPair(ParamStoreKeyUploadAccess, &p.CodeUploadAccess, validateAccessConfig),
+ paramtypes.NewParamSetPair(ParamStoreKeyInstantiateAccess, &p.InstantiateDefaultPermission, validateAccessType),
+ }
+}
diff --git a/x/wasm/types/tx.go b/x/wasm/types/tx.go
index 69f9a2f799..ad8ac938fd 100644
--- a/x/wasm/types/tx.go
+++ b/x/wasm/types/tx.go
@@ -446,3 +446,27 @@ func (msg MsgUpdateInstantiateConfig) GetSigners() []sdk.AccAddress {
}
return []sdk.AccAddress{senderAddr}
}
+
+func (msg MsgUpdateParams) Route() string {
+ return RouterKey
+}
+
+func (msg MsgUpdateParams) Type() string {
+ return "update-params"
+}
+
+func (msg MsgUpdateParams) GetSigners() []sdk.AccAddress {
+ authority, err := sdk.AccAddressFromBech32(msg.Authority)
+ if err != nil { // should never happen as valid basic rejects invalid addresses
+ panic(err.Error())
+ }
+ return []sdk.AccAddress{authority}
+}
+
+func (msg MsgUpdateParams) GetSignBytes() []byte {
+ return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg))
+}
+
+func (msg MsgUpdateParams) ValidateBasic() error {
+ return msg.Params.ValidateBasic()
+}
diff --git a/x/wasm/types/tx.pb.go b/x/wasm/types/tx.pb.go
index 2bdbbde8bf..a97615f13c 100644
--- a/x/wasm/types/tx.pb.go
+++ b/x/wasm/types/tx.pb.go
@@ -10,6 +10,7 @@ import (
math "math"
math_bits "math/bits"
+ _ "github.com/cosmos/cosmos-proto"
github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
types "github.com/cosmos/cosmos-sdk/types"
_ "github.com/cosmos/cosmos-sdk/types/msgservice"
@@ -790,6 +791,100 @@ func (m *MsgUpdateInstantiateConfigResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_MsgUpdateInstantiateConfigResponse proto.InternalMessageInfo
+// MsgUpdateParams is the Msg/UpdateParams request type.
+//
+// Since: 0.40
+type MsgUpdateParams struct {
+ // authority is the address of the governance account.
+ Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"`
+ // params defines the x/wasm parameters to update.
+ //
+ // NOTE: All parameters must be supplied.
+ Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"`
+}
+
+func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} }
+func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) }
+func (*MsgUpdateParams) ProtoMessage() {}
+func (*MsgUpdateParams) Descriptor() ([]byte, []int) {
+ return fileDescriptor_4f74d82755520264, []int{16}
+}
+
+func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+
+func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_MsgUpdateParams.Marshal(b, m, deterministic)
+ } else {
+ b = b[:cap(b)]
+ n, err := m.MarshalToSizedBuffer(b)
+ if err != nil {
+ return nil, err
+ }
+ return b[:n], nil
+ }
+}
+
+func (m *MsgUpdateParams) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_MsgUpdateParams.Merge(m, src)
+}
+
+func (m *MsgUpdateParams) XXX_Size() int {
+ return m.Size()
+}
+
+func (m *MsgUpdateParams) XXX_DiscardUnknown() {
+ xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo
+
+// MsgUpdateParamsResponse defines the response structure for executing a
+// MsgUpdateParams message.
+//
+// Since: 0.40
+type MsgUpdateParamsResponse struct{}
+
+func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} }
+func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) }
+func (*MsgUpdateParamsResponse) ProtoMessage() {}
+func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) {
+ return fileDescriptor_4f74d82755520264, []int{17}
+}
+
+func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+
+func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_MsgUpdateParamsResponse.Marshal(b, m, deterministic)
+ } else {
+ b = b[:cap(b)]
+ n, err := m.MarshalToSizedBuffer(b)
+ if err != nil {
+ return nil, err
+ }
+ return b[:n], nil
+ }
+}
+
+func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src)
+}
+
+func (m *MsgUpdateParamsResponse) XXX_Size() int {
+ return m.Size()
+}
+
+func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() {
+ xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo
+
func init() {
proto.RegisterType((*MsgStoreCode)(nil), "cosmwasm.wasm.v1.MsgStoreCode")
proto.RegisterType((*MsgStoreCodeResponse)(nil), "cosmwasm.wasm.v1.MsgStoreCodeResponse")
@@ -807,71 +902,80 @@ func init() {
proto.RegisterType((*MsgClearAdminResponse)(nil), "cosmwasm.wasm.v1.MsgClearAdminResponse")
proto.RegisterType((*MsgUpdateInstantiateConfig)(nil), "cosmwasm.wasm.v1.MsgUpdateInstantiateConfig")
proto.RegisterType((*MsgUpdateInstantiateConfigResponse)(nil), "cosmwasm.wasm.v1.MsgUpdateInstantiateConfigResponse")
+ proto.RegisterType((*MsgUpdateParams)(nil), "cosmwasm.wasm.v1.MsgUpdateParams")
+ proto.RegisterType((*MsgUpdateParamsResponse)(nil), "cosmwasm.wasm.v1.MsgUpdateParamsResponse")
}
func init() { proto.RegisterFile("cosmwasm/wasm/v1/tx.proto", fileDescriptor_4f74d82755520264) }
var fileDescriptor_4f74d82755520264 = []byte{
- // 935 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x56, 0x4f, 0x6f, 0xe3, 0x44,
- 0x14, 0x8f, 0x9b, 0x3f, 0x4d, 0x5f, 0xc3, 0x52, 0x99, 0x6c, 0xe3, 0x35, 0xc8, 0x89, 0xc2, 0x6a,
- 0x31, 0x68, 0x71, 0x9a, 0x80, 0x38, 0x70, 0x6b, 0xb2, 0x1c, 0xba, 0x92, 0x61, 0xe5, 0x6a, 0xa9,
- 0x40, 0x48, 0xd1, 0xc4, 0x9e, 0xcc, 0x5a, 0x5b, 0x7b, 0x42, 0x9e, 0xdb, 0xa4, 0x07, 0x2e, 0x7c,
- 0x02, 0xee, 0x5c, 0x39, 0x71, 0xe2, 0x3b, 0xc0, 0xa1, 0x5c, 0xd0, 0x1e, 0x39, 0x15, 0x48, 0x0f,
- 0x7c, 0x07, 0x4e, 0xc8, 0x7f, 0xeb, 0xa4, 0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 0x41, 0xc9, 0x0f, 0xd7, 0x41, 0xa5, 0xcd, 0xac, 0xde, 0x31, 0xd9, 0x66, 0x56, 0x50,
- 0x39, 0x66, 0xf2, 0x6e, 0x82, 0xcf, 0x60, 0x3b, 0xdd, 0xf2, 0xad, 0x4c, 0xe1, 0x14, 0x42, 0x56,
- 0x6f, 0x43, 0x24, 0xaa, 0x3f, 0x05, 0x48, 0xf5, 0x70, 0x33, 0x53, 0xee, 0x0a, 0x20, 0xbf, 0x75,
- 0x0b, 0x20, 0xd1, 0xfb, 0x15, 0x34, 0xf2, 0xfa, 0xf5, 0xe1, 0x0d, 0xce, 0x5d, 0x43, 0xcb, 0xef,
- 0xbf, 0x0c, 0x3a, 0x36, 0xdf, 0x7f, 0x74, 0xfe, 0x87, 0x52, 0x38, 0x5f, 0x28, 0xc2, 0x8b, 0x85,
- 0x22, 0xfc, 0xbe, 0x50, 0x84, 0x6f, 0x2e, 0x95, 0xc2, 0x8b, 0x4b, 0xa5, 0xf0, 0xeb, 0xa5, 0x52,
- 0xf8, 0xfc, 0x41, 0x6a, 0x1c, 0x0d, 0x38, 0x3a, 0x47, 0xf1, 0x9b, 0xdc, 0xea, 0xcc, 0xc3, 0xb7,
- 0x79, 0x30, 0x92, 0x46, 0x95, 0xe0, 0x65, 0xfe, 0xde, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x36,
- 0x28, 0x5f, 0x2d, 0x35, 0x0c, 0x00, 0x00,
+ // 1043 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x57, 0xcf, 0x6f, 0xe3, 0x44,
+ 0x14, 0xae, 0x9b, 0x1f, 0x4d, 0x5e, 0x42, 0xb7, 0x32, 0xd9, 0xc6, 0x35, 0xc8, 0x09, 0x61, 0xb5,
+ 0x64, 0xd1, 0x6e, 0xd2, 0x04, 0xd4, 0xc3, 0xde, 0x9a, 0x2c, 0x87, 0x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 0x2a, 0xb1, 0x71, 0x33, 0x80, 0xf8, 0xce, 0x0a, 0x40, 0xc8, 0xfb, 0x39,
+ 0x94, 0x93, 0x8e, 0x97, 0x87, 0x4b, 0xc4, 0xdd, 0x42, 0x8b, 0xef, 0xbf, 0x0a, 0x3a, 0x4c, 0xff,
+ 0x1c, 0x8a, 0x73, 0x0d, 0xff, 0xd6, 0x12, 0x16, 0x0f, 0x22, 0x3e, 0x58, 0x09, 0x09, 0xd8, 0x3b,
+ 0x4f, 0xae, 0xfe, 0x90, 0x36, 0xae, 0xa6, 0x12, 0xf7, 0x72, 0x2a, 0x71, 0xbf, 0x4f, 0x25, 0xee,
+ 0xcb, 0x1b, 0x69, 0xe3, 0xe5, 0x8d, 0xb4, 0xf1, 0xeb, 0x8d, 0xb4, 0xf1, 0xe9, 0xfd, 0xc8, 0xdd,
+ 0xdc, 0xb5, 0x89, 0x79, 0x1a, 0xbc, 0xbb, 0x68, 0xcd, 0x89, 0xf7, 0x0e, 0xc3, 0xee, 0xe7, 0x7e,
+ 0x96, 0xbd, 0xa6, 0xbc, 0xf7, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd3, 0x7b, 0x0a, 0x47, 0x5d,
+ 0x0d, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@@ -906,6 +1010,11 @@ type MsgClient interface {
ClearAdmin(ctx context.Context, in *MsgClearAdmin, opts ...grpc.CallOption) (*MsgClearAdminResponse, error)
// UpdateInstantiateConfig updates instantiate config for a smart contract
UpdateInstantiateConfig(ctx context.Context, in *MsgUpdateInstantiateConfig, opts ...grpc.CallOption) (*MsgUpdateInstantiateConfigResponse, error)
+ // UpdateParams defines a governance operation for updating the x/wasm
+ // module parameters. The authority is defined in the keeper.
+ //
+ // Since: 0.40
+ UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error)
}
type msgClient struct {
@@ -988,6 +1097,15 @@ func (c *msgClient) UpdateInstantiateConfig(ctx context.Context, in *MsgUpdateIn
return out, nil
}
+func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) {
+ out := new(MsgUpdateParamsResponse)
+ err := c.cc.Invoke(ctx, "/cosmwasm.wasm.v1.Msg/UpdateParams", in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
// MsgServer is the server API for Msg service.
type MsgServer interface {
// StoreCode to submit Wasm code to the system
@@ -1008,6 +1126,11 @@ type MsgServer interface {
ClearAdmin(context.Context, *MsgClearAdmin) (*MsgClearAdminResponse, error)
// UpdateInstantiateConfig updates instantiate config for a smart contract
UpdateInstantiateConfig(context.Context, *MsgUpdateInstantiateConfig) (*MsgUpdateInstantiateConfigResponse, error)
+ // UpdateParams defines a governance operation for updating the x/wasm
+ // module parameters. The authority is defined in the keeper.
+ //
+ // Since: 0.40
+ UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
}
// UnimplementedMsgServer can be embedded to have forward compatible implementations.
@@ -1045,6 +1168,10 @@ func (*UnimplementedMsgServer) UpdateInstantiateConfig(ctx context.Context, req
return nil, status.Errorf(codes.Unimplemented, "method UpdateInstantiateConfig not implemented")
}
+func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
+}
+
func RegisterMsgServer(s grpc1.Server, srv MsgServer) {
s.RegisterService(&_Msg_serviceDesc, srv)
}
@@ -1193,6 +1320,24 @@ func _Msg_UpdateInstantiateConfig_Handler(srv interface{}, ctx context.Context,
return interceptor(ctx, in, info, handler)
}
+func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(MsgUpdateParams)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(MsgServer).UpdateParams(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: "/cosmwasm.wasm.v1.Msg/UpdateParams",
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
var _Msg_serviceDesc = grpc.ServiceDesc{
ServiceName: "cosmwasm.wasm.v1.Msg",
HandlerType: (*MsgServer)(nil),
@@ -1229,6 +1374,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{
MethodName: "UpdateInstantiateConfig",
Handler: _Msg_UpdateInstantiateConfig_Handler,
},
+ {
+ MethodName: "UpdateParams",
+ Handler: _Msg_UpdateParams_Handler,
+ },
},
Streams: []grpc.StreamDesc{},
Metadata: "cosmwasm/wasm/v1/tx.proto",
@@ -1913,6 +2062,69 @@ func (m *MsgUpdateInstantiateConfigResponse) MarshalToSizedBuffer(dAtA []byte) (
return len(dAtA) - i, nil
}
+func (m *MsgUpdateParams) Marshal() (dAtA []byte, err error) {
+ size := m.Size()
+ dAtA = make([]byte, size)
+ n, err := m.MarshalToSizedBuffer(dAtA[:size])
+ if err != nil {
+ return nil, err
+ }
+ return dAtA[:n], nil
+}
+
+func (m *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ {
+ size, err := m.Params.MarshalToSizedBuffer(dAtA[:i])
+ if err != nil {
+ return 0, err
+ }
+ i -= size
+ i = encodeVarintTx(dAtA, i, uint64(size))
+ }
+ i--
+ dAtA[i] = 0x12
+ if len(m.Authority) > 0 {
+ i -= len(m.Authority)
+ copy(dAtA[i:], m.Authority)
+ i = encodeVarintTx(dAtA, i, uint64(len(m.Authority)))
+ i--
+ dAtA[i] = 0xa
+ }
+ return len(dAtA) - i, nil
+}
+
+func (m *MsgUpdateParamsResponse) Marshal() (dAtA []byte, err error) {
+ size := m.Size()
+ dAtA = make([]byte, size)
+ n, err := m.MarshalToSizedBuffer(dAtA[:size])
+ if err != nil {
+ return nil, err
+ }
+ return dAtA[:n], nil
+}
+
+func (m *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ return len(dAtA) - i, nil
+}
+
func encodeVarintTx(dAtA []byte, offset int, v uint64) int {
offset -= sovTx(v)
base := offset
@@ -2233,6 +2445,30 @@ func (m *MsgUpdateInstantiateConfigResponse) Size() (n int) {
return n
}
+func (m *MsgUpdateParams) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ l = len(m.Authority)
+ if l > 0 {
+ n += 1 + l + sovTx(uint64(l))
+ }
+ l = m.Params.Size()
+ n += 1 + l + sovTx(uint64(l))
+ return n
+}
+
+func (m *MsgUpdateParamsResponse) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ return n
+}
+
func sovTx(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
@@ -4328,6 +4564,173 @@ func (m *MsgUpdateInstantiateConfigResponse) Unmarshal(dAtA []byte) error {
return nil
}
+func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error {
+ l := len(dAtA)
+ iNdEx := 0
+ for iNdEx < l {
+ preIndex := iNdEx
+ var wire uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowTx
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ wire |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ fieldNum := int32(wire >> 3)
+ wireType := int(wire & 0x7)
+ if wireType == 4 {
+ return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowTx
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ stringLen |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
+ return ErrInvalidLengthTx
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return ErrInvalidLengthTx
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.Authority = string(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ case 2:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType)
+ }
+ var msglen int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowTx
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ msglen |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if msglen < 0 {
+ return ErrInvalidLengthTx
+ }
+ postIndex := iNdEx + msglen
+ if postIndex < 0 {
+ return ErrInvalidLengthTx
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ return err
+ }
+ iNdEx = postIndex
+ default:
+ iNdEx = preIndex
+ skippy, err := skipTx(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthTx
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
+
+func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error {
+ l := len(dAtA)
+ iNdEx := 0
+ for iNdEx < l {
+ preIndex := iNdEx
+ var wire uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowTx
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ wire |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ fieldNum := int32(wire >> 3)
+ wireType := int(wire & 0x7)
+ if wireType == 4 {
+ return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ default:
+ iNdEx = preIndex
+ skippy, err := skipTx(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthTx
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
+
func skipTx(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0