Skip to content

Commit

Permalink
Fix for stuck deposits (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
Segfaultd committed May 5, 2024
1 parent 0dcfcfb commit f6f2767
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,12 @@ func (app *App) registerUpgradeHandlers() {

app.UpgradeKeeper.SetUpgradeHandler("v1.6.6", func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
app.Logger().Info("Starting v1.6.6 upgrade")

// Fix the stuck deposits
depositIDs := []uint64{1301, 1302, 1310, 1329}
for _, depositID := range depositIDs {
app.MillionsKeeper.UnsafeSetDepositErrorState(ctx, 3, depositID, millionstypes.DepositState_IcaDelegate)
}
return app.mm.RunMigrations(ctx, app.configurator, fromVM)
})

Expand Down
12 changes: 12 additions & 0 deletions x/millions/keeper/keeper_deposit.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,3 +408,15 @@ func (k Keeper) UnsafeSetUnpersistedDeposits(ctx sdk.Context) int {

return i
}

func (k Keeper) UnsafeSetDepositErrorState(ctx sdk.Context, poolID uint64, depositID uint64, state types.DepositState) {
deposit, err := k.GetPoolDeposit(ctx, poolID, depositID)
if err != nil {
panic(err)
}

deposit.State = types.DepositState_Failure
deposit.ErrorState = state
k.setAccountDeposit(ctx, &deposit)
k.setPoolDeposit(ctx, &deposit)
}

0 comments on commit f6f2767

Please sign in to comment.