EIPs Explained

ERC-7936 · Review · ERC · 2025-04-17

ERC-7936: Versioned Proxy Contract Interface

A proxy interface that keeps several implementation versions registered at once, so callers can pin the exact version they trust instead of being forced onto whatever the admin upgraded to last.

What problem does it solve?

Upgradeable proxies point at a single implementation. When the admin upgrades it, every caller is switched immediately. That causes two kinds of trouble:

  • Breaking changes. An integrator built against the old interface can break the moment the implementation changes, and there is no standard way to roll out a new version gradually.
  • Trust in the admin forever. If an admin key or governance process is compromised and a malicious implementation is deployed, users have no way to opt out except to stop using the contract.

ERC-7936 lets one proxy serve many versions side by side and lets each caller choose.

How it works

The proxy keeps a registry mapping a bytes32 version identifier (a semver string, a number, or a Git commit hash) to an implementation address, plus a default version.

Function Purpose
registerVersion(version, impl) Add a version (admin)
removeVersion(version) Remove a version (admin)
setDefaultVersion(version) Choose what un-versioned calls use (admin)
getImplementation(version) / getDefaultVersion() / getVersions() Read the registry
executeAtVersion(version, data) Forward data to that version's implementation and return its result

Rules from the spec: executeAtVersion must check the version exists, forward the call and return the data. Events VersionRegistered and DefaultVersionChanged must be emitted. Admin functions should be access-controlled. A fallback should route ordinary calls to the default version, so existing integrations keep working unchanged. Implementations may also use ERC-1967 storage slots for tooling compatibility.

Sample code

Calling a pinned, audited version from another contract:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

interface IVersionedProxy {
    function getImplementation(bytes32 version) external view returns (address);
    function executeAtVersion(bytes32 version, bytes calldata data)
        external payable returns (bytes memory);
}

interface IVault { function deposit(uint256 amount) external returns (uint256 shares); }

contract PinnedUser {
    IVersionedProxy public immutable proxy;
    bytes32 public constant TRUSTED = bytes32("1.0.0");

    constructor(IVersionedProxy p) { proxy = p; }

    function deposit(uint256 amount) external returns (uint256) {
        bytes memory ret = proxy.executeAtVersion(
            TRUSTED, abi.encodeCall(IVault.deposit, (amount))
        );
        return abi.decode(ret, (uint256));
    }
}

Things to know

  • Status: Review. The interface may still change before it is finalized.
  • Pinning only protects you if the pinned implementation cannot itself be changed and the admin cannot repoint that version. The interface has removeVersion and registerVersion; whether an existing version can be overwritten is left to the implementation, so check it.
  • The spec does not say whether executeAtVersion uses delegatecall (shared proxy storage) or a plain call. If versions share storage, different storage layouts between versions can corrupt state; review this carefully.
  • For splitting one proxy across many facets by function rather than by version, see ERC-2535 (Diamonds).

#proxy #upgradeability #versioning #security #erc

Details

Authors
Raphina Liu (@Stamp9), Monica Jin (@mokita-j), Martin Monperrus (@monperrus)
Status
Review
Type
Standards Track / ERC
Created
2025-04-17

Machine-readable: Markdown · JSON