Skip to main content
Sigvex

Bytecode Size Limit

Detects contracts approaching or exceeding the EIP-170 24KB bytecode size limit, which prevents deployment.

Bytecode Size Limit

Overview

Remediation Guide: How to Fix Bytecode Size Limit

The bytecode size limit detector identifies contracts whose deployed bytecode approaches or exceeds the 24,576 byte limit imposed by EIP-170. Contracts exceeding this limit cannot be deployed on Ethereum mainnet or most EVM-compatible chains.

Why This Is an Issue

EIP-170 (Spurious Dragon hard fork) set a maximum contract code size of 24,576 bytes. Contracts exceeding this limit fail to deploy. Contracts approaching the limit (>23,000 bytes) are at risk of exceeding it with minor additions, and they incur higher deployment gas costs.

Large contracts typically indicate insufficient modularization – logic that should be split across libraries or separate contracts is monolithically bundled.

How to Resolve

  • Split large contracts into libraries using DELEGATECALL
  • Use the diamond proxy pattern (EIP-2535) for modular facets
  • Move view/pure functions to separate utility contracts
  • Use external libraries instead of internal ones (external libraries are deployed separately)

Examples

Sample Sigvex Output

{
  "detector_id": "bytecode-size-limit",
  "severity": "medium",
  "confidence": 0.95,
  "description": "Contract bytecode is 23,842 bytes (97% of 24,576 byte EIP-170 limit). Adding more logic may prevent deployment. Consider splitting into libraries or proxy facets.",
  "location": { "function": "contract-level", "offset": 0 }
}

Detection Methodology

  1. Size measurement: Measures the deployed bytecode length.
  2. Threshold check: Flags contracts above 22,000 bytes (90% of limit) as warning, above 24,576 as error.
  3. Function analysis: Reports the largest functions by bytecode contribution to guide refactoring.

Limitations

  • Constructor code (initcode) is not subject to the 24KB limit and is not flagged.
  • EIP-7702 and future EIPs may adjust the limit for specific contract types.

References