From e227e4962aea4e6326a5e007eb8582619ace0268 Mon Sep 17 00:00:00 2001 From: Nathan Baum Date: Fri, 4 Oct 2024 10:45:11 +0100 Subject: [PATCH] Remove unused upgrades --- app/app_upgrades.go | 123 +++----------------------------------------- 1 file changed, 7 insertions(+), 116 deletions(-) diff --git a/app/app_upgrades.go b/app/app_upgrades.go index f879aa30..7c5d79ef 100644 --- a/app/app_upgrades.go +++ b/app/app_upgrades.go @@ -7,7 +7,8 @@ import ( storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" -// "github.com/cosmos/cosmos-sdk/x/authz" + + // "github.com/cosmos/cosmos-sdk/x/authz" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" ) @@ -20,11 +21,7 @@ const GroupModuleName = "group" func (app *App) SetUpgradeHandlers() { setHandlerForVersion_1_0(app) setHandlerForVersion_1_1(app) - setHandlerForVersion_1_2(app) - setHandlerForVersion_1_2_2(app) - setHandlerForVersion_1_2_3(app) - setHandlerForVersion_1_2_4(app) - setHandlerForVersion_1_2_5(app) + setHandlerForVersion_1_9_9(app) } func setHandlerForVersion_1_0(app *App) { @@ -51,7 +48,7 @@ func setHandlerForVersion_1_1(app *App) { app.UpgradeKeeper.SetUpgradeHandler(upgradeVersion, func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { if len(fromVM) == 0 { fromVM = app.mm.GetVersionMap() -// delete(fromVM, authz.ModuleName) + // delete(fromVM, authz.ModuleName) delete(fromVM, GroupModuleName) delete(fromVM, AddressBookModuleName) delete(fromVM, MarketplaceModuleName) @@ -75,7 +72,7 @@ func setHandlerForVersion_1_1(app *App) { if upgradeInfo.Name == upgradeVersion && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { storeUpgrades := storetypes.StoreUpgrades{ -// Added: []string{authz.ModuleName, GroupModuleName, AddressBookModuleName, MarketplaceModuleName}, + // Added: []string{authz.ModuleName, GroupModuleName, AddressBookModuleName, MarketplaceModuleName}, Added: []string{GroupModuleName, AddressBookModuleName, MarketplaceModuleName}, } @@ -83,114 +80,8 @@ func setHandlerForVersion_1_1(app *App) { } } -func setHandlerForVersion_1_2(app *App) { - const upgradeVersion string = "Plan of maximum success" - - app.UpgradeKeeper.SetUpgradeHandler(upgradeVersion, func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { - return app.mm.RunMigrations(ctx, app.configurator, fromVM) - }) - - upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk() - if err != nil { - panic(err) - } - - if upgradeInfo.Name == upgradeVersion && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { - storeUpgrades := storetypes.StoreUpgrades{ - Added: []string{}, - Deleted: []string{ - AddressBookModuleName, - MarketplaceModuleName, - NftModuleName, - GroupModuleName, - }, - } - - app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades)) - } -} - -func setHandlerForVersion_1_2_2(app *App) { - const upgradeVersion string = "v1.2.2" - - app.UpgradeKeeper.SetUpgradeHandler(upgradeVersion, func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { - return app.mm.RunMigrations(ctx, app.configurator, fromVM) - }) - - upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk() - if err != nil { - panic(err) - } - - if upgradeInfo.Name == upgradeVersion && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { - storeUpgrades := storetypes.StoreUpgrades{ - Added: []string{}, - Deleted: []string{ - AddressBookModuleName, - MarketplaceModuleName, - NftModuleName, - GroupModuleName, - }, - } - - app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades)) - } -} - -func setHandlerForVersion_1_2_3(app *App) { - const upgradeVersion string = "v1.2.3" - - app.UpgradeKeeper.SetUpgradeHandler(upgradeVersion, func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { - return app.mm.RunMigrations(ctx, app.configurator, fromVM) - }) - - upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk() - if err != nil { - panic(err) - } - - if upgradeInfo.Name == upgradeVersion && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { - storeUpgrades := storetypes.StoreUpgrades{ - Added: []string{}, - Deleted: []string{ - AddressBookModuleName, - MarketplaceModuleName, - NftModuleName, - GroupModuleName, - }, - } - - app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades)) - } -} -func setHandlerForVersion_1_2_4(app *App) { - const upgradeVersion string = "v1.2.4" - - app.UpgradeKeeper.SetUpgradeHandler(upgradeVersion, func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { - return app.mm.RunMigrations(ctx, app.configurator, fromVM) - }) - - upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk() - if err != nil { - panic(err) - } - - if upgradeInfo.Name == upgradeVersion && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { - storeUpgrades := storetypes.StoreUpgrades{ - Added: []string{}, - Deleted: []string{ - AddressBookModuleName, - MarketplaceModuleName, - NftModuleName, - GroupModuleName, - }, - } - - app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades)) - } -} -func setHandlerForVersion_1_2_5(app *App) { - const upgradeVersion string = "v1.2.5" +func setHandlerForVersion_1_9_9(app *App) { + const upgradeVersion string = "v1.9.9" app.UpgradeKeeper.SetUpgradeHandler(upgradeVersion, func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { return app.mm.RunMigrations(ctx, app.configurator, fromVM)