-
Notifications
You must be signed in to change notification settings - Fork 389
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
[chain] Audit the gno.land storage layer #2445
Comments
How Things Are StoredKey-Value StructureBelow is a categorization of the main types of keys:
Nuances Found in the Current ImplementationInconsistent LogicSimilar types, such as Inefficient Storage SerializationApproximately 80%-90% of the data stored is redundant due to the direct storage of VM objects in LevelDB. Additionally, keys for objects are repeatedly marshaled, adding unnecessary overhead. Unused Keys and Uneeded Storage LayersThere are keys, like those for VM Model and Storage CouplingModels have methods that receive the Store as a parameter to retrieve related metadata. This creates inconsistencies in how types are retrieved/cast/used and adds an unnecessary dependency between the model and storage layers. Slice Storage LimitationsSlice metadata is not split into chunks, which could cause memory issues when marshaling/unmarshaling large amounts of data when retrieving big slices. Next StepsOption 1: Maintain Status Quo with Minor FixesIncrementally address specific issues, such as unifying key prefix logic and standardizing type storage. Option 2: Introduce a Conversion Layer (Recommended)Define storage-specific models fulfilling the use case, independent of VM state models. Establish a conversion layer between VM state models and storage models, simplifying data storage and retrieval while reducing redundancy. This approach will simplify relationships between parts of the application, facilitate the implementation of other VMs in the future, and make it easier to maintain and optimize the storage layer.
ConclusionI recommend moving forward with Option 2, as it provides a consistent and future-proof storage design. This will help reduce redundancy and make the system easier to maintain. Would appreciate feedback from the team regarding how possible you think this approach is, and what is the best option to follow now. |
Let's try to tackle low-hanging fruit on our storage ahead of the launch; then we'll tackle larger re-organizations and specifications of the storage later on. |
Shall we refer here about security concerns about local db?
|
Thank you for doing the research @ajnavarro 🙏 A few open questions I had while reading this:
Does this mean we store duplicated object content for each sequence, or is there some smarter logic that gives you the latest sequence for the latest object version?
What is the structure of this data? Just an int64 (block num)?
I'm assuming this is updated every time we have a new block. Why do we store it?
👀 The storage layer is something we can migrate if need be in the future, when we change data representations.
Can we create open issues for these things? @Kouteki |
The majority is in favor of option 1 - minor fixes before the launch, and greater reorg afterwards. I'll close this issue at the end of the cycle, and I've created #3264 to track option 2 afterwards |
Description
This task concerns scoping out and documenting (can be a single HackMD document, not the official documentation) the current Gno.land storage layer.
We utilize LevelDB for our embedded storage, but have no concrete optimizations for writes / reads. The first step to optimizing the storage layer is to exactly detail:
The text was updated successfully, but these errors were encountered: