Skip to content

Analysis · DeFi

Upgradeable contracts on Ethereum: the admin key is the security model

Most large DeFi deployments sit behind a proxy that can be pointed at new code. Storage layout, initialisers and selector clashes are the technical traps; who controls the upgrade, and with what delay, outranks all of them.

By Etherelysium Editorial TeamUpdated 18 November 20263 min read

Upgradeable contracts on Ethereum: the admin key is the security model
Share X LinkedIn

Immutable code is a strong guarantee and an awkward one: bugs are permanent and nothing can be tuned. So most substantial Ethereum deployments are upgradeable. That is a reasonable choice, and it moves part of the security model out of the code and into whoever can change it.

How a proxy works

An upgradeable deployment splits one contract into two. A proxy holds the storage and the address users interact with. An implementation holds the code. The proxy forwards each call using delegatecall, which runs the implementation’s code against the proxy’s storage. Upgrading means pointing the proxy at a new implementation: same address, same balances, different behaviour.

ERC-1967 standardised where proxies keep that pointer: a fixed storage slot derived from a hash, 0x360894a1...382bbc for the implementation and 0xb5312768...5d6103 for the admin, chosen so they cannot collide with the implementation’s own variables. It also defines the events Upgraded and AdminChanged. Those two details make the control structure readable from outside: anyone can read the slots and the event history of a proxy on a block explorer.

Three technical traps

Storage layout

Solidity assigns storage slots by declaration order. A new implementation must keep the old layout; appending variables at the end is safe, inserting or reordering is not. Get it wrong and every later variable reads what its predecessor left behind, and nothing reverts. Reserved storage gaps and hashed slots are the known mitigations, and both depend on discipline at every future upgrade.

Initialisers

A constructor runs in the implementation’s context, so proxied contracts use an initialiser that must run exactly once. Two classic failures: the guard is missing and someone re-initialises the proxy to take ownership, or the implementation itself is left uninitialised and someone claims it directly. Disabling initialisers on the implementation at deployment is a one-line fix that is regularly omitted.

Selector clashes

If the proxy exposes its own admin functions, one of their selectors can match a function in the implementation, and calls hit the wrong code. Routing admin calls by caller, or explicit selector tables, solve it; custom proxies reintroduce it.

The question that outranks the rest

Who can perform the upgrade? If a single key can repoint the proxy, the protocol’s security is that key’s security, whatever the audits say. A multisig helps in proportion to its threshold and to how independent its signers really are, which the chain cannot tell you. A timelock helps more: it does not stop a bad upgrade, but it turns an instant change into an announced one and gives users time to leave. Then check for bypasses: an emergency role, a guardian, or a pause function held by someone else.

The same logic applies to rollups, whose bridge and verifier contracts are usually upgradeable. See what a rollup inherits from Ethereum.

The Settlement Test

  • What settles: each call settles against whatever implementation the proxy points to at that block. An upgrade settles the moment the admin’s transaction is included, or when a timelock’s delay expires.
  • What it costs: gas for the upgrade itself is trivial; the real cost is the trust users extend to the admin, and the monitoring needed to watch a timelock queue.
  • What breaks: a compromised admin key, a storage-layout mistake that silently corrupts state, or an initialiser left open.

What you can establish on-chain, and what you cannot

From the chain: whether a contract is a proxy, its implementation, its admin, whether the admin is a multisig and at what threshold, whether a timelock exists and its delay, and what is queued. Not from the chain: who the signers are, where the keys are held, and what happens if one is lost. A project that answers those in writing tells you something; so does one that does not. Related: token approvals, which outlast upgrades of the contracts they point to.

Primary sources

Educational content, human-edited and possibly AI-assisted. It describes how systems work and is not financial, legal or tax advice. Report an error via our corrections page.

More in DeFi

Related articles

See all