EIP-7957 EOF support for EVM64 (EVM64 - EOF support)
No call decision · EVM & execution · EIP status Stagnant · created 2025-05-26
Extends EVM64, the 64-bit mode instruction set, to fit EOF's (EVM Object Format) code validation rules, and newly defines the 64-bit conditional jump instructions RJUMPI64 and RJUMPV64.
Why it is needed
EVM64 (EIP-7937) is a proposal that allows frequently used computations to be processed in 64-bit units, using a mode opcode C0 prefixed to existing instructions. In other words, C0 together with the byte that follows it forms a single instruction. Meanwhile, EOF (EVM Object Format) is a format that defines stricter rules for pre-checking the entire code at contract deployment time to ensure no invalid instructions are mixed in, and this check exists to improve efficiency. Existing EOF validation assumes single-byte instructions, which creates a problem because EVM64's C0 is a multi-byte instruction. This requires a small adaptation to check what may follow C0. This EIP defines that validation rule, and also defines 64-bit versions of the conditional jump instructions RJUMPI and RJUMPV used in EOF.
What changes
Today
- EOF's code validation rules assume single-byte instructions, so there is no standard for checking EVM64's multi-byte instructions (C0-prefixed)
- EOF's conditional jump instructions RJUMPI and RJUMPV have no 64-bit mode defined
After EIP-7957
- When C0 appears during EOF contract creation, it is validated that the next opcode exists and is an allowed 64-bit instruction
- RJUMPI64 (0xc0e1) and RJUMPV64 (0xc0e2) are defined, and both have a gas cost of G_RJUMPIV64 (3)
- RJUMP neither reads nor writes the stack, so it automatically operates in 64-bit mode
Who is affected
- Client teams: The code validator at EOF contract creation time must add handling for the C0 multi-byte opcode and the execution logic for RJUMPI64 and RJUMPV64.
- Compiler and tooling developers: Since 64-bit mode instructions and 64-bit conditional jumps can now be generated within EOF code, code generation and validation logic must be aligned accordingly.
- Smart contract developers: EVM64's 64-bit operations and jumps become usable in EOF-format contracts as well. If you do not handle bytecode directly, the compiler takes care of it for you.
In depth
Gas constant G_RJUMPIV64
This EIP defines the gas constant G_RJUMPIV64 = 3. Both newly defined jump instructions, RJUMPI64 and RJUMPV64, use this cost.
C0 validation rule at EOF creation
A rule is added to the code validation performed at EOF contract creation time as defined by EIP-3670. If the opcode C0 appears and it is not PUSH-opcode data, the interpreter must verify two things. First, the next opcode must exist. Second, that next opcode must be RJUMPI64, RJUMPV64, or one of the core 64-bit opcodes defined by EIP-7937 excluding JUMP64 and JUMPI64. The fact that the dynamic jumps JUMP64 and JUMPI64 are excluded from the allowlist is what differs from legacy EVM64.
RJUMPI64 (0xc0e1) and RJUMPV64 (0xc0e2)
64-bit modes of the flow-control instructions RJUMPI and RJUMPV are defined. RJUMPI64 (0xc0e1) reads only the last 64 bits of the condition value popped from the stack. RJUMPV64 (0xc0e2) reads only the last 64 bits of the case value popped from the stack. Both instructions have a gas cost of G_RJUMPIV64 (3).
RJUMP has no separate 64-bit version
Because RJUMP neither reads nor writes the stack, it is automatically covered by 64-bit mode. Since the jump distance is encoded directly in the code, stack value width has no effect, so there is no need to define a separate RJUMP64.
Dependencies
This EIP assumes EIP-3540 (EOF container), EIP-3670 (EOF code validation), EIP-4200 (static relative jumps RJUMP, RJUMPI, RJUMPV), and EIP-7937 (core EVM64 definition). It directs readers to EIP-7937, the core EVM64 definition, for detailed discussion of design rationale. It states that no backwards compatibility issues have been identified.
Incomplete items and document status
Test cases and the reference implementation are marked as To be added, and security considerations are marked only as Needs discussion. This EIP's current status is also Stagnant, meaning the document has stalled. Its content may change or may not proceed as written.