Support storage layout gaps
See original GitHub issueWe often recommend including a storage “gap” in storage layout in order to safely add storage variables when using (multiple) inheritance. We use this pattern ourselves in OpenZeppelin Contracts Upgradeable. However, if a slot in the gap is actually used for a new variable later, the plugins will flag this as an error. We should detect gaps through the conventional __gap
name and treat them specially for layout compatibility: allow replacing gap slots with new variables in an upgrade.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:11
- Comments:29 (13 by maintainers)
Top Results From Across the Web
Validate Smart Contract Storage Gaps With OpenZeppelin ...
The plugins run storage gap validation checks, ensuring that developers using the OpenZeppelin Upgrades plugins can verify their contracts ...
Read more >Designing an efficient storage racks layout for high productive ...
Designing Storage Racks Layout to Improve Warehouse Efficiency. Warehouses are not just storage spaces but critical components of businesses.
Read more >Ways to Squeeze More Storage Out Of Small Spaces
There is often much more storage space in your home than you think. ... Drill holes into the sides to accept shelf supports....
Read more >How to Pick the Right Warehouse Layout to Improve Operations
Depending on existing warehouse floor space, some layouts may be more ... Dynamic storage holds all inventory that doesn't have a fixed ...
Read more >Configuring storage in the server installer - Ubuntu
If you select “Custom storage layout” no configuration will be applied to the ... The server installer supports creating devices with RAID level...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This is quite limiting unfortunately for automating upgrades
Sharing my proposed design notes for this feature.
We currently have a levenshtein module that computes a minimum cost edit distance between two storage layouts. A levenshtein edit distance consists of a list of insertion, deletion, and substitution operations that convert one layout into the other. My proposal is to generalize this to a custom edit distance with operations designed for our domain, with something like a “gap shrink” operation. Then, using the levenshtein module (which really stops being about levenshtein and becomes a generalized Wagner-Fischer implementation) we compute the minimum edit distance with the custom operations. That edit distance may include some insertion operations, i.e. storage variables added in the middle of the layout, which we would normally disallow, but we can now allow them if they are followed by a matching gap shrink operation of the right size.
Furthermore, we should tune the costs of operations to make sure that the minimum cost edit distance is the one that would include the operations we’re looking for. This should be simply a matter of giving lower cost to operations that we want to prioritize, e.g. the gap shrink should be a low cost operation.