Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

AnomalyGatedUpgradeAssertion

Git Source

Inherits: AnomalyGatedBaseAssertion

Title: AnomalyGatedUpgradeAssertion

Author: Phylax Systems

Reverts only when the transaction is anomalous AND a watched configuration slot changes on the watched contract: the EIP-1967 implementation slot, the EIP-1967 admin slot, or the supplied ownerSlot when non-zero. Either condition alone passes. Invariant covered:

  • Gated config change: an anomalous transaction may not rewrite the proxy implementation, the proxy admin, or the owner slot. A contract does not rewrite its own implementation in normal use, so the upgrade heuristic adds almost no false blocks.

The watched contract (upgradeTarget) is named separately from the anomaly focal (target), mirroring the drain heuristic’s outflowTarget: a lending pool is scored while the custody aToken sits behind its own proxy. address(0) watches the focal.

Constants

upgradeTarget

The contract whose slots the upgrade heuristic watches, or address(0) to watch the anomaly focal target.

address internal immutable upgradeTarget

ownerSlot

An extra owner-shaped slot to watch, or bytes32(0) to watch only the EIP-1967 slots.

bytes32 internal immutable ownerSlot

Functions

constructor

constructor(address _upgradeTarget, bytes32 _ownerSlot) ;

_registerUpgradeTrigger

Register the anomaly trigger for the gated upgrade check. Call this inside triggers().

function _registerUpgradeTrigger() internal view;

_upgradeCorroborates

Whether the upgrade heuristic corroborates on this transaction.

function _upgradeCorroborates() internal view virtual returns (bool);

assertAnomalousUpgrade

Reverts only when the transaction is anomalous and a watched config slot changes.

function assertAnomalousUpgrade() external view;

Errors

AnomalousUpgrade

error AnomalousUpgrade();