Skip to content

Commit

Permalink
Remove unused upgrades
Browse files Browse the repository at this point in the history
  • Loading branch information
nbaum committed Oct 7, 2024
1 parent 0daf1da commit e227e49
Showing 1 changed file with 7 additions and 116 deletions.
123 changes: 7 additions & 116 deletions app/app_upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -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) {
Expand All @@ -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)
Expand All @@ -75,122 +72,16 @@ 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},
}

app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))
}
}

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)
Expand Down

0 comments on commit e227e49

Please sign in to comment.