diff --git a/app/app.go b/app/app.go index ae85609d..0b30ca8a 100644 --- a/app/app.go +++ b/app/app.go @@ -58,6 +58,9 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/cosmos/cosmos-sdk/x/auth/vesting" vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" + "github.com/cosmos/cosmos-sdk/x/authz" + authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" + authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module" "github.com/cosmos/cosmos-sdk/x/bank" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" @@ -234,6 +237,7 @@ type App struct { ParamsKeeper paramskeeper.Keeper EvidenceKeeper evidencekeeper.Keeper FeeGrantKeeper feegrantkeeper.Keeper + AuthzKeeper authzkeeper.Keeper ScopedIBCKeeper capabilitykeeper.ScopedKeeper ScopedICAHostKeeper capabilitykeeper.ScopedKeeper @@ -339,6 +343,7 @@ func New( metrixmoduletypes.StoreKey, wasmtypes.StoreKey, palomamoduletypes.StoreKey, + authzkeeper.StoreKey, ) tkeys := storetypes.NewTransientStoreKeys(paramstypes.TStoreKey) memKeys := storetypes.NewMemoryStoreKeys( @@ -732,6 +737,8 @@ func New( }), ) + app.AuthzKeeper = authzkeeper.NewKeeper(runtime.NewKVStoreService(keys[authzkeeper.StoreKey]), appCodec, app.MsgServiceRouter(), app.AccountKeeper) + // register wasm gov proposal types // enabledProposals := GetEnabledProposals() // if len(enabledProposals) != 0 { @@ -830,6 +837,7 @@ func New( ica.NewAppModule(&app.ICAControllerKeeper, &app.ICAHostKeeper), consensus.NewAppModule(appCodec, app.ConsensusParamsKeeper), ibctm.NewAppModule(), + authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), ) app.ModuleManager.RegisterInvariants(app.CrisisKeeper) @@ -867,6 +875,7 @@ func New( authtypes.ModuleName, vestingtypes.ModuleName, genutiltypes.ModuleName, + authz.ModuleName, valsetmoduletypes.ModuleName, palomamoduletypes.ModuleName, evmmoduletypes.ModuleName, @@ -935,6 +944,7 @@ func New( vestingtypes.ModuleName, genutiltypes.ModuleName, evidencetypes.ModuleName, + authz.ModuleName, ibctransfertypes.ModuleName, schedulermoduletypes.ModuleName, consensusmoduletypes.ModuleName, diff --git a/app/upgrades.go b/app/upgrades.go index b46a4f7d..d8c6346f 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -9,6 +9,7 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" + authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" consensustypes "github.com/cosmos/cosmos-sdk/x/consensus/types" crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" @@ -160,6 +161,17 @@ func (app *App) RegisterUpgradeHandlers(semverVersion string) { app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades)) } + if upgradeInfo.Name == "v2.2.1" && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { + storeUpgrades := storetypes.StoreUpgrades{ + Added: []string{ + authzkeeper.StoreKey, + }, + } + + // configure store loader that checks if version == upgradeHeight and applies store upgrades + app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades)) + } + app.UpgradeKeeper.SetUpgradeHandler(semverVersion, func(ctx context.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { return app.ModuleManager.RunMigrations(ctx, app.configurator, fromVM) })