Skip to content

Commit

Permalink
fix: upgradehandler to remove stale zones from dev
Browse files Browse the repository at this point in the history
  • Loading branch information
ajansari95 committed Jun 20, 2023
1 parent 572115a commit 6a93eaa
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/upgrades/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const (
V010403rc0UpgradeName = "v1.4.3-rc0"
V010404beta0UpgradeName = "v1.4.4-beta.0"
V010404beta1UpgradeName = "v1.4.4-beta.1"
V010404beta2UpgradeName = "v1.4.4-beta.2"
)

// Upgrade defines a struct containing necessary fields that a SoftwareUpgradeProposal
Expand Down
27 changes: 27 additions & 0 deletions app/upgrades/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func Upgrades() []Upgrade {
{UpgradeName: V010403rc0UpgradeName, CreateUpgradeHandler: V010403rc0UpgradeHandler},
{UpgradeName: V010404beta0UpgradeName, CreateUpgradeHandler: V010404beta0UpgradeHandler},
{UpgradeName: V010404beta1UpgradeName, CreateUpgradeHandler: NoOpHandler},
{UpgradeName: V010404beta2UpgradeName, CreateUpgradeHandler: V010404beta2UpgradeHandler},
}
}

Expand Down Expand Up @@ -295,6 +296,32 @@ func V010404beta0UpgradeHandler(
}
}

func V010404beta2UpgradeHandler(
mm *module.Manager,
configurator module.Configurator,
appKeepers *keepers.AppKeepers,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
if isTest(ctx) || isDevnet(ctx) {
appKeepers.InterchainstakingKeeper.RemoveZoneAndAssociatedRecords(ctx, "elgafar-1")
vals := appKeepers.InterchainstakingKeeper.GetValidators(ctx, "elgafar-1")
for _, val := range vals {
valoper, _ := addressutils.ValAddressFromBech32(val.ValoperAddress, "starsvaloper")
appKeepers.InterchainstakingKeeper.DeleteValidator(ctx, "elgafar-1", valoper)
}

appKeepers.InterchainstakingKeeper.RemoveZoneAndAssociatedRecords(ctx, "evmos_9000-4")
vals2 := appKeepers.InterchainstakingKeeper.GetValidators(ctx, "evmos_9000-4")
for _, val2 := range vals2 {
valoper, _ := addressutils.ValAddressFromBech32(val2.ValoperAddress, "evmosvaloper")
appKeepers.InterchainstakingKeeper.DeleteValidator(ctx, "evmos_9000-4", valoper)
}
}

return mm.RunMigrations(ctx, configurator, fromVM)
}
}

// func V010400UpgradeHandler(
// mm *module.Manager,
// configurator module.Configurator,
Expand Down

0 comments on commit 6a93eaa

Please sign in to comment.