From 4b42ba8a6b874f1370dd39c1bd1dfa9a4753eca9 Mon Sep 17 00:00:00 2001 From: Abhishek Agrawal Date: Fri, 25 Feb 2022 19:33:43 +0530 Subject: [PATCH 01/12] cosmwasm permission added --- app/app.go | 45 ++++++++++++++++++++++++++++--- node/cmd/root.go | 5 ++-- testutil/network/network.go | 2 ++ x/wasm/client/proposal_handler.go | 21 +++++++++++++++ 4 files changed, 67 insertions(+), 6 deletions(-) create mode 100644 x/wasm/client/proposal_handler.go diff --git a/app/app.go b/app/app.go index 7c4df66af..e35bfa3fa 100644 --- a/app/app.go +++ b/app/app.go @@ -6,6 +6,7 @@ import ( "io" "os" "path/filepath" + "strings" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" @@ -99,6 +100,7 @@ import ( "github.com/CosmWasm/wasmd/x/wasm" wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" + wasmclient "github.com/comdex-official/comdex/x/wasm/client" ) const ( @@ -106,6 +108,35 @@ const ( Name = "comdex" ) +var ( + // If EnableSpecificWasmProposals is "", and this is "true", then enable all x/wasm proposals. + // If EnableSpecificWasmProposals is "", and this is not "true", then disable all x/wasm proposals. + WasmProposalsEnabled = "true" + // If set to non-empty string it must be comma-separated list of values that are all a subset + // of "EnableAllProposals" (takes precedence over WasmProposalsEnabled) + // https://github.com/CosmWasm/wasmd/blob/02a54d33ff2c064f3539ae12d75d027d9c665f05/x/wasm/internal/types/proposal.go#L28-L34 + EnableSpecificWasmProposals = "" + // use this for clarity in argument list + EmptyWasmOpts []wasm.Option +) + +// GetWasmEnabledProposals parses the WasmProposalsEnabled / EnableSpecificWasmProposals values to +// produce a list of enabled proposals to pass into wasmd app. +func GetWasmEnabledProposals() []wasm.ProposalType { + if EnableSpecificWasmProposals == "" { + if WasmProposalsEnabled == "true" { + return wasm.EnableAllProposals + } + return wasm.DisableAllProposals + } + chunks := strings.Split(EnableSpecificWasmProposals, ",") + proposals, err := wasm.ConvertToProposals(chunks) + if err != nil { + panic(err) + } + return proposals +} + var ( // DefaultNodeHome default home directories for the application daemon DefaultNodeHome string @@ -122,10 +153,12 @@ var ( mint.AppModuleBasic{}, distr.AppModuleBasic{}, gov.NewAppModuleBasic( - paramsclient.ProposalHandler, - distrclient.ProposalHandler, - upgradeclient.ProposalHandler, - upgradeclient.CancelProposalHandler, + append( + wasmclient.ProposalHandlers, + paramsclient.ProposalHandler, + distrclient.ProposalHandler, + upgradeclient.ProposalHandler, + upgradeclient.CancelProposalHandler)..., ), params.AppModuleBasic{}, crisis.AppModuleBasic{}, @@ -220,6 +253,7 @@ func New( invCheckPeriod uint, encoding EncodingConfig, appOptions servertypes.AppOptions, + wasmEnabledProposals []wasm.ProposalType, wasmOpts []wasm.Option, baseAppOptions ...func(*baseapp.BaseApp), ) *App { @@ -482,6 +516,9 @@ func New( wasmOpts..., ) + if len(wasmEnabledProposals) != 0 { + govRouter.AddRoute(wasm.RouterKey, wasm.NewWasmProposalHandler(app.wasmKeeper, wasmEnabledProposals)) + } /**** Module Options ****/ // NOTE: we may consider parsing `appOpts` inside module constructors. For the moment diff --git a/node/cmd/root.go b/node/cmd/root.go index b00bcf903..de11b50af 100644 --- a/node/cmd/root.go +++ b/node/cmd/root.go @@ -177,6 +177,7 @@ func appCreatorFunc(logger log.Logger, db tmdb.DB, tracer io.Writer, options ser cast.ToUint(options.Get(server.FlagInvCheckPeriod)), comdex.MakeEncodingConfig(), options, + comdex.GetWasmEnabledProposals(), wasmOpts, baseapp.SetPruning(pruningOptions), baseapp.SetMinGasPrices(cast.ToString(options.Get(server.FlagMinGasPrices))), @@ -203,13 +204,13 @@ func appExportFunc(logger log.Logger, db tmdb.DB, tracer io.Writer, height int64 var emptyWasmOpts []wasm.Option var app *comdex.App if height != -1 { - app = comdex.New(logger, db, tracer, false, map[int64]bool{}, homePath, cast.ToUint(options.Get(server.FlagInvCheckPeriod)), config, options, emptyWasmOpts) + app = comdex.New(logger, db, tracer, false, map[int64]bool{}, homePath, cast.ToUint(options.Get(server.FlagInvCheckPeriod)), config, options, comdex.GetWasmEnabledProposals(), emptyWasmOpts) if err := app.LoadHeight(height); err != nil { return servertypes.ExportedApp{}, err } } else { - app = comdex.New(logger, db, tracer, true, map[int64]bool{}, homePath, cast.ToUint(options.Get(server.FlagInvCheckPeriod)), config, options, emptyWasmOpts) + app = comdex.New(logger, db, tracer, true, map[int64]bool{}, homePath, cast.ToUint(options.Get(server.FlagInvCheckPeriod)), config, options, comdex.GetWasmEnabledProposals(), emptyWasmOpts) } return app.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs) diff --git a/testutil/network/network.go b/testutil/network/network.go index 7f5e74a19..939fde5d2 100644 --- a/testutil/network/network.go +++ b/testutil/network/network.go @@ -57,6 +57,8 @@ func DefaultConfig() network.Config { val.Ctx.Logger, tmdb.NewMemDB(), nil, true, map[int64]bool{}, val.Ctx.Config.RootDir, 0, encoding, simapp.EmptyAppOptions{}, + comdex.GetWasmEnabledProposals(), + comdex.EmptyWasmOpts, baseapp.SetPruning(storetypes.NewPruningOptionsFromString(val.AppConfig.Pruning)), baseapp.SetMinGasPrices(val.AppConfig.MinGasPrices), ) diff --git a/x/wasm/client/proposal_handler.go b/x/wasm/client/proposal_handler.go new file mode 100644 index 000000000..ad3363ac7 --- /dev/null +++ b/x/wasm/client/proposal_handler.go @@ -0,0 +1,21 @@ +package client + +import ( + govclient "github.com/cosmos/cosmos-sdk/x/gov/client" + + "github.com/CosmWasm/wasmd/x/wasm/client/cli" + "github.com/CosmWasm/wasmd/x/wasm/client/rest" +) + +// ProposalHandlers define the wasm cli proposal types and rest handler. +var ProposalHandlers = []govclient.ProposalHandler{ + govclient.NewProposalHandler(cli.ProposalStoreCodeCmd, rest.StoreCodeProposalHandler), + govclient.NewProposalHandler(cli.ProposalInstantiateContractCmd, rest.InstantiateProposalHandler), + govclient.NewProposalHandler(cli.ProposalMigrateContractCmd, rest.MigrateProposalHandler), + govclient.NewProposalHandler(cli.ProposalExecuteContractCmd, rest.ExecuteProposalHandler), + govclient.NewProposalHandler(cli.ProposalSudoContractCmd, rest.SudoProposalHandler), + govclient.NewProposalHandler(cli.ProposalUpdateContractAdminCmd, rest.UpdateContractAdminProposalHandler), + govclient.NewProposalHandler(cli.ProposalClearContractAdminCmd, rest.ClearContractAdminProposalHandler), + govclient.NewProposalHandler(cli.ProposalPinCodesCmd, rest.PinCodeProposalHandler), + govclient.NewProposalHandler(cli.ProposalUnpinCodesCmd, rest.UnpinCodeProposalHandler), +} From 7d452ee0874e1c19c2bbed994ba74cd21f4c90c0 Mon Sep 17 00:00:00 2001 From: Abhishek Agrawal Date: Fri, 25 Feb 2022 21:07:45 +0530 Subject: [PATCH 02/12] adding ibc router for wasm module --- app/app.go | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/app/app.go b/app/app.go index e35bfa3fa..348303cb0 100644 --- a/app/app.go +++ b/app/app.go @@ -420,16 +420,6 @@ func New( AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.upgradeKeeper)). AddRoute(ibchost.RouterKey, ibcclient.NewClientProposalHandler(app.ibcKeeper.ClientKeeper)) - app.govKeeper = govkeeper.NewKeeper( - app.cdc, - app.keys[govtypes.StoreKey], - app.GetSubspace(govtypes.ModuleName), - app.accountKeeper, - app.bankKeeper, - &stakingKeeper, - govRouter, - ) - // Create Transfer Keepers app.ibcTransferKeeper = ibctransferkeeper.NewKeeper( app.cdc, @@ -449,7 +439,6 @@ func New( ) ibcRouter.AddRoute(ibctransfertypes.ModuleName, transferModule) - app.ibcKeeper.SetRouter(ibcRouter) // Create evidence Keeper for to register the IBC light client misbehaviour evidence route app.evidenceKeeper = *evidencekeeper.NewKeeper( @@ -519,6 +508,20 @@ func New( if len(wasmEnabledProposals) != 0 { govRouter.AddRoute(wasm.RouterKey, wasm.NewWasmProposalHandler(app.wasmKeeper, wasmEnabledProposals)) } + // wire up x/wasm to IBC + ibcRouter.AddRoute(wasm.ModuleName, wasm.NewIBCHandler(app.wasmKeeper, app.ibcKeeper.ChannelKeeper)) + app.ibcKeeper.SetRouter(ibcRouter) + + app.govKeeper = govkeeper.NewKeeper( + app.cdc, + app.keys[govtypes.StoreKey], + app.GetSubspace(govtypes.ModuleName), + app.accountKeeper, + app.bankKeeper, + &stakingKeeper, + govRouter, + ) + /**** Module Options ****/ // NOTE: we may consider parsing `appOpts` inside module constructors. For the moment From 0e42253aef9ac1731210c9c2164ad863a0702693 Mon Sep 17 00:00:00 2001 From: Abhishek Agrawal Date: Tue, 1 Mar 2022 01:44:41 +0530 Subject: [PATCH 03/12] remove proposal handler for execute contract --- x/wasm/client/proposal_handler.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/x/wasm/client/proposal_handler.go b/x/wasm/client/proposal_handler.go index ad3363ac7..8e01d7526 100644 --- a/x/wasm/client/proposal_handler.go +++ b/x/wasm/client/proposal_handler.go @@ -12,10 +12,6 @@ var ProposalHandlers = []govclient.ProposalHandler{ govclient.NewProposalHandler(cli.ProposalStoreCodeCmd, rest.StoreCodeProposalHandler), govclient.NewProposalHandler(cli.ProposalInstantiateContractCmd, rest.InstantiateProposalHandler), govclient.NewProposalHandler(cli.ProposalMigrateContractCmd, rest.MigrateProposalHandler), - govclient.NewProposalHandler(cli.ProposalExecuteContractCmd, rest.ExecuteProposalHandler), - govclient.NewProposalHandler(cli.ProposalSudoContractCmd, rest.SudoProposalHandler), govclient.NewProposalHandler(cli.ProposalUpdateContractAdminCmd, rest.UpdateContractAdminProposalHandler), govclient.NewProposalHandler(cli.ProposalClearContractAdminCmd, rest.ClearContractAdminProposalHandler), - govclient.NewProposalHandler(cli.ProposalPinCodesCmd, rest.PinCodeProposalHandler), - govclient.NewProposalHandler(cli.ProposalUnpinCodesCmd, rest.UnpinCodeProposalHandler), } From f1f477b94c9e2a5cbd746ea1e4bf3aa6ae48509b Mon Sep 17 00:00:00 2001 From: Abhishek Agrawal Date: Tue, 1 Mar 2022 12:26:45 +0530 Subject: [PATCH 04/12] upgrade wasmd version --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index a25f3b7fa..a1371f15d 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/comdex-official/comdex go 1.16 require ( - github.com/CosmWasm/wasmd v0.22.0 + github.com/CosmWasm/wasmd v0.23.0 github.com/bandprotocol/bandchain-packet v0.0.2 github.com/cosmos/cosmos-sdk v0.45.1 github.com/cosmos/ibc-go/v2 v2.0.2 diff --git a/go.sum b/go.sum index 56fb7e36e..9f9016bca 100644 --- a/go.sum +++ b/go.sum @@ -73,6 +73,8 @@ github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQ github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= github.com/CosmWasm/wasmd v0.22.0 h1:6Bn2DDjHvLwZJkYXL+/PRQ9bSll0ReX2IZqRt/BQkhg= github.com/CosmWasm/wasmd v0.22.0/go.mod h1:kNDnMAQDJyVek9k6SxCNijMCzOROzzUGBRT8r/vr7oY= +github.com/CosmWasm/wasmd v0.23.0 h1:yOksa/TORt2BtXjUKKqcJ67d6O+Jv2Y6wT1Ekm1Como= +github.com/CosmWasm/wasmd v0.23.0/go.mod h1:kNDnMAQDJyVek9k6SxCNijMCzOROzzUGBRT8r/vr7oY= github.com/CosmWasm/wasmvm v1.0.0-beta5 h1:38M8z89LB5cFMYB5vfjewMzz9Pr8TB1QBHdjnrWnkas= github.com/CosmWasm/wasmvm v1.0.0-beta5/go.mod h1:mtwKxbmsko1zdwpaKiRkRwxijMmIAtnLaX5/UT2nPFk= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= From 20eaf41102dd8a2895f27d687d93661660fa22ba Mon Sep 17 00:00:00 2001 From: Abhishek Agrawal Date: Wed, 2 Mar 2022 17:01:50 +0530 Subject: [PATCH 05/12] revert the wasmd version to 0.22 --- go.mod | 2 +- go.sum | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/go.mod b/go.mod index a1371f15d..a25f3b7fa 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/comdex-official/comdex go 1.16 require ( - github.com/CosmWasm/wasmd v0.23.0 + github.com/CosmWasm/wasmd v0.22.0 github.com/bandprotocol/bandchain-packet v0.0.2 github.com/cosmos/cosmos-sdk v0.45.1 github.com/cosmos/ibc-go/v2 v2.0.2 diff --git a/go.sum b/go.sum index 9f9016bca..56fb7e36e 100644 --- a/go.sum +++ b/go.sum @@ -73,8 +73,6 @@ github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQ github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= github.com/CosmWasm/wasmd v0.22.0 h1:6Bn2DDjHvLwZJkYXL+/PRQ9bSll0ReX2IZqRt/BQkhg= github.com/CosmWasm/wasmd v0.22.0/go.mod h1:kNDnMAQDJyVek9k6SxCNijMCzOROzzUGBRT8r/vr7oY= -github.com/CosmWasm/wasmd v0.23.0 h1:yOksa/TORt2BtXjUKKqcJ67d6O+Jv2Y6wT1Ekm1Como= -github.com/CosmWasm/wasmd v0.23.0/go.mod h1:kNDnMAQDJyVek9k6SxCNijMCzOROzzUGBRT8r/vr7oY= github.com/CosmWasm/wasmvm v1.0.0-beta5 h1:38M8z89LB5cFMYB5vfjewMzz9Pr8TB1QBHdjnrWnkas= github.com/CosmWasm/wasmvm v1.0.0-beta5/go.mod h1:mtwKxbmsko1zdwpaKiRkRwxijMmIAtnLaX5/UT2nPFk= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= From 3455e7534ac08729bb80c36d7628680c0873447c Mon Sep 17 00:00:00 2001 From: Abhishek Agrawal Date: Wed, 2 Mar 2022 17:15:39 +0530 Subject: [PATCH 06/12] removed custom wasm module, --- app/app.go | 2 +- x/wasm/client/proposal_handler.go | 17 ----------------- 2 files changed, 1 insertion(+), 18 deletions(-) delete mode 100644 x/wasm/client/proposal_handler.go diff --git a/app/app.go b/app/app.go index 348303cb0..65872e425 100644 --- a/app/app.go +++ b/app/app.go @@ -99,8 +99,8 @@ import ( vaulttypes "github.com/comdex-official/comdex/x/vault/types" "github.com/CosmWasm/wasmd/x/wasm" + wasmclient "github.com/CosmWasm/wasmd/x/wasm/client" wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" - wasmclient "github.com/comdex-official/comdex/x/wasm/client" ) const ( diff --git a/x/wasm/client/proposal_handler.go b/x/wasm/client/proposal_handler.go deleted file mode 100644 index 8e01d7526..000000000 --- a/x/wasm/client/proposal_handler.go +++ /dev/null @@ -1,17 +0,0 @@ -package client - -import ( - govclient "github.com/cosmos/cosmos-sdk/x/gov/client" - - "github.com/CosmWasm/wasmd/x/wasm/client/cli" - "github.com/CosmWasm/wasmd/x/wasm/client/rest" -) - -// ProposalHandlers define the wasm cli proposal types and rest handler. -var ProposalHandlers = []govclient.ProposalHandler{ - govclient.NewProposalHandler(cli.ProposalStoreCodeCmd, rest.StoreCodeProposalHandler), - govclient.NewProposalHandler(cli.ProposalInstantiateContractCmd, rest.InstantiateProposalHandler), - govclient.NewProposalHandler(cli.ProposalMigrateContractCmd, rest.MigrateProposalHandler), - govclient.NewProposalHandler(cli.ProposalUpdateContractAdminCmd, rest.UpdateContractAdminProposalHandler), - govclient.NewProposalHandler(cli.ProposalClearContractAdminCmd, rest.ClearContractAdminProposalHandler), -} From b7025bab45b76757b64289261e7662910ab057b8 Mon Sep 17 00:00:00 2001 From: Abhishek Agrawal Date: Fri, 4 Mar 2022 14:38:10 +0530 Subject: [PATCH 07/12] cosmwasm version upgrade --- app/app.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/app.go b/app/app.go index 65872e425..1efe79fda 100644 --- a/app/app.go +++ b/app/app.go @@ -786,7 +786,7 @@ func (a *App) ModuleAccountsPermissions() map[string][]string { } } func (app *App) registerUpgradeHandlers() { - app.upgradeKeeper.SetUpgradeHandler("v0.1.0", func(ctx sdk.Context, plan upgradetypes.Plan, _ module.VersionMap) (module.VersionMap, error) { + app.upgradeKeeper.SetUpgradeHandler("v0.1.2", func(ctx sdk.Context, plan upgradetypes.Plan, _ module.VersionMap) (module.VersionMap, error) { // 1st-time running in-store migrations, using 1 as fromVersion to // avoid running InitGenesis. fromVM := map[string]uint64{ @@ -816,7 +816,7 @@ func (app *App) registerUpgradeHandlers() { if err != nil { panic(err) } - if upgradeInfo.Name == "v0.1.0" && !app.upgradeKeeper.IsSkipHeight(upgradeInfo.Height) { + if upgradeInfo.Name == "v0.1.2" && !app.upgradeKeeper.IsSkipHeight(upgradeInfo.Height) { storeUpgrades := storetypes.StoreUpgrades{ Added: []string{wasmtypes.ModuleName}, } From 29c2ccf4d77ca5b65a5018a009b2df52f36e10d0 Mon Sep 17 00:00:00 2001 From: Abhishek Agrawal Date: Fri, 4 Mar 2022 15:48:15 +0530 Subject: [PATCH 08/12] update wasm module to avoid running genesis --- app/app.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/app.go b/app/app.go index 1efe79fda..0b1ee119e 100644 --- a/app/app.go +++ b/app/app.go @@ -808,6 +808,7 @@ func (app *App) registerUpgradeHandlers() { ibctransfertypes.ModuleName: ibctransfer.AppModule{}.ConsensusVersion(), assettypes.ModuleName: asset.AppModule{}.ConsensusVersion(), vaulttypes.ModuleName: vault.AppModule{}.ConsensusVersion(), + wasmtypes.ModuleName: wasm.AppModule{}.ConsensusVersion(), } return app.mm.RunMigrations(ctx, app.configurator, fromVM) }) @@ -817,9 +818,7 @@ func (app *App) registerUpgradeHandlers() { panic(err) } if upgradeInfo.Name == "v0.1.2" && !app.upgradeKeeper.IsSkipHeight(upgradeInfo.Height) { - storeUpgrades := storetypes.StoreUpgrades{ - Added: []string{wasmtypes.ModuleName}, - } + storeUpgrades := storetypes.StoreUpgrades{} // configure store loader that checks if version == upgradeHeight and applies store upgrades app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades)) From 0b39d95cdc31ab0c5aaebc70d49f2bd158247644 Mon Sep 17 00:00:00 2001 From: Abhishek Agrawal Date: Sun, 6 Mar 2022 11:43:26 +0530 Subject: [PATCH 09/12] set wasm param to nobody --- app/app.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/app.go b/app/app.go index 0b1ee119e..5740fd386 100644 --- a/app/app.go +++ b/app/app.go @@ -808,8 +808,11 @@ func (app *App) registerUpgradeHandlers() { ibctransfertypes.ModuleName: ibctransfer.AppModule{}.ConsensusVersion(), assettypes.ModuleName: asset.AppModule{}.ConsensusVersion(), vaulttypes.ModuleName: vault.AppModule{}.ConsensusVersion(), - wasmtypes.ModuleName: wasm.AppModule{}.ConsensusVersion(), } + //wasm + wasmParams := app.wasmKeeper.GetParams(ctx) + wasmParams.CodeUploadAccess = wasmtypes.AllowNobody + app.wasmKeeper.SetParams(ctx, wasmParams) return app.mm.RunMigrations(ctx, app.configurator, fromVM) }) From e99de70b1573e9955d577283eeac9a008506e4d5 Mon Sep 17 00:00:00 2001 From: Abhishek Agrawal Date: Sun, 6 Mar 2022 13:07:45 +0530 Subject: [PATCH 10/12] added wasm module in store upgrade --- app/app.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/app.go b/app/app.go index 5740fd386..94a5ec724 100644 --- a/app/app.go +++ b/app/app.go @@ -821,7 +821,9 @@ func (app *App) registerUpgradeHandlers() { panic(err) } if upgradeInfo.Name == "v0.1.2" && !app.upgradeKeeper.IsSkipHeight(upgradeInfo.Height) { - storeUpgrades := storetypes.StoreUpgrades{} + storeUpgrades := storetypes.StoreUpgrades{ + Added: []string{wasm.ModuleName}, + } // configure store loader that checks if version == upgradeHeight and applies store upgrades app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades)) From 9c3df6b4f8573ee770660f1dc352450018838a0e Mon Sep 17 00:00:00 2001 From: Abhishek Agrawal Date: Sun, 6 Mar 2022 13:24:56 +0530 Subject: [PATCH 11/12] remove wasm module --- app/app.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/app.go b/app/app.go index 94a5ec724..5740fd386 100644 --- a/app/app.go +++ b/app/app.go @@ -821,9 +821,7 @@ func (app *App) registerUpgradeHandlers() { panic(err) } if upgradeInfo.Name == "v0.1.2" && !app.upgradeKeeper.IsSkipHeight(upgradeInfo.Height) { - storeUpgrades := storetypes.StoreUpgrades{ - Added: []string{wasm.ModuleName}, - } + storeUpgrades := storetypes.StoreUpgrades{} // configure store loader that checks if version == upgradeHeight and applies store upgrades app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades)) From fbf435cf656570718981ec62d035756c693803f2 Mon Sep 17 00:00:00 2001 From: Abhishek Agrawal Date: Sun, 6 Mar 2022 15:06:35 +0530 Subject: [PATCH 12/12] update wasm genesis --- app/app.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/app.go b/app/app.go index 5740fd386..04d621b79 100644 --- a/app/app.go +++ b/app/app.go @@ -809,11 +809,15 @@ func (app *App) registerUpgradeHandlers() { assettypes.ModuleName: asset.AppModule{}.ConsensusVersion(), vaulttypes.ModuleName: vault.AppModule{}.ConsensusVersion(), } + newVM, err := app.mm.RunMigrations(ctx, app.configurator, fromVM) + if err != nil { + return newVM, err + } //wasm wasmParams := app.wasmKeeper.GetParams(ctx) wasmParams.CodeUploadAccess = wasmtypes.AllowNobody app.wasmKeeper.SetParams(ctx, wasmParams) - return app.mm.RunMigrations(ctx, app.configurator, fromVM) + return newVM, err }) upgradeInfo, err := app.upgradeKeeper.ReadUpgradeInfoFromDisk()