Skip to main content

When to Use This Pattern

Prevents unauthorized ownership transfers, which could allow attackers to take complete control of the protocol. Critical for DeFi protocols with owner-controlled administrative functions, lending protocols, yield aggregators, cross-chain bridges, and governance systems. For example, in the Radiant Capital hack, the attacker gained control over 3 signers of the multisig, which allowed them to change ownership of the lending pools and ultimately drain the protocol. This assertion would have prevented such an attack.

What This Pattern Checks

Monitors changes to the owner address storage slot in contracts using:
  • _preTx() / _postTx() with Reshiram snapshot reads: Compare owner address before and after transaction
  • ph.loadStateAt(): Load the owner and admin slots at each snapshot
  • registerTxEndTrigger(): Trigger when owner address changes
The assertion performs both direct pre/post comparison and verification of all intermediate state changes to detect unauthorized ownership modifications. For more information about cheatcodes, see the Cheatcodes Documentation.

Assertion Pattern

Full examples and mock protocol code are available in credible-std.