test-validator: create EpochRewards at epoch 0 #6125
Draft
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 bpf stake program depends on the existence of
EpochRewards
to function, but this account does not exist until epoch 1. this means:solana-test-validator
in the first epochim not sure if the singlenode and multinode demos start fresh on epoch 0 or if they get accounts from some known source or fast forward past the first epoch
Summary of Changes
right now this is just a demonstration of something that does fix the issue for 1. im soliciting feedback on whether to just do this for now or whether there is a good place to put this concept that fixes it for 1 and 2. i believe if i copy-paste the same code in
main()
ingenesis/src/main.rs
it should solve it for 2. but while i think a hacky solution for 1 is fine, a solution that covers 2 should be cleanerperhaps there is a good place in
GenesisConfig
to put this? or maybeSysvarCache
orBank
should init the account to a clean default?genesis/src/genesis_accounts.rs
originally looked promising but appears to just be a mechanism that creates a bunch of stake accounts for pre-launch token holdersbasically there are a lot of "plausible" places i could do this but im not sure if there is a known "good" place to do it
closes #4928