Storage Gap Validator for Upgradeable Contracts
Free to download on every platform. Comes pre-installed on BotFone, BotPad and BotFlip — with extra free apps included.
About this app
WHAT IT DOES
This tool connects to your EVM wallet and validates storage gaps in upgradeable smart contracts. It reads contract source code to detect storage variables, identifies storage gap patterns (__gap, _gap), and verifies that upgradeable contracts include appropriate gaps to prevent storage collisions during future upgrades. The tool analyzes inheritance relationships, counts storage variables, and provides recommendations for safe upgradeable contract patterns.
HOW TO USE
Connect your Web3 wallet using the Connect button. Paste your contract source code in the Contract Source Code field. Enter the contract name (optional). Click "Validate Gaps" to analyze storage layouts. Click "Load Sample" to populate fields with an example OpenZeppelin-style upgradeable contract. Results appear in the Results card with a summary of storage variables found, gaps detected, and validation status, followed by a detailed breakdown of storage variables, gap positions, inheritance relationships, and specific recommendations.
TECHNICAL MECHANISM: STORAGE LAYOUT ANALYSIS AND GAP DETECTION
The tool uses regular expression pattern matching to parse contract source code and extract storage variables. It identifies variables declared with common Solidity types (uint, int, address, bytes, string, bool, mapping). The tool specifically looks for storage gap patterns: uint256[N] __gap (OpenZeppelin style) and uint256[N] _gap. It counts the number of gaps and their sizes. The tool also detects inheritance relationships by parsing "is" statements and flags contracts that inherit from other contracts without including storage gaps. The validation status is determined based on the presence of gaps, with recommendations for missing gaps or insufficient gap sizes.
WHAT IT CANNOT SEE
This tool cannot detect storage collisions that depend on inheritance order or complex layouts without full compilation—it performs static analysis but does not compile the contract. It cannot verify that storage gaps are correctly sized for all future upgrades—the tool only detects the presence of gaps, not their adequacy for specific upgrade scenarios. It cannot detect runtime storage corruption or unintended writes—the tool analyzes source code only. It relies on source code parsing and may miss gaps in inherited contracts—inherited contracts must be included in the source for detection. It cannot validate that upgradeable contracts follow correct storage patterns without external context—the tool provides recommendations but does not enforce specific patterns.
PLEASE NOTE
This is a read-only tool—it never signs transactions. All data is processed in-memory and never persists. The tool supports EVM chains only—Ethereum, Polygon, BSC, Arbitrum, Optimism, Avalanche, Base, and Fantom. Storage gaps are essential for upgradeable contracts—always include gaps in upgradeable contract designs. The tool validates presence of gaps but does not guarantee upgrade safety—always conduct comprehensive testing. OpenZeppelin's upgradeable patterns are recommended for most upgradeable contracts.