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

Only cache check point state if it hasn't existed in other cache #7037

Merged
merged 14 commits into from
Aug 17, 2020

Conversation

terencechain
Copy link
Member

@terencechain terencechain commented Aug 17, 2020

Background:
There's 2 main group of state storages. One used for stategen and one used for process attestations.

1.) The stategen's storages consists of hot_state_cache, epoch_boundary_state_cache and db
2.) The process attestation's state storage consist of check_point_cache.

Why do we need both?
Because of skip slots! check_point_cache stores beacon state for the epoch views. If there's a skip slot at 64, 63 and 62. Check point cache will get state of 61 and process slots and epoch up to 64. The processed state of 64 will be stored with the root of 61 and epoch at 2.

How can we do better?
We can reuse some of the spaces between them. For example if there's already a state at 64, we don't need to store it in the check point cache. We already know it's in the stategen stroage and it can be retrieved from stategen storage

What does this PR do?
This PR checks whether there's already a state in the stategen storage's bucket before saving it to the check point cache

@terencechain terencechain marked this pull request as ready for review August 17, 2020 20:42
@terencechain terencechain requested a review from a team as a code owner August 17, 2020 20:42
@codecov
Copy link

codecov bot commented Aug 17, 2020

Codecov Report

Merging #7037 into master will decrease coverage by 0.38%.
The diff coverage is 33.33%.

@@            Coverage Diff             @@
##           master    #7037      +/-   ##
==========================================
- Coverage   62.55%   62.16%   -0.39%     
==========================================
  Files         401      401              
  Lines       31638    31279     -359     
==========================================
- Hits        19792    19446     -346     
+ Misses       9067     9066       -1     
+ Partials     2779     2767      -12     

@terencechain terencechain self-assigned this Aug 17, 2020
@terencechain terencechain added Ready For Review Enhancement New feature or request labels Aug 17, 2020
@rauljordan rauljordan merged commit dbd1e8c into master Aug 17, 2020
@rauljordan rauljordan deleted the share-cache branch August 17, 2020 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants