-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Feature/public and private states shared cache #1353
Merged
antonydenyer
merged 14 commits into
Consensys:master
from
nicolae-leonte-go:feature/public_and_private_states_shared_cache
Mar 8, 2022
Merged
Feature/public and private states shared cache #1353
antonydenyer
merged 14 commits into
Consensys:master
from
nicolae-leonte-go:feature/public_and_private_states_shared_cache
Mar 8, 2022
Conversation
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
…ce) the public state root with the trie of private states root and each leaf in the trie of private states with the corresponding private state root
… provider for each option
…original code (the main private cache is created with the appropriate configuration)
nicolae-leonte-go
requested review from
baptiste-b-pegasys,
trung,
antonydenyer and
apratt3377
March 7, 2022 11:17
nicolae-leonte-go
requested review from
namtruong,
SatpalSandhu61,
antonydenyer and
chris-j-h
March 7, 2022 11:17
Krish1979
previously approved these changes
Mar 8, 2022
antonydenyer
previously approved these changes
Mar 8, 2022
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.
An elegant solution that will mean we can benefit more easily from upstream changes. 🙏
nicolae-leonte-go
dismissed stale reviews from antonydenyer and Krish1979
via
March 8, 2022 13:01
19da1cc
Krish1979
approved these changes
Mar 8, 2022
achraf17
approved these changes
Mar 8, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This change allows the private state (or states in case of MPS) to behave similarly to the public state when it comes to what is written to the disk and how often.
Before this PR the private state is being flushed to the disk for each block (even though the corresponding public state is not - depending on the
--gcmode
parameter value).The behaviour is enabled by passing a command line parameter:
--privatetriecache.enable
When enabled, the public and the private state(s) share the same
state.Database
instance. The single cache management (previously applying only to the public state) now also applies to the private state(s). TheTrieDB.Reference
mechanism is used to link the various tries with each-other so that when aTrieDB.Commit
on the public state root is issued it cascades to all other referenced tries (including the private states).When disabled (the parameter is missing from the command line) the private state(s) is still committed for each block with ONE NOTABLE DIFFERENCE: the order of commits is reversed - public state is committed first followed by the private state(s). The reason for the reversal is that when we commit the private state the public state root is already in the cache (which then allows us to add the reference from the private state root to the public state root).