Skip to content

Commit

Permalink
add upgrade handler for v1.5.6 to fix failed unbonding sends (#1659)
Browse files Browse the repository at this point in the history
  • Loading branch information
Joe Bowman authored Jun 14, 2024
1 parent 3336972 commit 564d508
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/upgrades/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const (
V010503UpgradeName = "v1.5.3"
V010504UpgradeName = "v1.5.4"
V010505UpgradeName = "v1.5.5"
V010506UpgradeName = "v1.5.6"
V010600UpgradeName = "v1.6.0"
)

Expand Down
3 changes: 1 addition & 2 deletions app/upgrades/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ func Upgrades() []Upgrade {
{UpgradeName: V010500rc0UpgradeName, CreateUpgradeHandler: NoOpHandler},
{UpgradeName: V010500rc1UpgradeName, CreateUpgradeHandler: V010500rc1UpgradeHandler},
{UpgradeName: V010503rc0UpgradeName, CreateUpgradeHandler: V010503rc0UpgradeHandler},
{UpgradeName: V010600rc0UpgradeName, CreateUpgradeHandler: V010600rc0UpgradeHandler},

// v1.2: this needs to be present to support upgrade on mainnet
{UpgradeName: V010217UpgradeName, CreateUpgradeHandler: NoOpHandler},
Expand All @@ -31,7 +30,7 @@ func Upgrades() []Upgrade {
{UpgradeName: V010503UpgradeName, CreateUpgradeHandler: V010503UpgradeHandler},
{UpgradeName: V010504UpgradeName, CreateUpgradeHandler: V010504UpgradeHandler},
{UpgradeName: V010505UpgradeName, CreateUpgradeHandler: V010505UpgradeHandler},
{UpgradeName: V010600UpgradeName, CreateUpgradeHandler: V010600UpgradeHandler},
{UpgradeName: V010506UpgradeName, CreateUpgradeHandler: V010506UpgradeHandler},
}
}

Expand Down
32 changes: 32 additions & 0 deletions app/upgrades/v1_5.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,38 @@ func V010503rc0UpgradeHandler(

// =========== PRODUCTION UPGRADE HANDLER ===========

func V010506UpgradeHandler(
mm *module.Manager,
configurator module.Configurator,
appKeepers *keepers.AppKeepers,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {

appKeepers.InterchainstakingKeeper.Logger(ctx).Info("setting 4 unsent unbondings for epoch 167/168 to STATUS_UNBONDING to be picked up by the next end blocker...")
// remit epoch 167/168 unbondings that did not send due to channel timeout closure.
hashes := []string{
"0000000000000000000000000000000000000000000000000000000000000558", // 2544.457893
"87b0bdf81cc5c9a7e105b8a0d872e796c5484b7d55175ba7166ad86a664b2570", // 12.386644
"8f6e192cb8f4261677acfdfd303451fe96e46883bbeac3d1cc9900c1ddd52c9f", // 1720.763992
"99708983d11527b0a84cbecaa603772f48a9f8a0e6e3978408855576289d4673", // 10.033181
}
for _, hash := range hashes {
record, found := appKeepers.InterchainstakingKeeper.GetWithdrawalRecord(ctx, "cosmoshub-4", hash, icstypes.WithdrawStatusSend)
if !found {
// do not panic, in case records were updated on 15/04 epoch.
appKeepers.InterchainstakingKeeper.Logger(ctx).Error(fmt.Sprintf("1: unable to find record for hash %s", hash))
continue
}

// update the record so that it will re-trigger the send.
appKeepers.InterchainstakingKeeper.UpdateWithdrawalRecordStatus(ctx, &record, icstypes.WithdrawStatusUnbond)
appKeepers.InterchainstakingKeeper.Logger(ctx).Info("updated record to STATUS_UNBONDING", "hash", hash)
}

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

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

0 comments on commit 564d508

Please sign in to comment.