Solidity interview: Overflow/Underflow handling — 0.8 checks, SafeMath, and upgradeable contract gotchas
I’m prepping for a Solidity interview and got stuck when they asked about integer overflow/underflow.
I know Solidity 0.8+ has built-in overflow checks, but the interviewer didn’t stop there. From what I understand, Solidity 0.8+ checks overflow and underflow by default. So the basic answer is that normal arithmetic reverts instead of silently wrapping.
But I am not sure how to turn this into a strong interview answer.
The part I want to understand is where risk still remains: unchecked, older contracts, upgradeable contracts, compiler changes, and assumptions around balances, rewards, limits, or pricing logic.They kept asking:
Is SafeMath (OpenZeppelin style) still relevant anywhere today, or is it purely legacy?
When do people use unchecked in real projects, and how do you defend that decision in an interview?
Any realistic “gotchas” when contracts are upgradeable and logic changes over time (or when teams update compiler versions across releases)?
I’d love a practical interview-ready explanation — not just theory. If you’ve seen real cases (or common interview traps), please share.