-
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
feat(storage): ✨ Bonsai storage refactor and rpc call support #28
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
`StorageHandler` is a type-safe storage abstraction with exclusif access to the backend bonsai storage, allowing for a centralized point of mutation of the database without the error-prone nature of manually querying the bonsai dbs.
This should reduce blocking time on reading threads for RPC calls. Currently this applies to `read` and `root` methods on storage handlers.
antiyro
approved these changes
Mar 28, 2024
Merged
This includes `Messaging` and `SierraContractClasses`. Note that `L1Handler` is also set to be removed in the near future and has been marked as deprecated.
antiyro
approved these changes
Apr 4, 2024
Tbelleng
approved these changes
Apr 4, 2024
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.
Seems good to me, Lfgg well done 🤝
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?
Bonsai storage is handled separately from Substrate storage and does not interact with the runtime. Moreover, the manual use of bonsai storage in cases such as
commitments/lib.rs
is not type-safe and is error prone, especially when the amount of type-juggling and manual, often repetitive hash computation.Other issues further arise when considering a situation with many parallel accesses to the db, which is typical in our use case. This PR aims to introduce some of the boilerplate necessary for minimizing storage locks during block sync by working of BonsaiDb transactional state. Since this is still a work in progress in upstream dependencies, parts of the code relevant to this issue have been commented out, with a more naive 'lock-on-use' approach being currently used.
What is the new behavior?
StoraHandler
abstraction for handling bonsai storage in a type-safe way by providing a single source of mutation for the bonsai storage and handling type conversions and hashing for interfacing with the bonsai lib.StorageHandler
.crates/runtime/src/types.rs
andcrates/primitives/types
.Does this introduce a breaking change?
No.
Other information
Looking for feedback on the implementation of
StorageHandler
.