Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for stuck deposits #75

Merged
merged 2 commits into from
May 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
}
Loading