Skip to content

test-validator: create EpochRewards at epoch 0 #6125

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

2501babe
Copy link
Member

@2501babe 2501babe commented May 6, 2025

Problem

the bpf stake program depends on the existence of EpochRewards to function, but this account does not exist until epoch 1. this means:

  1. all stake operations fail on solana-test-validator in the first epoch
  2. all stake operations would fail on a brand new cluster in the first epoch

im 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() in genesis/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 cleaner

perhaps there is a good place in GenesisConfig to put this? or maybe SysvarCache or Bank 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 holders

basically 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

@2501babe 2501babe force-pushed the 20250506_tesval_rewards branch from 74024a6 to 66624cc Compare May 6, 2025 13:45
@2501babe 2501babe self-assigned this May 6, 2025
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.8%. Comparing base (4ebe3c0) to head (66624cc).
Report is 24 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##           master    #6125     +/-   ##
=========================================
- Coverage    82.9%    82.8%   -0.1%     
=========================================
  Files         840      840             
  Lines      377977   377990     +13     
=========================================
- Hits       313382   313332     -50     
- Misses      64595    64658     +63     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

EpochRewards does not exist at epoch 0
2 participants