program: add unit tests to cover code changes introduced in v2.0.4#511
Merged
joncinque merged 18 commits intosolana-program:mainfrom Feb 3, 2026
Merged
Conversation
joncinque
reviewed
Feb 2, 2026
Contributor
joncinque
left a comment
There was a problem hiding this comment.
Looks great overall! Just some small questions
Contributor
|
Also, I'm not totally sure why, but CI hasn't run on the PR -- can you try rebasing to see if that kicks it off? |
Convert debug println! statements to comments to keep test output clean while preserving the documentation value of the debug info.
The transient stake is already registered during the increase operation, so this update call is not needed.
Variables that were previously used in println! statements are now unused after converting to comments. Prefix with underscore to satisfy clippy warnings.
52ff256 to
f05f088
Compare
The test uses synthetic state to verify the defensive guard in is_removed() since ReadyForRemoval with non-zero active_stake_lamports cannot occur through normal program execution.
8b33b34 to
0231697
Compare
Contributor
Author
|
@joncinque checks have now passed, but some were skipped? Made the changes, let me know what you think. |
joncinque
approved these changes
Feb 3, 2026
Contributor
joncinque
left a comment
There was a problem hiding this comment.
Looks great, thanks for all your work!
Contributor
|
Oh and don't worry about the skipped checks, those are for other steps that don't apply to this repo or to pull requests |
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.
Closes #527
This pull request adds new tests to improve coverage of validator removal scenarios in the stake pool program. The tests ensure correct handling when removing validators, particularly those with transient stake, and verify that stake decrease operations fail as expected after removal.
Validator removal and stake deactivation logic:
DeactivatingAlland triggers deactivation of both stake accounts. This ensures the pool handles stake transitions safely when a validator is removed.Decrease stake error handling:
ValidatorNotFounderror, covering all relevant decrease instruction types. This guards against unauthorized stake changes after validator removal.