-
Notifications
You must be signed in to change notification settings - Fork 30
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
Added boilerplate for Bonsai storage migration #70
Merged
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
Bonsai trie handlers no longer access the db at a given state and instead only serve to view or mutate the latest state.
`get_at` functions similarly to calling `storage_handler::storage_at().get()` but is faster since it only reverts the state for a given key.
jbcaron
approved these changes
Apr 22, 2024
Trantorian1
force-pushed
the
feat/storage
branch
from
April 22, 2024 17:22
d82a3c4
to
839e981
Compare
Trantorian1
force-pushed
the
feat/storage
branch
from
April 23, 2024 00:14
9261db0
to
ef711d1
Compare
antiyro
approved these changes
Apr 24, 2024
jbcaron
approved these changes
Apr 24, 2024
Ok(Some(block_number)) => block_number, | ||
_ => get_highest_block_hash_and_number().1, | ||
}, | ||
BlockId::Tag(_) => get_highest_block_hash_and_number().1, |
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.
tag pending not supported
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.
Pull Request type
What is the current behavior?
Currently, Deoxys relies heavily on the Substrate runtime storage. This poses issues as it was designed for sparse usage, and is not pertinent for the storage of data which is not consensus-critical. Furthermore, use of the Substrate runtime storage and the associated
StorageOverride
s built on top has lead to a convoluted use of storage which is hard to reason about.What is the new behavior?
crates/client/src/storage_handler
for accessing storage statically and outside of the Substrate runtime.BonsaiStorage
andRevertibleStorage
viastorage_handler
. This inculdes the following mappings:block_number
->block_hash
block_hash
->block_number
contract_address
->class_hash
&nonce
class_hash
->contract_abi
&contract_class
class_hash
->compiled_class_hash
on_initialized
is no longer used for storing data. Any related logic, such as serializing data to communicate it to the runtime for storage, have been removed. Storage updates are now handled as part ofl2.rs
.StorageOverride
from the code base.Does this introduce a breaking change?
Yes. Any node already running will have to be re-run from the block 0 to update the new databases.
Other information
Note that this is PR mostly introduces the boilerplate necessary for a full migration to Bonsai lib storage. Further improvements remain to be made:
Nonces
in the db in some special cases.Please keep these points in mind as you review this PR.