EIP-7960 · Draft · Core · 2025-05-28
EIP-7960: EOF - Extended types section
Adds a per-code-section type byte to the EOF container, so one contract could mix normal EVM code with other execution modes such as EVM64, and bumps the EOF version to 0x02.
What problem does it solve?
The EVM Object Format (EOF, EIP-3540) splits contract bytecode into a structured container with separate code sections, each described by an entry in a types_section (inputs, outputs, maximum stack growth). Every code section is assumed to be ordinary EVM code.
Some proposals want parts of a contract to run under a different interpreter. The motivating example is EVM64, a variant with 64-bit arithmetic that is faster for heavy computation but cannot work directly with addresses and balances. Later, the same hook could allow other code types such as RISC-V. EIP-7960 adds a field so the interpreter knows how to run each section.
How it works
Each types_section entry changes from
(inputs: uint8, outputs: uint8, max_stack_increase: uint16) // 32 bits
to
(type: uint8, reserved: 24 bits, inputs: uint8, outputs: uint8, max_stack_increase: uint16) // 64 bits
type = 0x01is the only type defined here. Other EIPs may define more.reservedkeeps the entry aligned to 64 bits and must be all zeros.- The EOF container
versionbecomes0x02; version0x01is now invalid.
New validation rules: an unknown type fails validation, and a non-zero reserved field fails validation.
The intended pattern is that a contract keeps its state-handling logic (storage, balances, calls) in normal EVM sections and moves number-crunching into sections of a faster type, switching between them with ordinary EOF function calls.
Sample code
Encoding one types_section entry under this EIP (Python):
import struct
def encode_type_entry(code_type: int, inputs: int, outputs: int, max_stack_increase: int) -> bytes:
assert code_type == 0x01, "only type 0x01 is defined by EIP-7960"
reserved = b"\x00\x00\x00"
return (
bytes([code_type]) + reserved
+ struct.pack(">BBH", inputs, outputs, max_stack_increase)
)
entry = encode_type_entry(0x01, inputs=0, outputs=0x80, max_stack_increase=2)
print(entry.hex()) # 0100000000800002 -> 8 bytes per entry
(outputs = 0x80 marks a non-returning section in EOF.)
Things to know
- Status: Draft. Test cases, reference implementation and security analysis are all still "to be added".
- EOF itself is not live on Ethereum mainnet: it was removed from the Fusaka upgrade, and the core EOF specs (EIP-3540, EIP-7692) are Stagnant. This EIP only matters if EOF returns.
- The version bump to
0x02is to avoid clashing with any third-party chain that may already have deployed EOF version 1. - Code written in a non-EVM section type, such as EVM64, would not be able to access addresses and balances directly; that work stays in type
0x01sections.