EIP-8173 The foundations of EVM control flow (Foundations of EVM Control Flow)
No call decision · EVM & execution · EIP status Review · created 2026-02-16
An informational document that lays out how expensive the EVM's dynamic jumps make code analysis, compilation, and ZK proving, and provides background for proposals on static control flow. It does not change the protocol directly.
Why it is needed
The EVM has no instruction for calling and returning from a function within a single contract. So compilers emulate calls by pushing the return address onto the stack like ordinary data and using a dynamic jump (dynamic jump) whose destination is only determined at execution time. Unlike most comparable virtual machines such as the JVM, CLR, and Wasm, which require verified static control flow, the EVM is an exception in that it does not verify deployed code. Tools that need to know what code does cannot tell in advance where a jump will go, so they must follow every possibility, and the cost of doing so grows with the square of code size while the number of paths grows factorially. In the source document's example, a 29-byte piece of code requires about 980,000 steps to walk. This poses a denial-of-service risk to online verification and compilation, a burden on formal analysis, and an obstacle to the scaling roadmap's ZK proving and RISC-V transition. This document lays out that history and cost as background material for proposals on static control flow.
What changes
Today
- Internal function calls within a contract are emulated with dynamic jumps, and there is no verification of deployed code
- Because jump destinations cannot be known in advance, the cost for analysis tools grows with the square of code size, and path search grows factorially
- A zkVM runs the EVM as an interpreter, so interpreter overhead is incurred for every instruction executed
After EIP-8173
- If a static control flow proposal is adopted, the destinations of jumps and calls are fixed before execution
- Code can be verified once in linear time at deployment and compiled to machine code
- This opens up the strategy of compiling EVM code directly to RISC-V code, eliminating interpreter overhead
Who is affected
- Client teams: If static control flow is introduced, deployment-time verification and linear-time compilation become possible, which benefits execution speed for non-ZK clients.
- ZK rollups: The bytecode to be proven becomes smaller and simpler and interpreter overhead disappears, speeding up proof generation and lowering hardware requirements.
- Developers of security auditing and analysis tools: Today, reconstructing a control flow graph is itself a hard problem, but with static control flow, linear-time analysis that traverses each edge only once becomes possible.
- Language and compiler developers: Explicit call and return instructions can be used instead of synthesizing the return address as stack data.
In depth
The EVM's lack of internal calls and synthesized jumps
The EVM has no call and return instructions for use within a single contract. The CALL family are instructions for calling a different contract. So the compiler synthesizes internal calls by pushing the return address onto the stack as ordinary data and, once the routine finishes, jumping to that address with a dynamic JUMP. Every internal function call in every deployed contract is a dynamic jump, and its destination is data. A tool that needs to know where a return goes must walk the code via symbolic execution. A synthesized return at least has compiler labels as candidates, but all of them must be walked, and the step count doubles for every shared routine, producing a path explosion where 20 calls means a million steps. A computed destination does not even have candidates. With explicit calls and returns, a return always goes back to the call site, so it is one step, one answer.
Edges grow quadratically, steps grow factorially
A control flow graph (CFG) has code blocks as nodes and jumps and fallthroughs as edges. A chain with only static jumps has an edge count equal to the number of jumps, O(N), and walking it takes a single step regardless of length. By contrast, in a program with dynamic jumps that use a value raised by gas as the destination, every JUMP can potentially reach every JUMPDEST, so edges grow to O(N²), and the number of walks needed to cover every path is ⌊e·(N−1)!⌋, which is O(N!). Per the source document's table, for 10 blocks and 29 bytes, there are 90 edges and 986,410 steps. Whether or not the graph is actually drawn, any tool that must reason about where a jump can go pays this cost. In the JVM, Wasm, and CLR, such a program is not even possible.
DoS risk in online analysis and an open problem in academia
Any analysis beyond linear time becomes a denial-of-service vulnerability when run online. Quadratic-cost graph traversal is just as much a problem as factorial-cost path walking. Bytecode verification, AOT compilation at contract-creation time, and JIT compilation at execution time are all tasks that must run online. Even offline, the absence of dynamic jumps and internal calls makes static analysis of many contracts quadratically impractical, exponentially intractable, or mathematically impossible. The source document cites recent papers arguing that interpreting EVM jumps is a core difficulty in static analysis, and notes that even research using neural networks only manages to disassemble most Solidity programs. In other words, there exists an entire body of complex and incomplete academic literature addressing a problem that would be trivial under static control flow.
80 years of industry practice: from Turing's ACE to Wasm
The concept of call and return originates with Turing's 1946 ACE design and has proven its value for 80 years. Forth and ACE use a separate return stack isolated from data, and the EVM proposals covered in this document follow the same design. The JVM, CLR, and Wasm all prevent bytecode from touching return addresses and share three common properties: directly interpretable portable bytecode, static control flow verified before execution, and linear-time runtime compilation to machine code. Most of the smart contract world also has native calls. NEAR, Polkadot, Cosmos, and Stellar run Wasm, Solana runs an eBPF-family VM, Aptos and Sui run Move, Starknet runs Cairo, and the latest zkVMs run RISC-V. Algorand's TEAL and eBPF started out with jumps alone but added subroutines once verifiers and analyzers hit their limits. Today, only the EVM, as deployed, remains stuck with unverified code, synthesized calls, and dynamic jumps.
Benefits for ZK rollups and optimistic rollups
A ZK prover works from an actual execution trace, so it does not search paths. The jump destination is already recorded by the time it is executed. So the benefit lies not in path search but in the efficiency of the code being proven and the tractability of surrounding analysis. First, today's zkVMs run an EVM interpreter compiled to RISC-V, but statically-controlled-flow code could be compiled to RISC-V once in linear time, eliminating per-step interpreter overhead. Second, stack discipline that removes static jumps, explicit subroutine calls, and SWAP/DUP workarounds produces smaller, simpler bytecode, reducing the number of instructions to be proven. Third, stack underflow, static stack depth, and reachability can all be verified once in linear time at deployment. These improvements follow through to faster proof generation and lower hardware requirements. For optimistic rollups, deployment-time verification also secures a safety property that dispute resolution can rely on, simplifying the implementation of bisection-style interactive verification games.
The transition to RISC-V and the puzzle that remains
Discussion is underway in the Ethereum research community about replacing the EVM with a RISC-V execution environment. One current zkEVM strategy is to compile an EVM interpreter such as revm to RISC-V and run it inside a zkVM. With static control flow, a strategy opens up to compile EVM code itself directly to RISC-V code: a single linear pass yields decent code, and multiple passes yield better code, while the whole process remains linear time. The puzzle that remains is that RISC-V is a 32-bit or 64-bit architecture while the EVM today is 256-bit. There are proposals for 64-bit EVM instructions to address this, and a new proving system that charges only for the bits actually used could, over time, ease the width problem. For now, though, today's zkVMs charge the full 256-bit cost for every instruction executed, regardless of how many bits the value actually uses.
Status as an informational document and Review status
This EIP is of Informational type and does not directly specify a protocol change, so it has no direct security implications. The Specification section introduces past and present EIPs that specify subroutines and static jumps, container format functions, call/return instructions, and static relative jumps and calls. These are all implemented with a standard turing return stack structure and are largely compatible with each other, and the simplest form, the three call/return instructions, can implement everything else. The document status is Review, so the content may still change, and there is no fork inclusion decision for this document in the call records.