question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support storage layout gaps

See original GitHub issue

We 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:closed
  • Created 3 years ago
  • Reactions:11
  • Comments:29 (13 by maintainers)

github_iconTop GitHub Comments

3reactions
itsermincommented, Sep 6, 2021

@aquiladev unfortunately there isn’t. I’ll see if I can bump it, as I believe it would be valuable … but I don’t want to make any promise I can’t keep.

This is quite limiting unfortunately for automating upgrades

2reactions
frangiocommented, Aug 17, 2022

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found