Skip to content

program: add unit tests to cover code changes introduced in v2.0.4#511

Merged
joncinque merged 18 commits intosolana-program:mainfrom
juliaaschmidt:feat/new-upgrade-tests
Feb 3, 2026
Merged

program: add unit tests to cover code changes introduced in v2.0.4#511
joncinque merged 18 commits intosolana-program:mainfrom
juliaaschmidt:feat/new-upgrade-tests

Conversation

@juliaaschmidt
Copy link
Contributor

@juliaaschmidt juliaaschmidt commented Dec 15, 2025

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:

  • Added a test to verify that removing a validator with both active and transient stake correctly updates the validator's status to DeactivatingAll and triggers deactivation of both stake accounts. This ensures the pool handles stake transitions safely when a validator is removed.

Decrease stake error handling:

  • Added parameterized tests to confirm that attempting to decrease stake on a validator marked for removal fails with a ValidatorNotFound error, covering all relevant decrease instruction types. This guards against unauthorized stake changes after validator removal.

Copy link
Contributor

@joncinque joncinque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great overall! Just some small questions

@joncinque
Copy link
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?

@juliaaschmidt juliaaschmidt force-pushed the feat/new-upgrade-tests branch from 52ff256 to f05f088 Compare February 2, 2026 23:00
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.
@juliaaschmidt
Copy link
Contributor Author

@joncinque checks have now passed, but some were skipped? Made the changes, let me know what you think.

Copy link
Contributor

@joncinque joncinque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks for all your work!

@joncinque joncinque merged commit 3ac4d77 into solana-program:main Feb 3, 2026
18 checks passed
@joncinque joncinque changed the title feat: add unit tests to cover code changes introduced in v2.0.4 program: add unit tests to cover code changes introduced in v2.0.4 Feb 3, 2026
@joncinque
Copy link
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

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.

Increase Test Coverage for Stake Pool Logic Changes in v2.0.4

2 participants