-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
includes rent_epoch in vote-accounts sanity checks #29861
Merged
behzadnouri
merged 1 commit into
solana-labs:master
from
behzadnouri:vote-account-cmp-rent-epoch
Jan 24, 2023
Merged
Changes from all commits
Commits
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
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.
Does this halt the validator? IIRC, using the cache is not enabled yet on mnb?
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.
It does halt the validator at start up.
This code is only invoked at startup when deserializing bank:
https://github.com/solana-labs/solana/blob/0be194145/runtime/src/bank.rs#L1828-L1841
in order to obtain
Stakes<StakeAccount>
fromStakes<Delegation>
for backward compatibility reasons mentioned in the link. As part of that, it performs these sanity checks.We are not using stakes-cache for rewards calculations (yet), but stakes-cache is already used so many other places, including epoch-stakes calculations. Pubkeys for stakes accounts used in rewards calculations are also already obtained from stakes-cache.
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.
as a side note, I wonder why we aren't building this cache on startup instead of serializing it. We scan all accounts to generate the index. It seems we could recreate this then. Bank deserialization at load does take a while and all of this is duplicate information derivable from append vecs at startup. Then we would have no inconsistency checks and it seems we could remove code.
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.
Not sure where to obtain correct
stake_history: StakeHistory
field in stakes-cache, but, yeah, as for stake/vote accounts, those can be obtained from accounts-db. It would need a full accounts-db scan though.I think since we already do serialize it, it would be just easier/faster to go with it.
Any inconsistency spotted by sanity checks here is only a symptom that there is a bug somewhere. The actual culprit of that inconsistency is somewhere else.