Skip to content

Commit

Permalink
cr fix
Browse files Browse the repository at this point in the history
  • Loading branch information
stana-miric committed Dec 4, 2024
1 parent e87c800 commit b5dbdb5
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions x/staking/keeper/slash.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,14 +404,23 @@ 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 {
k.SafelyDecreaseValidatorBond(ctx, valDstAddr, sharesToUnbond)
if err := k.SafelyDecreaseValidatorBond(ctx, valDstAddr, sharesToUnbond); err != nil {
// 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) {
k.DecreaseTotalLiquidStakedTokens(ctx, tokensToBurn)
k.DecreaseValidatorLiquidShares(ctx, valDstAddr, sharesToUnbond)
if err := k.DecreaseTotalLiquidStakedTokens(ctx, tokensToBurn); err != nil {
// 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 {
// Log an error instead of panicking to handle operation failures gracefully
k.Logger(ctx).Error("failed to decrease validator liquid shares", "error", err)
}
}

// tokens of a redelegation currently live in the destination validator
Expand Down

0 comments on commit b5dbdb5

Please sign in to comment.