program: Updates for better 1 SOL minimum delegation support#756
Open
joncinque wants to merge 3 commits into
Open
program: Updates for better 1 SOL minimum delegation support#756joncinque wants to merge 3 commits into
joncinque wants to merge 3 commits into
Conversation
joncinque
commented
Jun 23, 2026
Comment on lines
+2962
to
+2963
| && u64::from(preferred_validator_info.active_stake_lamports) | ||
| >= minimum_lamports_with_tolerance |
Contributor
Author
There was a problem hiding this comment.
I think >= is correct here, since if the stake account has exactly minimum_lamports_with_tolerance, it should be possible to withdraw a stake account
Contributor
Author
|
#757 will fix the audit failure |
f5753c0 to
0d491cb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The version of solana-program-test used by the repo doesn't properly add the BPF version of the stake program in tests -- if you take the current main branch, use the BPF stake program currently on mainnet, and run the tests, you'll see the minimum delegation reported is just 1 lamport.
On top of that, with the 1 SOL minimum delegation, the minimum limits used during
withdraw_staketo figure out if one of the edge cases apply is too strict. It currently requires that the stake account withdrawn from has at leastrent_exemption + minimum_delegation + 1, assuming that we can split 1 lamport from a stake account.Since we need to split at least 1 SOL, we can have a situation where a stake account has
rent_exemption + 1_999_999_999lamports. The stake pool program forces you to withdraw from that account, but it isn't possible.Summary of changes
The first two commits just bump everything to the newest dependencies, update the stake program fixture, and use it correctly in program-test. Note that we have to use v4.1 because of the incompatible wincode bump in the SDK.
After that, modify
withdraw_staketo use a looser bound ofrent_exemption + minimum_delegation * 2 + lamports_per_pool_tokenas the limit where a user can withdraw from transient accounts / remove validators.Only one existing test is tripped by the new behavior, so fix that, and add a new one.