Rules › Solidity

unchecked { } arithmetic

infoSolidityRule sol-unchecked-block

Overflow checks are off inside unchecked; make sure every operation there is provably bounded.

Why it matters

Inside unchecked { }, Solidity 0.8's overflow checks are off. That's fine for provably bounded math (a loop counter that can't reach type(uint256).max) and saves gas, but anything derived from user input, balances or prices must stay checked. This rule flags every block so you can confirm each one.

Vulnerable

unchecked {
    balances[to] += amount; // user-controlled: may wrap
}

Fixed

for (uint256 i; i < items.length; ) {
    // ...
    unchecked { ++i; } // bounded by items.length
}

What other tools call it

ToolDetector or reference
SWC registrySWC-101

Check your code

Paste a contract into the in-browser checker, or let the Claude Code plugin scan before every deploy. The quick check for this rule is a pattern match: treat a hit as "look here", and a miss as no guarantee.

Static analysis finds known bug classes; it can't prove code is safe and isn't an audit. Get a professional audit before deploying code that will hold value.