Skip to content

Commit

Permalink
fix: CreateValidator fn should increase liquid shares if a validator …
Browse files Browse the repository at this point in the history
…is a liquid staker (#22719)
  • Loading branch information
stana-miric authored Dec 3, 2024
1 parent 411fd8c commit 61dbfc5
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions x/staking/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,22 @@ func (k msgServer) CreateValidator(ctx context.Context, msg *types.MsgCreateVali
return nil, err
}

// if this delegation is from a liquid staking provider (identified if the delegator
// is an ICA account), it cannot exceed the global or validator bond cap
if k.DelegatorIsLiquidStaker(valAddr) {
shares, err := validator.SharesFromTokens(msg.Value.Amount)
if err != nil {
return nil, err
}
if err := k.SafelyIncreaseTotalLiquidStakedTokens(ctx, msg.Value.Amount, false); err != nil {
return nil, err
}
validator, err = k.SafelyIncreaseValidatorLiquidShares(ctx, valAddr, shares, false)
if err != nil {
return nil, err
}
}

// move coins from the msg.Address account to a (self-delegation) delegator account
// the validator account and global shares are updated within here
// NOTE source will always be from a wallet which are unbonded
Expand Down

0 comments on commit 61dbfc5

Please sign in to comment.