The unary negation operator does not check for overflows:
@public
def neg(i: int128) -> int128:
return -i
This is OK for all inputs except -2^127, for which it returns -2^127 instead of reverting.
Good catch!
Overflows also happen for uint256, although it is questionable whether using negation on an unsigned value should be allowed at all.
should not be allowed, yes