-
Notifications
You must be signed in to change notification settings - Fork 902
Prevent writing to state cache when migrating the database #7067
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
Conversation
…ver when we write to the cache
@@ -821,7 +821,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> { | |||
.get_blinded_block(&block_root)? | |||
.ok_or(Error::MissingBeaconBlock(block_root))?; | |||
let state = self | |||
.get_state(&block.state_root(), Some(block.slot()))? | |||
.get_state(&block.state_root(), Some(block.slot()), true)? |
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.
Only used in tests so doesn't matter
.get_state( | ||
&genesis_block.state_root(), | ||
Some(genesis_block.slot()), | ||
true, |
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.
This is ok as we almost always have the genesis state in the freezer
- add state-cache-headroom flag to control pruning - prune old epoch boundary states ahead of mid-epoch states - never prune head block's state - avoid caching ancestor states unless they are on an epoch boundary
I'll PR this to |
* add an update_cache flag to get_state to have more granular control over when we write to the cache * State cache tweaks - add state-cache-headroom flag to control pruning - prune old epoch boundary states ahead of mid-epoch states - never prune head block's state - avoid caching ancestor states unless they are on an epoch boundary --------- Co-authored-by: Michael Sproul <michael@sigmaprime.io>
Backport of: - #7067 For: - #7039 - Prevent writing to state cache when migrating the database - Add `state-cache-headroom` flag to control pruning - Prune old epoch boundary states ahead of mid-epoch states - Never prune head block's state - Avoid caching ancestor states unless they are on an epoch boundary - Log when states enter/exit the cache Co-authored-by: Eitan Seri-Levi <eserilev@ucsc.edu>
Added a new flag
update_cache
toget_state
. When set to false, prevent writing fetched state to the cache