forked from solana-labs/solana
-
Notifications
You must be signed in to change notification settings - Fork 338
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
Persist EpochRewards sysvar #572
Merged
CriesofCarrots
merged 8 commits into
anza-xyz:master
from
CriesofCarrots:simd-118-persist-sysvar
Apr 5, 2024
Merged
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a4d5e37
Persist EpochRewards sysvar between reward intervals
CriesofCarrots f34451b
Adjust initial EpochRewards balance to ensure it is not debited out o…
CriesofCarrots 29c310f
Set EpochRewards::active = false at end of distribution
CriesofCarrots 9fb283b
Fix tests
CriesofCarrots 46db67d
Extend test to 2 epochs, assert sysvar still exists
CriesofCarrots 49c4d70
Stop adjusting EpochRewards balance based on rewards
CriesofCarrots 07ff5f2
Fix tests
CriesofCarrots 417756d
Review suggestions
CriesofCarrots File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit confused by this check. Shouldn't the cap increase at both epoch rollovers and not just the first? ie also when
slot == 2 * num_slots_in_epoch
?When I ran this locally, I saw that
post_cap
is only 1 lamport bigger whenslot == num_slots_in_epoch
, which seems a bit strange. Is it just the rent exemption for the epoch rewards sysvar account?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. At the first block of epoch 1, the EpochRewards sysvar gets created for the first time, which increases the capitalization the amount of the sysvar's rent-exempt reserve (see below).
At the first block of epoch 2, the capitalization doesn't change: the sysvar has persisted throughout epoch 1, so no new rent-exempt reserve, and distribution starts the following block, so no new rewards.
Correct. Sysvar lamport balances default to 1 lamport when the GenesisConfig sets
Rent::free()
(which it does in most of the genesis_utils fns, likecreate_genesis_config_with_vote_accounts()
... that's a whole other issue which we can discuss separately 😅 ).