LayerZeroFault
EVM & JSON-RPC CODE: Panic 0x11 Reviewed & Verified:

Solidity Panic 0x11: Arithmetic Overflow or Underflow Resolution

Verified by Victor Vance • Lead Technical Analyst & Systems Researcher
Quick Diagnostic Answer (Executive Summary) GSC Snippet Verified

Solidity Panic 0x11 (selector 0x4e487b71) indicates an arithmetic overflow or underflow occurred during smart contract execution. Since Solidity 0.8.0, compiler-generated integer checks automatically revert transactions when an arithmetic operation results in a value outside the allowable bounds of the integer type (e.g. subtracting from 0 on a uint256). Inspect the contract variables, audit mathematical operations, or wrap deliberate wraparounds in explicit unchecked blocks. Always validate input variables to ensure operands stay strictly within safe numerical boundaries.

# Root Cause & Technical Architecture

Solidity 0.8.0 introduced native overflow and underflow protection without requiring SafeMath. When an arithmetic error occurs, the EVM issues an `assert()` failure returning the standard Panic selector `0x4e487b71` followed by uint256 code `0x11`. Common causes include attempting to subtract a larger number from a smaller unsigned integer (e.g., `balance - withdrawAmount` when balance is insufficient) or multiplying values that exceed $2^{256} - 1$.

# 4-Step Actionable Diagnostic Protocol

Step-by-Step Resolution
01

Identify Subtract-From-Zero Underflows

Check calculations where a subtraction operator (-) is applied to uint256 variables. Ensure the subtrahend does not exceed the minuend.

02

Audit Multiplications for Intermediate Overflows

Multiplications like (amount * 1e18 * feeBasisPoints) can exceed 256 bits before division occurs. Re-order operations or use uint512/FullMath.

03

Trace Reverting Line Using Foundry cast or forge test

Run forge test -vvvv to inspect the execution trace and pinpoint the exact source code line triggering the Panic(0x11) assertion.

04

Use unchecked Blocks Intentionally for Bitwise Wraps

If modular arithmetic wrapping is mathematically intended (e.g. hash calculations or counters), wrap the specific operation in unchecked { ... }.

# Diagnostic Verification Code / Command

solidity
panic-0x11-guard.sol
// Solidity Panic(0x11) Anatomy & Safe Arithmetic Guard
// Panic signature: bytes4(keccak256("Panic(uint256)")) = 0x4e487b71

function safeWithdraw(uint256 currentBalance, uint256 withdrawAmount) public pure returns (uint256) {
    // Underflow guard: prevents Panic(0x11) on currentBalance - withdrawAmount
    require(currentBalance >= withdrawAmount, "Insufficient withdrawal balance");
    return currentBalance - withdrawAmount;
}
Zero-Secrets Client Sandbox

Launch ERC-4337 UserOp Decoder

Execute client-side cryptographic simulation and parameter checks safely in your browser via native WebCrypto without sending private keys or mnemonics over the wire.

Open Sandbox →
Comprehensive In-Depth Guide

Read Full Investigation & Recovery Workflow

Explore complete architectural diagrams, edge-case failure trees, and detailed post-mortem analysis in our verified deep guide.

Read Guide →

# Related Diagnostic Codes in EVM & JSON-RPC

Related Hex Statuses

# Frequently Asked Questions

FAQ Schema

What is the full hex signature of a Solidity Panic error?

The signature is 0x4e487b71, representing Panic(uint256). Code 0x11 specifies an arithmetic overflow or underflow.

Why did my Solidity 0.7 code work without Panic 0x11?

Prior to Solidity 0.8.0, integers wrapped around silently without reverting unless developers manually used the SafeMath library.

Does Panic 0x11 consume all remaining gas?

Since Solidity 0.8.0, Panic errors use the REVERT opcode and refund unused gas, unlike legacy assert() calls that consumed all remaining gas.