Invariant Specification
Invariant specification is the process of defining fundamental properties of a protocol that must always hold true, regardless of the transactions that occur. For example, an invariant might state that the total value of assets in a liquidity pool must always equal the sum of user deposits.
During verification, these invariants are checked against the contract's code to ensure that no sequence of operations can violate them. If an invariant is violated, it indicates a critical bug in the protocol's logic.
Defining strong, clear invariants is a prerequisite for formal verification and helps developers think critically about the security boundaries of their systems. It is a best practice that transforms abstract security goals into concrete, testable constraints.