EIP-7921 · Stagnant · Core · 2025-03-26
EIP-7921: Skip `JUMPDEST` immediate argument check
Proposes that every 0x5b byte in code be a valid JUMPDEST, even inside PUSH data, removing the jump-destination analysis pass so the EVM can add new opcodes with immediate arguments.
What problem does it solve?
Today JUMP and JUMPI may only land on a JUMPDEST (0x5b) byte that is a real instruction. A 0x5b byte that happens to sit inside the data of a PUSH1..PUSH32 does not count. To enforce that, clients must scan the whole code to work out which bytes are immediate data before running it.
The spec lists three problems with this:
- That pre-scan grows linearly with code size, a DoS vector that limits contract size.
- New opcodes that carry immediate arguments cannot be added safely, because they would change which existing bytes count as valid jump destinations.
- Data embedded in code (read via
CODECOPY) can "swallow" laterJUMPDESTs.
Since almost all jumps go to constant targets, the author argues the safety check costs more than it protects.
How it works
One rule change: after activation, any 0x5b byte is a valid destination for JUMP and JUMPI, regardless of whether it is inside an immediate argument. No analysis pass is needed; a jump just checks the byte at the target.
# today
def valid_jump(code, dest):
return dest < len(code) and code[dest] == 0x5B and dest in jumpdest_analysis(code)
# EIP-7921
def valid_jump(code, dest):
return dest < len(code) and code[dest] == 0x5B
Sample code
Bytecode showing the difference. PUSH1 0x5b places 0x5b at offset 1 as data:
offset bytes instruction
0x00 60 5b PUSH1 0x5b ; byte at 0x01 is 0x5b (data)
0x02 60 01 PUSH1 0x01
0x04 56 JUMP ; jump to 0x01
Today the JUMP to 0x01 fails (invalid jump destination). Under EIP-7921 it succeeds: the data byte is executed as a JUMPDEST, and the bytes after it are decoded as instructions (here looping back until gas runs out).
Things to know
- Status: Stagnant. It has not been scheduled for any upgrade.
- Disassembly becomes ambiguous: code can have several valid interpretations depending on where execution enters. The spec recommends disassemblers show all of them so hidden paths are visible.
- Existing contracts that use dynamic jumps could gain unintended code paths if an attacker can steer a jump into PUSH data containing
0x5b. The author expects few contracts to be affected (most compilers do not emit attacker-controlled jump targets) and calls for a public static-analysis scan of deployed contracts. - Other approaches to the same immediate-argument problem include EIP-8024 (backward-compatible
DUPN/SWAPN/EXCHANGE) and the EOF line of proposals such as EIP-3540 and EIP-4200, which validate code at deploy time instead.