Skip to content
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

Lack of consistency checks for stakes cache #24376

Closed
jstarry opened this issue Apr 15, 2022 · 6 comments
Closed

Lack of consistency checks for stakes cache #24376

jstarry opened this issue Apr 15, 2022 · 6 comments
Assignees
Labels
do-not-close Add this tag to exempt an issue/PR from being closed by the stalebot

Comments

@jstarry
Copy link
Member

jstarry commented Apr 15, 2022

Problem

After the feature gate for #24278 is activated, validators will calculate stake rewards using vote and stake account state cached in the StakesCache. However, there are currently no consistency checks that ensure that the stakes cache accurately reflects the state of all active vote and stake accounts in accounts db.

One potential pitfall is that the stakes cache implementation assumes that stake and vote accounts cannot have their owner changed during transaction processing. This is safe now but the stake and vote programs could introduce a future change that resets the owner of a closed account and break that assumption.

Context: #24200 (comment)

Proposed Solution

TBD

@behzadnouri behzadnouri self-assigned this Apr 15, 2022
@github-actions github-actions bot added the stale [bot only] Added to stale content; results in auto-close after a week. label Apr 17, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 24, 2023
@ryoqun ryoqun reopened this Apr 24, 2023
@ryoqun
Copy link
Member

ryoqun commented Apr 24, 2023

cc: @HaoranYi might worth to do considering stake rewards v2

@HaoranYi
Copy link
Contributor

HaoranYi commented Apr 24, 2023

@ryoqun Great observation. Yeah. This is another blocker for #24200. I will keep it in my mind for the rewards v2 work.

@behzadnouri behzadnouri added do-not-close Add this tag to exempt an issue/PR from being closed by the stalebot and removed stale [bot only] Added to stale content; results in auto-close after a week. labels Apr 24, 2023
@jeffwashington
Copy link
Contributor

@behzadnouri , @t-nelson , @HaoranYi can one of you please help clarify? Is this an issue for activation? An issue that still needs work done on it?

@t-nelson
Copy link
Contributor

this was addressed in #24200

@jeffwashington
Copy link
Contributor

Sorry to be pedantic.
@behzadnouri @t-nelson @HaoranYi just being clear.
This issue has do-not-close from @behzadnouri last month.
@t-nelson says it is addressed in #24200, which looks like it went in over a year ago.
@behzadnouri can you please confirm? Thank you.

@behzadnouri
Copy link
Contributor

The source of inconsistency was patched in #26479 and the sanity checks here
https://github.com/solana-labs/solana/blob/936d2cf3c/runtime/src/stakes.rs#L224-L263
will cause panic at start-up if stakes-cache is inconsistent with accounts-db:

#24200 only added these metrics:
https://github.com/solana-labs/solana/blob/936d2cf3c/runtime/src/bank.rs#L1092-L1094
to track if there are inconsistencies between cache and accounts-db before feature activation; but the feature activation will bypass those metrics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-close Add this tag to exempt an issue/PR from being closed by the stalebot
Projects
None yet
Development

No branches or pull requests

6 participants