-
Notifications
You must be signed in to change notification settings - Fork 655
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
Adopt the TurboGeth database layout #1879
Draft
lithp
wants to merge
22
commits into
ethereum:main
Choose a base branch
from
lithp:lithp/turbo-account-state
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
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
- BlockDiffs are no longer saved by the header hash, they're instead stored based on their state root - Add a bunch of hacks to require that we're using the TurboDB layout, and migrate a bunch of tests to use the TurboDB layout. - Added a hack, VM's always use TurboAccountDBs, they do not pay attention to the `account_db_class`. - AccountDB.persist_returning_block_diff accepts an extra parameter, `parent_state_root`. When block diffs are saved `parent_state_root` is consulted to find the previous value of each account. - `TurboAccountDB`s (which is now used everywhere) `_get_encoded_account` reads from both the turbo account db and the existing code path. An exception is thrown if the two ever disagree. - Add ChainDB.upgrade_to_turbo_schema, which can be used to upgrade a database. It iterates over the entire canonical trie and inserts all accounts into the current account store. - Add a test that BlockDiffs work with `MiningChain`s across multiple transactions.
- This prepares AccountDB to read from the TurboDB even when processing older blocks. - It restricted `VM`s interface. `VM`s can no longer be created using a headers which do not have an associated BlockDiff in the database. - This required a pretty nasty hack to MiningChain to get it working. I need to come back to this later and do it the right way. - state_in_temp_block no longer creates a temp block, neither caller seemed to need this behavior and it was causing complications (it make a fake header, something TurboDatabase cannot handle). - Some of the test_gas_estimation tests tried building off a fake header, those tests were removed.
- TurboDatabase expects to be given a block header which actually exists, or it will fail upon trying to look up the block header - The DAO fork changes (previously in configure_homestead_header) resulted in import_block using a synthetic header which TurboDatabase could not look up. - The DAO changes were deferred until after the correct State object is created.
- Create an adapter which sits between JournalDB and TurboDatabase - AccountDB now reads from both the turbo db and the usual db when reading accounts. That includes when it tries to read from the journaled changes. It does not include reads during block diff creation, those still happen solely through the trie. - It is sometimes safe to call make_state_root() (this happens during receipt generation in older chains, and works there). It is usually unsafe though, due to complicated interactions with the journal that I don't fully understand. - There was a bug in TurboDatabase where it inspected the reverse block diffs in the incorrect order. - The DAO-fork code no longer calls persist(), because the appropriate state object has already been built, there's no need to look up this state root. Also, persist() calls make_state_root() which breaks here. - test_pow_mining didn't previously exercise any turbo reads but now does, so the test has been updated to use the turbo database layout
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.
A PR with my in-progress implementation of all the work described in this issue: ethereum/trinity#779
To-Do
TODO
s that have been sprinkled into the codeCute Animal Picture