Walk me through a re-entrancy attack, and how checks-effects-interactions prevents it
A reentrancy attack happens when a smart contract calls an untrusted address before updating its own state, letting the callee enter again and reuse stale balances. The checks-effects-interactions pattern closes that window by validating first, mutating state next and calling out last.