How Does the Signed Integer Type Change the Definition of Overflow/underflow?
The signed integer type (e.g. int256 ) changes the definition by allowing for both positive and negative values, with half the range dedicated to each. Overflow occurs when a positive number exceeds the maximum positive value, wrapping to the maximum negative value.
Underflow occurs when a negative number goes below the maximum negative value, wrapping to the maximum positive value. In contrast, unsigned integers ( uint256 ) only handle non-negative values, where underflow wraps from zero to the maximum positive value.