-
Notifications
You must be signed in to change notification settings - Fork 21
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
Insert missing entries in CopyVoteAccount #37
Conversation
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.
Everything looks good!
Two suggestions:
- Consider making
get_max_epoch
andget_min_epoch
as helper functions in the Circle Buf - Potentially add another integration test(s) in
test_vote_account
to check for wraparounds
/// Returns None if either start_epoch or end_epoch is not in the CircBuf | ||
/// Given a new entry and epoch, inserts the entry into the buffer in sorted order | ||
/// Will not insert if the epoch is out of range or already exists in the buffer | ||
fn insert(&mut self, entry: ValidatorHistoryEntry, epoch: u16) -> Result<()> { |
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.
rip, not doing index = epoch % self.history.len() might have been a mistake
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.
💯
Problem:
Due to unreliability in landing transactions in epoch 598 (when chain was super congested), about half of active validators did not get a single ValidatorHistoryEntry created, so their epoch credits were never copied over in future epochs. This is bad for Stakenet scoring, and this issue could happen in the future if congestion gets bad again.
Solution:
In the CopyVoteAccount instruction, when epochs are detected in the vote account that don't exist in the CircBuf, insert those new entries and shift all entries with greater epochs forward by one. This will evict the oldest entries if we are wrapping around. After that, epoch credits are copied to the old entries. We will then be able to retroactively call:
CopyTipDistributionAccount
andUpdateStakeHistory
on those validators.Notes: