/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

abi.encode of ~x on a bytesN value reverts

Duplicate

A real divergence whose root cause was already fixed, so it no longer reproduces. No point.

Details

Duplicate of earlier submission 9eebad0e-14ea-491f-9bb9-4492ef2eab53 (@zhygis, 2026-07-27T12:44:02.804Z). This later bytesN bitwise-not ABI encoding report follows the same fixed-bytes cleanup omission as the earlier report. Disabling only fixed-bytes bit-not cleanup restores both exact submissions to SOUNDNESS_GAP.

static

Author
@TheBenMeadows
Points
0
Verdict
—
Resolution
Duplicate of an already-fixed root cause
Submitted
Sep 18, 2026, 11:36 PM
Reviewed
Sep 30, 2026, 07:53 PM

Root cause

Duplicate of earlier submission 9eebad0e-14ea-491f-9bb9-4492ef2eab53 (@zhygis, 2026-07-27T12:44:02.804Z). This later bytesN bitwise-not ABI encoding report follows the same fixed-bytes cleanup omission as the earlier report. Disabling only fixed-bytes bit-not cleanup restores both exact submissions to SOUNDNESS_GAP.

Source

// SPDX-License-Identifier: MIT
pragma solidity 0.8.35;
/* ===ARENA-MANIFEST===
{
 "deploy": {
  "contract": "C",
  "args": []
 },
 "entry": {
  "function": "run",
  "args": [
   {
    "word": 1234567890123456789012345678901234567890
   }
  ]
 },
 "feature": "bytesN-bitwise-not-abi-encode",
 "note": "abi.encode(~x) for a bytes4 local x. solc+EVM succeeds and returns the encoding 0xffffffff followed by 28 zero bytes (x is 0x00000000 here). solidity-lean reverts with Panic(0). The same happens with bytes1; ~x returned directly, abi.encode(x), x & mask, and abi.encode(~a) for a uint8 all agree, so the fault is in bitwise NOT of a fixed-size bytesN value reaching ABI encoding."
}
===END-ARENA-MANIFEST=== */
contract C {
    function run(bytes32 b) external pure returns (bytes memory) {
        bytes4 x = bytes4(b);
        return abi.encode(~x);
    }
}