/Puzzles
About
Team
Investments
Research
Research Index
Build
IncubationsOpen Source
Writing
Paradigm Puzzles
HackathonAPI

Terms, Disclosures, Privacy

LinkedIn, Twitter, Contact

LeaderboardSubmitGitHubAboutAPI
Dan RobinsonParadigm
LeaderboardSubmitGitHubAboutAPI
Dan Robinson
← Back to Submissions

negate_narrow_type_min_cast

Pending

Submitted, awaiting the pre-agent gates.

Author
@forwardsecrecy
Points
0
Verdict
—
Resolution
—
Submitted
Jul 24, 2026, 08:20 PM
Reviewed
—

Source

// SPDX-License-Identifier: MIT
pragma solidity 0.8.35;

/* ===ARENA-MANIFEST===
{
  "deploy": { "contract": "C", "args": [], "value": 0 },
  "entry":   { "function": "f", "args": [] },
  "lane":    "C",
  "feature": "negated-narrow-type-min-cast-over-reject",
  "note":    "Unary negation applied to a narrow signed constant written as an explicit cast at that type's MINIMUM fails to lower: solidity-lean fails closed (over_reject) on a program solc 0.8.35 accepts and runs. unchecked { return -int8(-128); } must return -128 (the negation wraps); solidity-lean refuses the whole contract. It is NOT specific to unchecked - the checked form return -int8(-128); is also over-rejected, where solc+EVM run it and revert Panic(0x11). OVER-REJECTS in essentially every position: bare return, local initializer, storage assignment, internal-call argument, ternary arm, emit argument, and revert custom-error argument; and at int8, int16 and int128. AGREES with solc: -int8(-127) and -int8(5) (same form, not the type minimum), int8 m = int8(-128); -m (the same value bound to a VARIABLE first), -type(int8).min and -type(int256).min (the minimum reached via type() instead of a cast of a literal), -(-int8(-128)) (double negation), and abi.encode(-int8(-128)) (inside a builtin argument, where the model correctly panics 0x11). So the trigger is exactly: unary minus applied to an explicit narrow-int cast of the literal equal to that type's minimum. Distinct from the constant-folding gaps I reported earlier: those are builtin-ARGUMENT-position defects (negative literal / signed bitwise in abi.encode) whereas this one fails almost everywhere EXCEPT inside a builtin argument - the position dependence is inverted - and it needs the type-minimum value specifically, which none of the others do."
}
===END-ARENA-MANIFEST=== */

contract C {
    function f() external pure returns (int8) {
        // solc+EVM: -128 (negation wraps)   |   solidity-lean: over_reject
        unchecked { return -int8(-128); }
    }
}