---
eip: 8173
label: EIP-8173
title: Foundations of EVM Control Flow
status: Review
type: Informational
created: 2026-02-16
official: https://eips.ethereum.org/EIPS/eip-8173
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-8173.md
canonical: https://eips.huatuo.xyz/eip-8173/
lang: en
tldr: "An informational essay explaining why the EVM's dynamic jumps and lack of native calls/returns make code analysis, compilation and ZK proving expensive, as background for proposals that add static control flow."
tags: [evm, control-flow, informational, zk, compilers]
---

# EIP-8173: Foundations of EVM Control Flow

> Understanding EVM control flow and its relation to Ethereum's scaling roadmap

**TL;DR:** An informational essay explaining why the EVM's dynamic jumps and lack of native calls/returns make code analysis, compilation and ZK proving expensive, as background for proposals that add static control flow.

## What problem does it solve?

The EVM has no instructions for calling and returning from a function *inside* a contract (`CALL` goes to another contract) and does not validate code at deployment. Compilers therefore fake internal calls: they push a return address as ordinary data and later `JUMP` to it. Every internal function call in a deployed contract is a dynamic jump whose target is just a stack value.

Most comparable VMs (the JVM, .NET's CLR, WebAssembly) and most smart-contract VMs require validated, static control flow with native calls and returns. EIP-8173 makes no protocol change itself; it documents why this difference matters, to serve as shared background for current and future proposals.

## How it works

The document's argument, in short:

- **Control-flow graphs.** Tools that validate, compile, decompile or formally verify code first need to know where every jump can go. With static jumps, the graph has one edge per jump: linear work.
- **Dynamic jumps blow this up.** If a jump's target comes from the stack, any jump might reach any `JUMPDEST`. Edges grow as O(N²), and following every possible path grows factorially. The author's example: 10 tiny blocks (29 bytes of code) yield 90 edges and 986,410 distinct walks.
- **Online cost = DoS risk.** Anything super-linear that a node must run on untrusted code (validation at deploy, ahead-of-time or JIT compilation) can be abused for denial of service.
- **Scaling roadmap.** zkVMs today mostly prove an EVM *interpreter* compiled to RISC-V. Code with static control flow could instead be compiled to RISC-V once, in linear time, removing interpreter overhead. It also allows linear-time validation at deployment and simpler tooling for optimistic-rollup fraud proofs.
- **History.** The essay traces calls and returns from Babbage, Lovelace and Turing's ACE through hardware and VMs, noting that sealed-off return stacks (as in Forth, the JVM and Wasm) are the model the EVM proposals follow.

The "Specification" section just notes that several EIPs propose static control flow (subroutines and static jumps, EOF functions, static relative jumps, call/return opcodes), all built on a separate return stack, and that the simplest, three call-and-return opcodes, can implement the others.

## Sample code

Why a synthesized return is a dynamic jump (EVM assembly, illustrative):

```
; caller: "call" double(x) and come back to RET_HERE
PUSH2 RET_HERE     ; return address pushed as plain data
PUSH1 0x05         ; argument x
PUSH2 DOUBLE
JUMP               ; static: target is a constant
RET_HERE:
JUMPDEST
STOP

DOUBLE:
JUMPDEST           ; stack: [ret, x]
DUP1
ADD                ; stack: [ret, 2x]
SWAP1
JUMP               ; dynamic: target popped from the stack
```

An analyser cannot know from `DOUBLE` alone where its final `JUMP` lands; if two callers share `DOUBLE`, it must explore both, and the paths multiply with every shared routine. With explicit call/return opcodes, the return always goes back to its call.

## Things to know

- Status: **Review**, type **Informational**. It specifies no protocol change and has no direct security impact.
- It is the motivation document for static-control-flow work such as [EIP-7979](/eip-7979/) (call and return opcodes). Earlier attempts include [EIP-615](/eip-615/) (Stagnant), [EIP-2315](/eip-2315/) (Withdrawn), and the EOF proposals [EIP-4750](/eip-4750/) and [EIP-4200](/eip-4200/) (Stagnant).
- ZK provers work from an actual execution trace, so they never enumerate paths; the benefit there comes from compiling instead of interpreting and from leaner bytecode, not from avoiding path explosion.
- The 256-bit word size is a separate obstacle to efficient RISC-V compilation, mentioned but not addressed here.


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-8173
