EIP-7957 · Stagnant · Core · 2025-05-26
EIP-7957: EVM64 - EOF support
Defines how the proposed 64-bit EVM mode (EVM64) fits into EOF code validation, and adds 64-bit variants of the RJUMPI and RJUMPV relative jumps.
What problem does it solve?
EIP-7937 proposes "EVM64": a prefix byte 0xC0 that switches the following opcode into a 64-bit mode, so arithmetic that does not need 256-bit words can run faster and cheaper. That makes some instructions two bytes long.
The EVM Object Format (EOF, EIP-3540 and related EIPs, gathered in EIP-7692) validates bytecode once at deploy time, rejecting undefined opcodes and malformed jumps. A two-byte "mode + opcode" sequence needs its own validation rule, and EOF's static relative jumps (EIP-4200) need 64-bit counterparts. EIP-7957 supplies both.
How it works
Code validation (an extension of EIP-3670). At EOF contract creation, whenever 0xC0 appears outside PUSH data:
- there must be a next opcode, and
- it must be
RJUMPI64,RJUMPV64, or one of the core 64-bit opcodes from EIP-7937, excludingJUMP64andJUMPI64(EOF does not have dynamic jumps).
New 64-bit relative jumps:
| Opcode | Bytes | Behaviour | Gas |
|---|---|---|---|
RJUMPI64 |
0xC0 0xE1 |
Like RJUMPI, but only the low 64 bits of the condition are read |
3 |
RJUMPV64 |
0xC0 0xE2 |
Like RJUMPV, but only the low 64 bits of the case index are read |
3 |
Plain RJUMP needs no 64-bit variant because it does not touch the stack.
Sample code
Illustrative EOF code-section bytes using the 64-bit conditional jump (offsets are relative, as in EIP-4200):
5f PUSH0 ; condition = 0
c0 e1 0003 RJUMPI64 +3 ; jump if low 64 bits of condition != 0
... (fall-through code)
Validation rule as pseudocode:
def validate_c0(code, i, evm64_core_ops):
# i points at a 0xC0 byte that is not inside PUSH data
if i + 1 >= len(code):
raise InvalidCode("C0 must be followed by an opcode")
nxt = code[i + 1]
allowed = {0xE1, 0xE2} | (evm64_core_ops - {JUMP64, JUMPI64})
if nxt not in allowed:
raise InvalidCode("invalid opcode after C0")
Things to know
- Status: Stagnant. Test cases, a reference implementation and security analysis were never added ("to be added" / "needs discussion" in the spec).
- It depends on two proposals that are themselves not live: EVM64 (EIP-7937, Draft) and EOF (EIP-7692, Stagnant). EOF was not included in a mainnet upgrade, so this EIP has no practical effect today.
- Opcode numbers above follow the spec's notation (
0xc0e1,0xc0e2) and depend on EIP-7937's prefix design, which could change.