EIPs Explained

EIP-8337 · Draft · Core · 2026-07-09

EIP-8337: Validated EVM Code

Lets contracts opt in, via a 0xEF79 prefix, to having their bytecode proven at deploy time to use only static jumps and never underflow the stack, so clients and tools can analyse, compile and prove EVM code in linear time.

What problem does it solve?

In today's EVM, JUMP takes its destination from the stack, so any jump might land on any JUMPDEST. To understand a contract's control flow, a tool must assume every jump can reach every destination. That makes analysis quadratic in code size for clients (a DoS risk for anything run at deploy or execution time, such as a compiler to native code) and potentially exponential for offline tools like formal verifiers. EIP-8173 lays out these costs.

This EIP gives code a way to promise, and the protocol a way to check once, that its control flow is fully static, so every downstream tool can rely on that.

How it works

  • Opt-in marker. Code that starts with MAGIC = 0xEF 0x79 followed by a version byte (0x01 here) must be valid. Prefixes starting with 0xEF have been undeployable since EIP-3541, so no existing contract is affected.
  • Validation at CREATE. The deployed code is checked once, in time and space linear in its size. Failure is an exceptional halt of the CREATE. Creators pay a per-byte validation charge (provisionally 64 gas per byte).
  • Constraints, building on the CALLSUB / RETURNSUB / CALLDEST subroutine opcodes of EIP-7979:
    1. every reachable instruction is a defined opcode;
    2. every JUMP/JUMPI is immediately preceded by a PUSH of its destination, which must be a JUMPDEST or CALLDEST;
    3. every CALLSUB is likewise preceded by a PUSH of a CALLDEST;
    4. stack depth relative to the subroutine entry is the same on every path, and each subroutine has a fixed net stack effect;
    5. no instruction can underflow the data stack, and every RETURNSUB has a matching call.
  • What it proves: no invalid instructions, no bad jump destinations, no stack underflow. Out-of-gas, stack overflow (beyond 1024 items) and static-call violations remain runtime checks.
  • Opcodes behave the same with or without the prefix, so clients still run a single interpreter.

Sample code

A valid snippet, in assembly-style pseudocode:

EF 79 01                 ; MAGIC + version 1
    PUSH1 0x2a
    PUSH2 square         ; destination is a constant
    CALLSUB
    STOP
square:
    CALLDEST             ; subroutine entry
    DUP1
    MUL                  ; net stack effect: 1 in, 1 out
    RETURNSUB

Rejected in MAGIC code, because the destination is computed at runtime:

    CALLDATALOAD(0)
    JUMP                 ; not preceded by PUSH -> validation fails

Things to know

  • Status is Draft. It requires EIP-7979, itself still under review, and the gas charge is provisional.
  • Validation is optional: legacy code keeps working unchanged, but must not start with the new prefix.
  • Validated code lets clients skip runtime JUMPDEST analysis, jump checks and underflow checks, and makes ahead-of-time translation (for example to native or RISC-V code for zkVMs) safe. The spec reports large speed-ups from experimental translators.
  • Every client must implement the consensus-critical validator. The spec offers an executable reference implementation and shared test vectors to reduce divergence risk.
  • Earlier attempts at static control flow include EIP-615 and EOF (EIP-3540), both stagnant.

#evm #bytecode #validation #control-flow #core

Details

Authors
Greg Colvin (@gcolvin) <[email protected]>, Martin Holst Swende (@holiman), Brooklyn Zelenka (@expede), John Max Skaller
Status
Draft
Type
Standards Track / Core
Created
2026-07-09
Requires

Machine-readable: Markdown · JSON