Reentrancy and External Calls
- Reentrancy. Reentrancy is the callee calling back before your state settles: the DAO’s billion-dollar lesson.
- Guards and ordering. Defence is ordering: checks-effects-interactions: with a reentrancy guard as the belt to those braces.
- Cross-function reentry. Reentry crosses functions and even contracts: the audit traces every path state can be observed mid-change.
Access and Economic Attacks
- Missing access control. The most common exploit is the unprotected function: anyone calling what only admin should.
- Oracle manipulation. Prices read from one pool are manipulable: flash loans bend spot prices, TWAPs and real oracles resist.
- MEV awareness. Transactions are public before mining: front-running and sandwiching are the mempool’s weather.
Secure Contract Patterns
- Pull payments again. Withdrawal patterns isolate value transfers: one user’s failure never blocks another’s funds.
- Pause and limits. Circuit breakers: pause, rate limits, caps: bound the damage of the unknown unknown.
- Audit mindset. Security is a process: threat model, tests, review, audit, bounty: never a final checkbox.
Before and after this level
- Before: Level 8: Tokens & Standards: ERC Standards, Fungible and Non-Fungible Assets, Standards-Compliant Contract Design.
- Next: Level 10: Gas & EVM Efficiency: Gas Model, Storage and Execution Costs, Optimising Without Sacrificing Safety.
In the app each of these ideas is taught and then asked back, and the level ends with a checkpoint and flashcards. See Checkpoints and flashcards.
Frequently asked questions
What does Solidity Level 9: Smart Contract Security cover?
Reentrancy and External Calls, Access and Economic Attacks, Secure Contract Patterns: 3 lessons and 9 ideas.
What should I know before this level?
The level before it, Level 8: Tokens & Standards, which covers ERC Standards, Fungible and Non-Fungible Assets, Standards-Compliant Contract Design.