EIP-7921 Skipping JUMPDEST checks on immediate arguments (Skip `JUMPDEST` immediate argument check)
No call decision · EVM & execution · EIP status Stagnant · created 2025-03-26
Allows JUMP and JUMPI to jump to a byte even if it lies within an immediate argument, as long as its value is 0x5b (JUMPDEST). The pre-analysis check that currently verifies whether a jump destination is valid is removed.
Why it is needed
In the EVM, jump instructions (JUMP, JUMPI) cannot move to an arbitrary location; they can only move to a byte marked with JUMPDEST (0x5b). However, not every 0x5b byte in the code is a genuine JUMPDEST. Instructions like PUSH1 use the byte immediately following them as an immediate argument, a parameter written directly in the code rather than on the stack, and that value can happen to be 0x5b. So currently the entire code must be scanned in advance to identify which bytes are immediate arguments before jump validity can be determined. The source cites three problems with this approach. First, because the code must be preprocessed, the burden grows linearly with code size, creating a denial-of-service (DoS) attack vector. Second, it is difficult to safely introduce new instructions that use immediate arguments. Third, a CODECOPY data region can invalidate a JUMPDEST that follows it. The intent of this check is to prevent unintended code execution, but the proposer's judgment is that in practice almost all jumps go to fixed destinations, so the cost of the check outweighs its benefit.
What changes
Today
- Clients must preprocess the entire code to identify immediate arguments before determining JUMPDEST validity
- Code size becomes a linear DoS attack vector due to the preprocessing burden
- It is difficult to safely introduce new instructions that use immediate arguments
- A CODECOPY data region can invalidate a JUMPDEST that follows it
After EIP-7921
- Any byte with value 0x5b becomes a valid jump destination, even if it lies within an immediate argument
- Code preprocessing for JUMPDEST validity is no longer needed
- New instructions using immediate arguments and larger programs become possible
- Disassembly interpretation of code can branch into multiple possibilities
Who is affected
- Client teams: The code preprocessing logic for determining JUMPDEST validity can be removed from implementations.
- Existing contracts: Some contracts that use dynamic jumps may gain a new unintended path to jump to a 0x5b inside an immediate argument. The source expects very few such contracts to exist.
- Security and analysis tool developers: Since disassembly interpretation can become ambiguous, it is recommended that output show all possible interpretations, and the development of static analysis tools to check for vulnerability is proposed.
- Compiler and language teams: Opens the door to adopting new instructions that use immediate arguments and to writing larger programs.
In depth
Specification: every 0x5b byte is a valid JUMPDEST
From activation onward, every 0x5b byte in the code is a valid JUMPDEST for the JUMP and JUMPI instructions. The specification is just this one sentence, and it no longer matters whether that byte is an immediate argument of another instruction. This effectively removes from the spec the code analysis previously performed to determine JUMPDEST validity.
Three reasons for removing the check
An immediate argument is an instruction parameter written in the code rather than on the stack. Currently, JUMPDEST validity cannot be known until it is determined which bytes are immediate arguments to instructions like PUSH1, and this creates three problems. First, because the code must be preprocessed, code size becomes a linear DoS vector. Second, new opcodes that use immediate arguments cannot be safely adopted. Third, a CODECOPY data region can invalidate a JUMPDEST that follows it. The rationale for this check is preventing unintended code execution, but the source argues that since almost all JUMP and JUMPI instructions jump to constant destinations, the cost of the check outweighs its benefit. Removing the check enables larger programs and better opcodes and reduces EVM complexity.
Backwards compatibility: disassembly interpretation can branch
Until now, code has had only one disassembly interpretation. After this change, since it becomes possible to jump to a JUMPDEST inside an immediate argument, the same byte sequence can have multiple interpretations. Interpretations usually reconverge to one after a few bytes, but there is no upper bound on how long the divergent section can be. CODECOPY data was already hard to distinguish from code. The source recommends that disassemblers print every possible interpretation so that underhanded functionality can be exposed.
Security: a new path for dynamic-jump contracts
Existing contracts that use dynamic jumps, computing the destination at runtime, may gain unintended new functionality once jumping to a JUMPDEST inside an immediate argument becomes possible. However, the source expects very few contracts to become vulnerable this way. Most smart contract languages do not allow dynamic jumps at all, and even among languages that do, it is rare for an accessible immediate argument to contain a JUMPDEST, and many of the newly opened code paths would fail by hitting an invalid opcode. The source proposes publicly developing static analysis tools to check whether a contract could become vulnerable, auditing all existing contracts, notifying affected projects, and notes that affected programs would have a sufficient transition period.
Proposal status: Stagnant
This EIP was created on March 26, 2025, and its current status is Stagnant. This means activity on the proposal has halted, and its content may change if it is adopted as is or if discussion resumes. No core developer call decision on fork inclusion has been confirmed.