Skip to content

EpochRewards does not exist at epoch 0 #4928

Open
@2501babe

Description

@2501babe

Problem

the stake program depends on the existence of EpochRewards to know if it should be locked out from stake operations or not, but this sysvar is only initialized after the first rewards period. this is not an issue for native stake because it gets the value directly from SysvarCache and cleanly maps a None to false. however the bpf stake program must get it via syscall, which causes svm to halt with an uncatchable UnsupportedSysvar error in this case

in practice this is not a grave issue because no public clusters are on epoch 0, but it could be a problem for people standing up new clusters using a forked agave, because it would prevent all stake operations for the first epoch. however it also makes it impossible to use bpf stake with solana-test-validator until epoch 1

Proposed Solution

set EpochRewards to its default value at genesis. this probably just means adding it to the starting accounts that get populated in GenesisConfig and letting fill_missing_sysvar_cache_entries() pick it up in new_with_paths(). epoch rewards internals are well-encapsulated from Bank so it doesn't have a full object representation like EpochSchedule et al, just EpochRewardStatus which defaults to Inactive

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions