Skip to main content
A proxy must keep its current implementation until your team approves an upgrade. This example rejects a transaction whose final implementation address differs from its initial address.

Behavior

ImplementationChangeAssertion registers a transaction-end check. It reads slot 0 at _preTx() and _postTx() with ph.loadStateAt, then requires the decoded addresses to match.

Configuration

Replace IMPLEMENTATION_SLOT with the slot used by the deployed proxy. Slot 0 is a teaching layout; it is not the ERC-1967 implementation slot. Attach the assertion to the proxy whose storage contains that slot. The example has no constructor arguments and no approved-upgrader exception. A legitimate upgrade also fails while this lock is active. Coordinate a policy change through your deployment process before the upgrade.

Scenarios

Coverage limits

This checks one stored address. It does not prove that the implementation is safe, protect other admin slots, or detect temporary changes restored before transaction end. For Safe configuration, use the Safe configuration checks.

Source

The reviewed source is a teaching template. The example setup guide provides the pinned checkout and test procedure.