Checks-Effects-Interactions (CEI)
Security · Abyss
A defensive ordering pattern for on-chain programs: validate all preconditions (Checks), mutate program state (Effects), then execute Cross-Program Invocations (Interactions). By committing state changes before calling external programs, the pattern prevents reentrancy-style bugs and state inconsistencies if the CPI fails or behaves unexpectedly. In Solana, where CPI panics roll back the entire transaction, CEI still matters for guarding against logic bugs in multi-CPI flows. A rate-limited mint instruction applies CEI by verifying signer and limits, updating the minted-amount counter, then executing the MintTo CPI.