Skip to content

Glossary

delegatecall

The EVM opcode that runs another contract's code in the caller's own storage, balance, and msg.sender context — the mechanism behind upgradeable proxy contracts.

delegatecall is a low-level EVM call that executes the bytecode of a target contract while keeping the caller's execution context: storage, address, balance, and msg.sender all remain those of the calling contract. Only the code is borrowed from the callee.

This is what makes proxy patterns possible. A proxy contract holds the state and delegatecalls into a separate implementation (logic) contract, so the logic can be swapped for an upgrade without migrating storage — the basis of transparent, UUPS, and diamond proxies.

The power is also the danger. Because the callee writes to the caller's storage, a mismatched storage layout between proxy and implementation can silently corrupt state, and an unprotected delegatecall to an attacker-controlled address can let it run selfdestruct or overwrite critical slots — the root cause of the 2017 Parity multisig freeze.