
On this page▾
TL;DR
- A proxy upgrade changes code while preserving storage, so the old and new implementations must agree on the meaning of every existing slot.
- Comments, inheritance intuition, and a successful V1 test suite do not prove that agreement.
- The Dripster audit found correct runtime storage paired with 28 incorrect slot annotations. The defect was in the map a future upgrade could trust, not in V1 execution.[1]
- Public records from Linea, OpenZeppelin, Lombard, and Pike show four distinct ways storage meaning can drift: inheritance changes, dependency changes, reordered struct members, and an executed incompatible upgrade.[5][6][7][8]
- Generated layout comparison should be a release artifact and CI gate. Direct slot reads and forked migration tests answer different questions and should supplement it.
A proxy upgrade can pass authorization, execute successfully, and still assign the wrong meaning to state that already exists.
The reason is architectural. The proxy preserves storage while the implementation supplies code. Every implementation version therefore consumes a persistent data interface. Function selectors are only the visible part of that interface. Storage slots, offsets, types, inheritance order, gaps, and namespaces are the part that survives after the code changes.
This article studies that interface as a versioned artifact. Its anchor is the Dripster storage-layout case study, where the deployed V1 model described in the audit was internally valid but all 28 hand-written slot annotations were wrong.[1] The comparison then uses public technical records to separate documentation drift from actual layout incompatibility and executed corruption.
An upgrade is storage-compatible only when the proposed implementation preserves the meaning of every existing proxy storage location, not when its source comments look plausible.
Methodology and evidence boundaries
This is a mechanism-led, purposive comparison. A record was included when its primary or technical source described a mismatch between an existing storage interpretation and a proposed, documented, or executed interpretation.
The core records are:
- the Dripster audit finding about incorrect slot annotations under OpenZeppelin v5;
- the ERC-7201 specification and Solidity storage-layout rules;
- OpenZeppelin's upgrade validation guidance and its ERC2771ContextUpgradeable advisory;
- the Linea inheritance-change finding;
- the Lombard LBTC struct-reordering finding; and
- Pike's first-party post-mortem of an incompatible upgrade.
The records do not form a representative sample of upgradeable contracts or audit findings. No prevalence claim follows from them.
Four labels keep the evidence separate:
- Source fact: the cited source reports the behavior, status, or recommendation.
- Zealynx classification: this article groups the record by the kind of representation drift involved.
- Inference: a general design conclusion derived across records.
- Limitation: the source does not establish exploitation, deployment, remediation, or impact beyond what it explicitly reports.
The invariant: old storage keeps its old meaning
Solidity ordinarily assigns state variables to storage from slot 0 according to declaration order, packing rules, and C3-linearized inheritance order. Mappings and dynamic arrays derive their data locations from their assigned slots.[3]
A proxy complicates this model because implementation code executes against proxy storage. After an upgrade, the bytes remain where the earlier implementation wrote them. Only the code interpreting those bytes changes.
The compatibility invariant can be stated as:
1For every storage location written before an upgrade:23meaning under implementation V24 ==5meaning under implementation V1
"Meaning" includes more than the slot number. It includes:
1namespace or root slot2+ relative slot3+ byte offset4+ encoded type5+ dynamic-data derivation6+ ownership by the same logical field
Appending a new variable can be safe in one inheritance structure and unsafe in another. Keeping a field name can still be unsafe if its type or offset changes. Preserving a top-level namespace can still be unsafe if members inside its struct are reordered.
This is why storage layout behaves like an application binary interface for persistent state. It is consumed by later code even if no Solidity interface declares it.
The Dripster anchor: correct state, false coordinates
The Dripster report describes a UUPS-upgradeable vault built with OpenZeppelin v5. Its inline comments assumed that inherited upgradeable modules occupied four sequential slots before Dripster's own state. In OpenZeppelin v5, those inherited modules used ERC-7201 namespaced storage instead.[1][2]
The result was a four-slot error in every hand-written annotation. The report states that all 28 annotations were shifted.
globalAdmin was documented at slot 4 but occupied slot 0, and the documented storage-gap range was also displaced.[1]The important distinction is that V1 was not reported as reading the wrong state. The compiler-generated V1 layout was valid. The report classified the immediate runtime impact as absent because contract logic did not consume the comments.[1]
The risk appeared at the next decision boundary:
1correct V1 state2+ incorrect human map3+ V2 planned from that map4= possible overwrite of live state
The audit used Foundry
vm.load checks against the proxy to confirm that the four administrator addresses occupied slots 0 through 3. It then modeled the consequence of a developer treating slot 0 as available for a new V2 variable. That write could overlap globalAdmin.[1]Zealynx classifies this as documentation-to-layout drift. The source record says the comments were corrected and OpenZeppelin Foundry Upgrades layout validation was added to CI. It does not establish that an incompatible V2 was deployed or that exploitation occurred.[1]
ERC-7201 changes allocation, not the compatibility obligation
ERC-7201 standardizes a NatSpec annotation and formula for namespaced storage structs. The specification explains that upgradeable and modular systems benefit from independent storage trees rooted outside Solidity's default sequential tree.[2]
This reduces a specific class of collision. Separate modules can use distinct namespace roots rather than coordinating every field in one inherited sequence.
It does not make storage evolution automatic.
Within a namespace, member order and types still define how data is encoded. The namespace identifier itself must remain stable. A migration from a sequential OpenZeppelin v4 layout to namespaced OpenZeppelin v5 storage is not made compatible merely because the new model is cleaner.
The Dripster finding illustrates a subtler transition. The project already used the v5 model correctly, but its comments still described the v4 mental model. The implementation and documentation had crossed the version boundary at different times.
Zealynx classifies this as model-transition drift. The reusable lesson is not "namespaces are unsafe." It is that a dependency's storage model is part of the upgrade contract, and every explanatory artifact must be regenerated when that model changes.
Comparative matrix: four routes to changed meaning
| Record | What changed or disagreed | Source-reported context | Zealynx classification | Evidence boundary |
|---|---|---|---|---|
| Dripster | Comments placed project state four slots later than the compiler and proxy did | Medium, fixed; V1 runtime layout reported valid [1] | Documentation-to-layout drift | No incompatible V2 or exploitation reported |
| OpenZeppelin ERC2771ContextUpgradeable | Package versions used different total layout lengths | Low advisory; affected versions and workaround identified [6] | Dependency-version drift | Advisory describes upgrade risk, not a reported exploit |
| Linea TokenBridge | Replacing an inherited guard changed C3 linearization and moved Initializable storage | Critical, fixed in the audit record [5] | Inheritance-graph drift | Client self-reported finding; source records a fix and later bytecode checks |
| Lombard LBTC | globalNonce moved from the first member to the end of a storage struct | Low, fixed in the report; developer said the variable was removed before deployment [7] | In-namespace member drift | Report does not describe production corruption |
| Pike | An upgrade changed the Spoke storage layout so initialization state was misread | First-party post-mortem reports unauthorized upgrades and withdrawals [8] | Executed layout corruption | Incident-specific facts do not transfer automatically to other proxies |
The comparison shows that "do not insert a variable in the middle" is necessary but incomplete. Existing storage meaning can also change when:
- a base contract moves in the C3 linearization;
- a dependency release changes a base layout;
- a namespaced struct reorders members;
- a gap is resized incorrectly;
- a namespace identifier changes; or
- documentation remains pinned to an older storage model.
Dependency-version drift: the package is part of the layout
OpenZeppelin's ERC2771ContextUpgradeable advisory describes a concrete dependency-level incompatibility. Versions 4.0.0 through 4.2.0 used 51 slots, while version 4.3.0 and later used 50. The advisory warns that upgrading across that boundary could break storage compatibility and says the OpenZeppelin Upgrades plugins would catch the potentially breaking change.[6]
The source's workaround was not "update and hope." It recommended retaining the previous implementation of the affected contract when necessary.[6]
This is dependency-version drift. Application source can remain nearly unchanged while imported storage shifts beneath it. A lockfile diff or major-version review is therefore not separate from upgrade review. It is an input to the storage comparison.
The implication is precise:
An upgrade review must compare resolved compiler layouts, not only application-level declarations.
Source inspection still matters because a tool report needs interpretation. But reading only the local contract can miss inherited changes supplied by the dependency graph.
Inheritance-graph drift: Linea's moved initializer state
The Linea Rollup Update audit gives a more structural example. The reviewed TokenBridge refactor replaced OpenZeppelin's
ReentrancyGuardUpgradeable with a custom transient-storage guard. The replacement reserved the same number of slots, but it did not inherit Initializable. Another base still did, so Initializable moved within the C3 linearization rather than disappearing.[5]According to the finding, that movement corrupted the storage layout and made the contract appear uninitialized. The recommendation preserved
Initializable at the old position and addressed a now-unused reentrancy slot during reinitialization. The audit page reports the Critical finding as fixed and identifies the fixing commit.[5]Zealynx classifies this as inheritance-graph drift. Matching the apparent size of one removed base contract was not enough because layout identity depended on the full linearized graph.
This record also shows why a simple slot-count checksum is weak. Two inheritance trees can reserve similar amounts of space while assigning different semantics to particular positions.
In-namespace drift: a stable root can contain an unstable struct
The Lombard LBTC report compares two versions of a storage struct. In the earlier version,
globalNonce was the first member. In the later version, it appeared after newly added fields. The report states that this ordering would corrupt the implementation upgrade's storage layout and recommends preserving field order by appending new variables.[7]The developer response recorded in the report says the variable was unused and removed before deployment. That limits what the public record establishes about production impact.[7]
Zealynx classifies this as in-namespace member drift. It matters because namespacing only isolates one storage tree from another. It does not make arbitrary edits inside the tree compatible.
A stable namespace root plus a reordered struct is still an incompatible interface:
1same namespace2+ different member order3= different interpretation of existing bytes
Executed corruption: Pike crossed the release boundary
Pike's first-party post-mortem reports that an upgrade altered the Spoke contract's storage layout, including the position of initialization variables. The contract then behaved as though it were uninitialized, enabling unauthorized upgrades and withdrawals.[8]
This is the strongest incident evidence in the comparison because the incompatible interpretation crossed from proposed code into an executed upgrade. Zealynx classifies it as executed layout corruption.
The comparison must remain bounded. Pike does not prove that every layout mismatch creates the same authorization path or impact. It demonstrates that initialization state is one security-critical field whose changed interpretation can connect storage compatibility directly to upgrade authority.
Dripster is not presented as another Pike. Dripster is the earlier control failure class: a false map that could have informed a future upgrade. Pike shows why preventing that class before execution matters.
Three representations, three different checks
Storage safety is easier to reason about when teams separate three representations.
1. Declared layout
This is the compiler and tooling view of variables, namespaces, slots, offsets, and types for a particular build.
Use it to answer:
- Did an existing field move?
- Did its type or offset change?
- Did inheritance reorder storage?
- Did a namespace or gap change?
2. Persisted state
This is what the proxy actually stores at a particular chain state.
Direct reads such as Foundry's
vm.load can confirm critical coordinates and values. They are especially useful for administrator slots, implementation slots, accounting roots, and migration sentinels.A few slot reads cannot prove complete compatibility. They sample state. They do not replace a full layout diff.
3. Migration behavior
This is what happens when the real upgrade and optional migration call execute against old state.
A forked test can assert that:
- old balances and roles remain unchanged;
- initialization versions advance exactly once;
- new fields receive intended defaults;
- deprecated fields are handled explicitly; and
- the upgrade remains authorized and recoverable.
A migration test can miss dormant states that the fork does not contain. It therefore complements generated compatibility checks rather than replacing them.
A release gate for storage-compatible upgrades
A defensible gate should produce reviewable artifacts before an upgrade transaction is signed.
Step 1: freeze the actual baseline
Identify the deployed proxy, current implementation, source commit, compiler version, optimizer settings, and resolved dependencies. A guessed baseline invalidates the comparison before it starts.
Step 2: generate both layouts
Generate machine-readable layouts for the baseline and candidate. Do not transcribe slots into a document and then compare the document.
OpenZeppelin's Foundry Upgrades library includes upgrade-safety validation, and OpenZeppelin recommends its upgrade tooling for detecting layout incompatibilities.[4][6]
Step 3: classify every delta
A useful review table is:
| Delta | Default decision |
|---|---|
| Existing field keeps slot, offset, and type | Compatible candidate |
| New field appended in permitted space | Review gap or namespace rules |
| Existing field reordered, removed, or retyped | Block pending explicit migration design |
| Base contract or dependency changes | Recompute full inherited layout |
| Namespace identifier changes | Treat as storage relocation |
| Gap changes | Prove consumed slots and remaining capacity |
Tool acceptance is evidence, not the complete decision. Custom assembly, manual slots, external libraries, and migration semantics may require separate checks.
Step 4: read critical persisted slots
Verify a small set of high-consequence values against the live proxy or a pinned fork. The Dripster report used this technique to disprove the comments directly.[1]
Step 5: execute the exact migration on a fork
Run the same
upgradeToAndCall payload, caller, and candidate implementation intended for release. Assert old state before and after the transaction, not only that the call does not revert.Step 6: fail CI on incompatibility
Store the baseline artifact or a validated reference to it. Make an incompatible diff fail before deployment scripts can proceed. Comments can explain generated output, but they must not become the control boundary.
Step 7: review the dependency graph
Treat compiler, OpenZeppelin, and inherited package changes as security-relevant deltas. The OpenZeppelin advisory and Linea finding both show that application intent can remain stable while inherited storage meaning changes.[5][6]
Step 8: keep a recovery decision explicit
Before execution, identify whether rollback is technically and operationally possible, which authority can perform it, and which state changes would make rollback unsafe. A rollback implementation that expects the old layout may itself misread state after migration.
What automation can and cannot prove
Automated layout validation is strongest when both versions expose complete, compiler-recognized layouts and follow supported patterns. It can detect many unsafe reorderings, type changes, and inheritance effects before deployment.[4][6]
It cannot automatically prove every storage claim:
- assembly may compute slots outside ordinary declarations;
- application-specific migrations may transform values while preserving slots;
- external calls during migration may introduce state changes outside the layout diff;
- a compatible layout does not prove correct authorization or business logic; and
- a green comparison against the wrong baseline proves compatibility with the wrong contract.
The right conclusion is not that tools are insufficient and manual review should replace them. The stronger control is layered:
1generated compatibility check2+ critical slot reads3+ exact forked migration4+ manual semantic review
Each layer catches a different failure class.
What this research does not establish
This comparison is curated around storage-meaning drift. It does not estimate how common these failures are.
The source labels are not a uniform severity system. Dripster's provider-authored report records a Medium finding, OpenZeppelin labels its advisory Low, Linea's audit labels its finding Critical, and Lombard's report labels its finding Low.[1][5][6][7] Those labels reflect different systems, preconditions, and publication methods.
"Fixed" is preserved as source-reported status. Except where a source supplies additional deployment verification, it does not independently prove the state of every deployed instance.
The article does not claim that Dripster deployed an incompatible upgrade, that its proxy was exploited, or that its CI remains configured today. The public report supports corrected annotations and recorded layout validation at its evidence cutoff.[1]
Pike is an incident match at the mechanism level, not a claim that every incorrect storage comment leads to the same outcome. Linea and Lombard are pre-deployment or review-stage records in the cited evidence, not realized incidents.[5][7]
The durable rule: compare state meaning, not source appearance
Upgradeable contracts preserve data across code changes. That makes storage layout a versioned interface whether a team documents it that way or not.
The selected records expose different breaks in the same chain:
- Dripster shows a correct runtime layout paired with a false human map.[1]
- ERC-7201 shows how namespaces create independent storage trees without removing the need for stable member layouts.[2]
- OpenZeppelin's advisory shows a package release changing inherited storage length.[6]
- Linea shows C3 linearization moving initializer state after an inheritance change.[5]
- Lombard shows member reordering inside a storage struct.[7]
- Pike shows incompatible interpretation reaching an executed upgrade.[8]
The practical rule is narrow:
Generate the old and new layouts from the exact builds, compare every existing storage meaning, test the exact migration against persisted state, and block release when any unexplained difference remains.
Comments remain useful. They tell a reviewer what the authors believed. The generated layout tells the upgrade what is true.
For broader proxy controls, use the Proxy Security Checklist. For pattern selection and execution context, see Smart Contract Upgradeability. For property-based validation methods, see How Fuzz Testing Strengthens Smart Contract Security.
FAQ
1. Is appending a variable always safe in an upgradeable contract?
No. Appending may be compatible when it uses permitted free space in the same layout, but inheritance changes, gaps, namespaces, packing, and resolved dependency versions still matter. Compare generated layouts against the exact deployed baseline.
2. Does ERC-7201 eliminate storage collisions?
ERC-7201 gives modules independent namespace roots that avoid Solidity's default storage tree.[2] It does not make member reordering, type changes, namespace renaming, or migrations automatically safe. The storage collision risk moves from global slot coordination to preserving each namespace's own interface.
3. Why are storage comments not enough?
The compiler does not execute comments. They can become stale when inheritance or dependencies change. Dripster's report found correct V1 storage with all 28 slot annotations shifted, which made the comments a dangerous planning input rather than a runtime defect.[1]
4. What should CI validate before a UUPS upgrade?
CI should compare the candidate layout with the exact baseline, reject unexplained changes to existing fields, and run the intended migration against representative old state. A UUPS proxy also needs authorization, implementation compatibility, and initialization checks.
5. Can reading live storage prove an upgrade is compatible?
No. Direct reads can verify critical persisted values and disprove an incorrect map, but they sample only selected locations. Use them alongside a complete generated layout comparison and a forked migration test.
Glossary
| Term | Definition |
|---|---|
| Storage Collision | Two implementations assign incompatible meanings to the same persistent storage location. |
| Storage Slot | A 32-byte location in EVM persistent storage, with smaller values potentially packed by offset. |
| UUPS Proxy | A proxy pattern where implementation code contains the upgrade mechanism and authorization hook. |
| Proxy Pattern | An architecture that preserves state in a proxy while delegating execution to replaceable implementation code. |
| Delegatecall | An EVM call mode that runs target code in the caller's storage and execution context. |
Sources
[1] https://raw.githubusercontent.com/ZealynxSecurity/audits/main/web3/2026-04-zealynx-dripster.pdf - Zealynx, Dripster Smart Contract Audit, 28 April 2026
[2] https://eips.ethereum.org/EIPS/eip-7201 - ERC-7201: Namespaced Storage Layout
[3] https://docs.soliditylang.org/en/latest/internals/layout_in_storage.html - Solidity documentation, Layout of State Variables in Storage
[4] https://github.com/OpenZeppelin/openzeppelin-foundry-upgrades - OpenZeppelin Foundry Upgrades, upgrade safety validation library
[5] https://diligence.security/audits/2026/02/linea-rollup-update/ - Consensys Diligence, Linea Rollup Update, finding 3.1
[6] https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/security/advisories/GHSA-7j52-6fjp-58gr - OpenZeppelin advisory, inconsistent ERC2771ContextUpgradeable storage layout
[7] https://raw.githubusercontent.com/lombard-finance/evm-smart-contracts/main/docs/audit/Veridise_V1.pdf - Veridise, Lombard LBTC audit, finding V-LOM-VUL-004
[8] https://paragraph.com/@pikedao/post-mortem-report-pike-contract-upgrade-vulnerability - Pike, Contract Upgrade Vulnerability post-mortem
Working auditors in your corner, all year
Zealynx Insiders: weekly live sessions, 1:1 advisory, pair-auditing, and Krait runs on your code, from an audit firm that publishes its reports.
No spam. Unsubscribe anytime.
Building a protocol? Start with a three-day pre-audit, credited toward your audit →
Keep reading


