Skip to main content

What Happens to a Contract’s State Variables during a Mutable Upgrade?

During a mutable upgrade using a proxy pattern, the contract's state variables (data) are preserved in the proxy contract's storage. The new logic contract only dictates how that existing data is read and modified.

It is crucial that the storage layout of the new logic contract is identical to or compatible with the old one to prevent data corruption, a risk known as storage collision.

What Is the Difference between a State Change and a Code Change in a Deployed Smart Contract?
What Is a “Governance Attack” on a Mutable Contract?
What Is a Proxy Pattern in the Context of Smart Contract Mutability?
How Does the ‘Delegatecall’ Opcode Enable the Proxy Pattern?