Security Patterns
EIP-1967 is a standard that defines fixed, pseudo-random storage slots where an upgradeable proxy stores its implementation address, admin address, and beacon. Using these deterministic-but-collision-resistant slots prevents the proxy's own variables from overlapping the implementation's storage — the root cause of a proxy storage collision.
The implementation slot is keccak256("eip1967.proxy.implementation") - 1. Because the slot is derived from a hash minus one, no normal sequentially-allocated variable will ever occupy it.
// bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1)
bytes32 constant IMPLEMENTATION_SLOT =
0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
Naive proxies that store implementation in slot 0 or 1 can be corrupted when the implementation writes its own variables to those slots. EIP-1967 slots make that collision effectively impossible and let block explorers detect and display proxy relationships.
Q: Why subtract one from the hash?
A: Subtracting one ensures the slot is not the direct output of a keccak256 used elsewhere (for example a mapping slot), further reducing any chance of collision.
Q: Do I need to implement EIP-1967 manually?
A: Usually not. OpenZeppelin's transparent and UUPS proxy contracts implement EIP-1967 slots for you; use them rather than hand-rolling a proxy.
Related terms
Firepan
Run a free surface scan — results in minutes, no credit card required.
Run Free Scan →