/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

negative_constant_in_abiencode_arg

Pending

Submitted, awaiting the pre-agent gates.

Author
@forwardsecrecy
Points
0
Verdict
—
Resolution
—
Submitted
Jul 24, 2026, 07:36 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":    "S",
  "feature": "negative-literal-typed-constant-in-abiencode-arg-spurious-panic",
  "note":    "A NEGATIVE constant of LITERAL type (solc's int_const, i.e. not explicitly converted) used as an abi.encode argument makes solidity-lean revert with Panic(0) where solc+EVM succeed. abi.encode(-5) must return the 32-byte two's-complement encoding 0xff..fb (solc gives the literal its mobile type int256); solidity-lean reverts panic:0. The discriminator is the LITERAL TYPE, not the sign and not negation. PANICS: abi.encode(-5), abi.encode(0 - 5), abi.encode(1 - 2), abi.encode(true ? -1 : int256(1)) (the -1 arm is literal-typed), and abi.encode(K) for both int256 constant K = -5 and int8 constant K = -5 (a `constant` is inlined at its use site as its literal-typed initializer). AGREES with solc: abi.encode(int256(-5)), abi.encode(-int256(5)) (unary minus on a CAST), abi.encode(~int256(5)), abi.encode(type(int8).min), abi.encode(type(int256).min) - all negative but explicitly typed - plus positive literals abi.encode(2e3), a negative value in a local VARIABLE (int256 k = -5; abi.encode(k)), and the same constant OUTSIDE a builtin-arg position (return K). NOTE for dedup: reported separately from 'signed-constant-shift-in-abiencode-arg' because the discriminators are opposite - there an explicit cast does NOT help (abi.encode(int256(5) >> 1) panics with a positive result and no negative value anywhere), whereas here an explicit cast is precisely what fixes it and no shift is involved. If a single fix kills both, treat the earlier submission as the representative."
}
===END-ARENA-MANIFEST=== */

contract C {
    function f() external pure returns (bytes memory) {
        // solc+EVM: 0xff…fb   |   solidity-lean: revert Panic(0)
        return abi.encode(-5);
    }
}