Skip to content

program: Move slippage check down during withdraw-stake - #883

Open
joncinque wants to merge 1 commit into
solana-program:mainfrom
joncinque:slippage-after
Open

program: Move slippage check down during withdraw-stake#883
joncinque wants to merge 1 commit into
solana-program:mainfrom
joncinque:slippage-after

Conversation

@joncinque

Copy link
Copy Markdown
Contributor

Problem

The stake pool program allows users to withdraw whole stake accounts in certain situations. In those cases, the amount of lamports withdrawn gets truncated downt to the current amount of lamports in the account.

The program also allows users to specify slippage when withdrawing from the pool. The withdraw-stake instruction runs the slippage check before the withdrawal amount has been rounded down when withdrawing a stake account, potentially violating the slippage param set by the user.

Summary of changes

Move the slippage check down to after the withdraw amount has been changed.

Fixes #882

#### Problem

The stake pool program allows users to withdraw whole stake accounts in
certain situations. In those cases, the amount of lamports withdrawn
gets truncated downt to the current amount of lamports in the account.

The program also allows users to specify slippage when withdrawing from
the pool. The withdraw-stake instruction runs the slippage check before
the withdrawal amount has been rounded down when withdrawing a stake
account, potentially violating the slippage param set by the user.

#### Summary of changes

Move the slippage check down to after the withdraw amount has been
changed.
@joncinque
joncinque requested a review from 2501babe August 31, 2026 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

program: WithdrawStakeWithSlippage can return less stake lamports than minimum_lamports_out after ValidatorRemoval clamp

1 participant