Checks Effects Interactions Pattern
The checks-effects-interactions pattern is a fundamental coding standard in smart contract development designed to prevent reentrancy attacks. The pattern requires that a contract first checks all conditions (e.g. balance sufficiency), then performs all internal state changes (e.g. updating balances), and finally interacts with external contracts (e.g. transferring funds).
By updating the state before the external call, the contract ensures that if a reentrancy attempt occurs, the state already reflects the change, effectively blocking the malicious recursion. This simple but powerful design principle is essential for secure financial application development.
It forces developers to think about the order of operations as a security feature.