diff --git a/app/upgrades/types.go b/app/upgrades/types.go index b3aabbaa3..0f68ae2af 100644 --- a/app/upgrades/types.go +++ b/app/upgrades/types.go @@ -16,6 +16,7 @@ const ( DevnetChainID = "magic-1" TestChainID = "testchain1" OsmosisTestnetChainID = "osmo-test-5" + JunoTestnetChainID = "uni-6" V010402rc1UpgradeName = "v1.4.2-rc1" V010402rc2UpgradeName = "v1.4.2-rc2" @@ -31,6 +32,7 @@ const ( V010404beta7UpgradeName = "v1.4.4-beta.7" V010404rc0UpgradeName = "v1.4.4-rc.0" V010404beta8UpgradeName = "v1.4.4-beta.8" + V010404rc1UpgradeName = "v1.4.4-rc.1" ) // Upgrade defines a struct containing necessary fields that a SoftwareUpgradeProposal diff --git a/app/upgrades/upgrades.go b/app/upgrades/upgrades.go index 37432df0f..ec7ccedca 100644 --- a/app/upgrades/upgrades.go +++ b/app/upgrades/upgrades.go @@ -34,6 +34,7 @@ func Upgrades() []Upgrade { {UpgradeName: V010404beta7UpgradeName, CreateUpgradeHandler: V010404beta7UpgradeHandler}, {UpgradeName: V010404rc0UpgradeName, CreateUpgradeHandler: V010404rc0UpgradeHandler}, {UpgradeName: V010404beta8UpgradeName, CreateUpgradeHandler: V010404beta8UpgradeHandler}, + {UpgradeName: V010404rc1UpgradeName, CreateUpgradeHandler: V010404rc1UpgradeHandler}, } } @@ -467,6 +468,45 @@ func V010404beta8UpgradeHandler( } } +func V010404rc1UpgradeHandler( + 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 isTestnet(ctx) || isTest(ctx) || isDevnet(ctx) { + + appKeepers.InterchainstakingKeeper.RemoveZoneAndAssociatedRecords(ctx, JunoTestnetChainID) + vals := appKeepers.InterchainstakingKeeper.GetValidators(ctx, JunoTestnetChainID) + for _, val := range vals { + valoper, _ := addressutils.ValAddressFromBech32(val.ValoperAddress, "junovaloper") + appKeepers.InterchainstakingKeeper.DeleteValidator(ctx, JunoTestnetChainID, valoper) + } + + pdType, exists := prtypes.ProtocolDataType_value["ProtocolDataTypeConnection"] + if !exists { + panic("connection protocol data type not found") + } + + appKeepers.ParticipationRewardsKeeper.DeleteProtocolData(ctx, prtypes.GetProtocolDataKey(prtypes.ProtocolDataType(pdType), []byte(JunoTestnetChainID))) + + appKeepers.InterchainstakingKeeper.IterateWithdrawalRecords(ctx, func(index int64, record icstypes.WithdrawalRecord) (stop bool) { + if (record.Status == icstypes.WithdrawStatusSend) || record.Requeued || ((record.CompletionTime != time.Time{}) && (record.CompletionTime.Before(ctx.BlockTime()))) { + record.Acknowledged = true + } + + if (record.ChainId == "elgafar-1") && (record.CompletionTime == time.Time{}) { + record.Acknowledged = true + } + + appKeepers.InterchainstakingKeeper.SetWithdrawalRecord(ctx, record) + return false + }) + } + return mm.RunMigrations(ctx, configurator, fromVM) + } +} + // func V010400UpgradeHandler( // mm *module.Manager, // configurator module.Configurator,