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: LSM slasing of redelegation #22755

Merged
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
9 changes: 6 additions & 3 deletions x/staking/keeper/slash.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,18 +405,21 @@ func (k Keeper) SlashRedelegation(ctx context.Context, srcValidator types.Valida
// if the delegator holds a validator bond to destination validator, decrease the destination validator bond shares
if delegation.ValidatorBond {
if err := k.SafelyDecreaseValidatorBond(ctx, valDstAddr, sharesToUnbond); err != nil {
return math.ZeroInt(), err
// Log an error instead of panicking to handle operation failures gracefully
k.Logger(ctx).Error("failed to decrease validator bond", "error", err)
}
}

// if this delegation is from a liquid staking provider (identified if the delegator
// is an ICA account), the global and validator liquid totals should be decremented
if k.DelegatorIsLiquidStaker(delegatorAddress) {
if err := k.DecreaseTotalLiquidStakedTokens(ctx, tokensToBurn); err != nil {
return math.ZeroInt(), err
// Log an error instead of panicking to handle operation failures gracefully
k.Logger(ctx).Error("failed to decrease total liquid staked tokens", "error", err)
}
if _, err := k.DecreaseValidatorLiquidShares(ctx, valDstAddr, sharesToUnbond); err != nil {
return math.ZeroInt(), err
// Log an error instead of panicking to handle operation failures gracefully
k.Logger(ctx).Error("failed to decrease validator liquid shares", "error", err)
}
}

Expand Down
Loading