The Death of the __gap: Custom Storage Layouts
summary
Shows how hardcoded storage gap (50 slots) patterns break upgrades with concrete examples (worms/insects swapped, Audience lost $6M in 2022 after a bad upgrade), and demonstrates using layout at in 0.8.29 plus ERC-7201 namespaced storage to relocate each contract’s storage slot. Current tooling requires assembly, manual getters and only one layout per inheritance tree; proposed Solidity extensions let each contract declare its own layout slot so upgrades and multiple inherited modules keep correct, noncolliding storage and the examples work.
AI-written summary · about
chapters (14)
- 0:00Upgradeable smart contracts intro
- 1:05Storage layout upgrade problems
- 3:32Storage collision consequences
- 4:58Real-world exploit example
- 5:20Storage gaps as solution
- 7:30Storage gaps in inheritance
- 9:35Diamond storage and ERC-2535
- 10:57Namespace storage with ERC-7201
- 12:03Namespace storage implementation
- 14:54Custom storage layouts in Solidity 0.8.29
- 16:20Limitations of custom layouts
- 17:22Future of custom storage layouts
- 19:27Storage layout evolution
- 20:09Q&A
related talks
17mNamespace storage for now and for a verkle EVM
01h 22mUpgradeability with ZeppelinOS: How Fix Bugs on Deployed smart contracts
25mCommSec D2 - Smart Contract (In)Security
32mSmarter Contract Upgrades with Orthogonal Persistence
15mSecurity considerations when building Hooks in Uniswap V4
21mScaffold-Eth, OpenZeppelin, and EVM Optimization
20mLearning How to Build Secure Smart Contracts
19mCreate 2 Patterns
