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

Restores panics to #485 #491

Merged
merged 4 commits into from
Nov 18, 2022
Merged
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
8 changes: 6 additions & 2 deletions x/ccv/provider/keeper/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,16 @@ func (h Hooks) AfterUnbondingInitiated(ctx sdk.Context, ID uint64) error {

// Set unbondingOp
if err := h.k.SetUnbondingOp(ctx, unbondingOp); err != nil {
return fmt.Errorf("unbonding op could not be persisted: %w", err)
// If there was an error persisting the unbonding op, panic to end execution for
// the current tx and prevent committal of this invalid state.
panic(fmt.Errorf("unbonding op could not be persisted: %w", err))
shaspitz marked this conversation as resolved.
Show resolved Hide resolved
}

// Call back into staking to tell it to stop this op from unbonding when the unbonding period is complete
if err := h.k.stakingKeeper.PutUnbondingOnHold(ctx, ID); err != nil {
return fmt.Errorf("unbonding could not be put on hold: %w", err)
// If there was an error putting the unbonding on hold, panic to end execution for
// the current tx and prevent committal of this invalid state.
panic(fmt.Errorf("unbonding could not be put on hold: %w", err))
shaspitz marked this conversation as resolved.
Show resolved Hide resolved
}
return nil
}
Expand Down