Skip to content

test epoch rewards blocks program usage#78

Merged
2501babe merged 1 commit intosolana-program:mainfrom
2501babe:rewards_test
Aug 11, 2025
Merged

test epoch rewards blocks program usage#78
2501babe merged 1 commit intosolana-program:mainfrom
2501babe:rewards_test

Conversation

@2501babe
Copy link
Member

@2501babe 2501babe commented Aug 6, 2025

this is part of removing the stake program from agave (anza-xyz/agave#7203). right now, the agave repo still gets its version of the stake program from programs/stake/ for all tests, which is not just useless but actually dangerous since someonce could break the live stake program with agave changes that conform to the dead one

adding the bpf stake program to TestValidator is easy, but some tests that use a raw Bank are more tricky to deal with. we have to decide whether each should:

  1. stub out the stake program (because their usage of stake is incidental)
  2. move to this repo (because they essentially just test the stake program)
  3. use the binary blob stake program being added to agave (because they test a fundamental stake program and validator interaction)

this test is intended to replace test_program_execution_restricted_for_stake_account_in_reward_period() in runtime/src/bank/partitioned_epoch_rewards/mod.rs, which you should look at while reviewing this pr to see if you agree. it does a lot of bank/tower/vote things to naturally advance the bank into and out of the rewards period. in my view this is unecessary and all the test really cares about is that the stake program aborts, and other tests cover the rewards period itself. if youre of the same view ill delete that test in its entirety

@2501babe 2501babe self-assigned this Aug 6, 2025
@2501babe 2501babe requested a review from joncinque August 6, 2025 08:06
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.

This test looks great!

I'm almost totally onboard with removing test_program_execution_restricted_for_stake_account_in_reward_period.

My only concern is that the test also checks that it's possible to credit a stake account during reward payout, which could be useful in case we mistakenly decide to restrict that somehow in the future.

So I would remove the stake interactions in that test, but keep the crediting. What do you think?

@2501babe
Copy link
Member Author

im a bit skeptical this test still has value, since its now just checking that system transfers work, but ive changed it to do that

@2501babe 2501babe merged commit 66b6266 into solana-program:main Aug 11, 2025
9 checks passed
@2501babe 2501babe deleted the rewards_test branch August 11, 2025 10:00
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.

2 participants