Skip to content
RED SAGSkills
hardBlockchain Developer interview question

How do you make sure an upgrade to a proxy-based contract does not corrupt storage or break the system?

What the interviewer wants to hear

  • Understand delegatecall: storage lives in the proxy, layout must stay compatible
  • Never reorder, remove or change types of existing variables; append only or use ERC-7201 namespaces
  • Automated layout checks (OpenZeppelin upgrades plugin, forge inspect diff)
  • Initializers and reinitializer versions, disable initializers on implementation
  • Fork tests of the upgrade on real state, timelock and multisig execution

Model answer

Because a proxy delegatecalls into the implementation, all state lives in the proxy's storage, and the new implementation must read the same slots in the same way. So I never reorder, remove or change the type of existing variables, including in parent contracts. New state is appended, or better, kept in ERC-7201 namespaced structs as OpenZeppelin v5 does. I check this automatically: the OpenZeppelin upgrades plugin or a forge inspect storage layout diff in CI fails if the layout is incompatible. Any new setup runs in a reinitializer with a new version number, and the implementation's constructor calls _disableInitializers. Before going live I run the upgrade on a mainnet fork against real state and run the full test suite, including invariants, on the upgraded system. The upgrade itself goes through a multisig and timelock, with a clear rollback plan.

Can you answer it under time pressure?

Take a timed hard round and get scored on every answer.

Start mock interview

More hard Blockchain Developer questions