feat(replay): epoch boundary rewards, bit-exact at 807 -> 808 - #10
Merged
Merged
Conversation
Replays the epoch crossing: inflation pool, points, commission split, partitioned stake distribution, and the EpochRewards sysvar lifecycle. Verified against mainnet. Slot 349056000 computes Hndh3PL56XTD7r24CgA6MLW13Z7tbWzPawLMkz6FRhMF, which matches the vote, and all 228 distribution blocks are consensus-verified. 885,548 stake rewards and 417 vote commissions match mainnet to the lamport. The post-distribution EpochRewards sysvar matches agave's own recorded values, down to the slot it deactivates on. Five things here aren't obvious from agave's source and cost real time: - capitalization has to be tracked per slot and read at the boundary. Taking it from the seed snapshot made the pool 8,820,967 lamports too big, inflating every reward by 6e-8. - Clock's epoch, leader_schedule_epoch and epoch_start_timestamp only move at a crossing. Carrying them forward is right for every other slot, which is why 8,971 passing slots said nothing about it. - EpochRewards.total_rewards is the whole inflation pool, not what's paid. distributed_rewards starts at the vote commission (paid at the boundary) and accumulates per partition. Reading the source the other way round cost a full run. - vote_state_of gates on the owner alone, like agave's VoteAccount::try_from. An is_correct_size_and_initialized check rejects not-yet-resized 3731-byte V1_14_11 accounts and inflates every reward. - checkpoint metadata must commit in the same transaction as the checkpoint. Three separate commits meant a crash could leave meta from one chunk with a checkpoint slot from the previous one, and the resume then double-counted that chunk's burned fees.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Replays the epoch crossing: inflation pool, points, commission split, partitioned stake distribution, and the EpochRewards sysvar lifecycle.
Verified against mainnet. Slot 349056000 computes
Hndh3PL56XTD7r24CgA6MLW13Z7tbWzPawLMkz6FRhMF, which matches the vote, and all 228 distribution blocks are consensus-verified. 885,548 stake rewards and 417 vote commissions match mainnet to the lamport. The post-distribution EpochRewards sysvar matches agave's own recorded values, down to the slot it deactivates on.
Five things here aren't obvious from agave's source and cost real time: