{"eip":7957,"title":"EVM64 - EOF support","description":"EVM Object Format support for EVM64","authors":["Wei Tang (@sorpaas)"],"status":"Stagnant","type":"Standards Track","category":"Core","created":"2025-05-26","requires":[3540,3670,4200,7937],"discussionsTo":"https://ethereum-magicians.org/t/eip-7937-64-bit-mode-evm-opcodes-evm64/23794","repo":"EIPs","label":"EIP-7957","officialUrl":"https://eips.ethereum.org/EIPS/eip-7957","sourceUrl":"https://github.com/ethereum/EIPs/blob/master/EIPS/eip-7957.md","url":"https://eips.huatuo.xyz/eip-7957/","tldr":{"en":"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.","ja":"提案されている 64 ビット EVM モード（EVM64）が EOF のコード検証にどう組み込まれるかを定義し、相対ジャンプ RJUMPI と RJUMPV の 64 ビット版を追加する。","ko":"제안된 64비트 EVM 모드(EVM64)가 EOF 코드 검증에 어떻게 들어맞는지 정의하고, 상대 점프 RJUMPI와 RJUMPV의 64비트 변형을 추가한다.","zh":"定义提议中的 64 位 EVM 模式（EVM64）如何纳入 EOF 代码验证，并增加相对跳转 RJUMPI 和 RJUMPV 的 64 位变体。"},"tags":["evm","eof","evm64","opcodes","core"],"explainers":{"en":{"lang":"en","tldr":"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.","tags":["evm","eof","evm64","opcodes","core"],"related":[7937,3540,3670,4200,7692],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-7957/","markdown":"## What problem does it solve?\n\n[EIP-7937](/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.\n\nThe EVM Object Format (EOF, [EIP-3540](/eip-3540/) and related EIPs, gathered in [EIP-7692](/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](/eip-4200/)) need 64-bit counterparts. EIP-7957 supplies both.\n\n## How it works\n\n**Code validation** (an extension of [EIP-3670](/eip-3670/)). At EOF contract creation, whenever `0xC0` appears outside PUSH data:\n\n- there must be a next opcode, and\n- it must be `RJUMPI64`, `RJUMPV64`, or one of the core 64-bit opcodes from EIP-7937, excluding `JUMP64` and `JUMPI64` (EOF does not have dynamic jumps).\n\n**New 64-bit relative jumps:**\n\n| Opcode | Bytes | Behaviour | Gas |\n| --- | --- | --- | --- |\n| `RJUMPI64` | `0xC0 0xE1` | Like `RJUMPI`, but only the low 64 bits of the condition are read | 3 |\n| `RJUMPV64` | `0xC0 0xE2` | Like `RJUMPV`, but only the low 64 bits of the case index are read | 3 |\n\nPlain `RJUMP` needs no 64-bit variant because it does not touch the stack.\n\n## Sample code\n\nIllustrative EOF code-section bytes using the 64-bit conditional jump (offsets are relative, as in EIP-4200):\n\n```text\n5f            PUSH0                ; condition = 0\nc0 e1 0003    RJUMPI64 +3          ; jump if low 64 bits of condition != 0\n...           (fall-through code)\n```\n\nValidation rule as pseudocode:\n\n```python\ndef validate_c0(code, i, evm64_core_ops):\n    # i points at a 0xC0 byte that is not inside PUSH data\n    if i + 1 \u003e= len(code):\n        raise InvalidCode(\"C0 must be followed by an opcode\")\n    nxt = code[i + 1]\n    allowed = {0xE1, 0xE2} | (evm64_core_ops - {JUMP64, JUMPI64})\n    if nxt not in allowed:\n        raise InvalidCode(\"invalid opcode after C0\")\n```\n\n## Things to know\n\n- **Status: Stagnant.** Test cases, a reference implementation and security analysis were never added (\"to be added\" / \"needs discussion\" in the spec).\n- It depends on two proposals that are themselves not live: EVM64 ([EIP-7937](/eip-7937/), Draft) and EOF ([EIP-7692](/eip-7692/), Stagnant). EOF was not included in a mainnet upgrade, so this EIP has no practical effect today.\n- Opcode numbers above follow the spec's notation (`0xc0e1`, `0xc0e2`) and depend on EIP-7937's prefix design, which could change.\n"},"ja":{"lang":"ja","tldr":"提案されている 64 ビット EVM モード（EVM64）が EOF のコード検証にどう組み込まれるかを定義し、相対ジャンプ RJUMPI と RJUMPV の 64 ビット版を追加する。","tags":["evm","eof","evm64","opcodes","core"],"related":[7937,3540,3670,4200,7692],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-7957/","markdown":"## 何を解決するのか\n\n[EIP-7937](/eip-7937/) は「EVM64」を提案しています。プレフィックスバイト `0xC0` が、続くオペコードを 64 ビットモードに切り替えることで、256 ビットのワードが不要な算術をより高速かつ安価に実行できます。その結果、一部の命令は 2 バイト長になります。\n\nEVM Object Format（EOF、[EIP-3540](/eip-3540/) と関連する EIP を [EIP-7692](/eip-7692/) にまとめたもの）は、デプロイ時にバイトコードを一度だけ検証し、未定義のオペコードや不正なジャンプを拒否します。2 バイトの「モード + オペコード」の並びには独自の検証ルールが必要で、EOF の静的な相対ジャンプ（[EIP-4200](/eip-4200/)）にも 64 ビット版が必要です。EIP-7957 はその両方を提供します。\n\n## 仕組み\n\n**コード検証**（[EIP-3670](/eip-3670/) の拡張）。EOF コントラクトの作成時に、PUSH データの外側に `0xC0` が現れるたびに、次が求められます。\n\n- 次のオペコードが存在すること。\n- それが `RJUMPI64`、`RJUMPV64`、または EIP-7937 のコアな 64 ビットオペコードのいずれかであること。ただし `JUMP64` と `JUMPI64` は除きます（EOF には動的ジャンプがないため）。\n\n**新しい 64 ビットの相対ジャンプ:**\n\n| オペコード | バイト | 挙動 | ガス |\n| --- | --- | --- | --- |\n| `RJUMPI64` | `0xC0 0xE1` | `RJUMPI` と同様だが、条件の下位 64 ビットだけを読む | 3 |\n| `RJUMPV64` | `0xC0 0xE2` | `RJUMPV` と同様だが、case インデックスの下位 64 ビットだけを読む | 3 |\n\n素の `RJUMP` はスタックに触れないため、64 ビット版は不要です。\n\n## サンプルコード\n\n64 ビットの条件付きジャンプを使う EOF コードセクションのバイト列の例（オフセットは EIP-4200 と同様に相対）:\n\n```text\n5f            PUSH0                ; condition = 0\nc0 e1 0003    RJUMPI64 +3          ; jump if low 64 bits of condition != 0\n...           (fall-through code)\n```\n\n擬似コードで示した検証ルール:\n\n```python\ndef validate_c0(code, i, evm64_core_ops):\n    # i points at a 0xC0 byte that is not inside PUSH data\n    if i + 1 \u003e= len(code):\n        raise InvalidCode(\"C0 must be followed by an opcode\")\n    nxt = code[i + 1]\n    allowed = {0xE1, 0xE2} | (evm64_core_ops - {JUMP64, JUMPI64})\n    if nxt not in allowed:\n        raise InvalidCode(\"invalid opcode after C0\")\n```\n\n## 知っておくべきこと\n\n- **ステータス: Stagnant。** テストケース、リファレンス実装、セキュリティ分析は追加されませんでした（仕様では「to be added」「needs discussion」）。\n- 自身も有効になっていない 2 つの提案に依存しています。EVM64（[EIP-7937](/eip-7937/)、Draft）と EOF（[EIP-7692](/eip-7692/)、Stagnant）です。EOF はメインネットのアップグレードに含まれなかったため、この EIP は現時点で実質的な効果がありません。\n- 上記のオペコード番号は仕様の表記（`0xc0e1`、`0xc0e2`）に従っており、変更されうる EIP-7937 のプレフィックス設計に依存します。\n"},"ko":{"lang":"ko","tldr":"제안된 64비트 EVM 모드(EVM64)가 EOF 코드 검증에 어떻게 들어맞는지 정의하고, 상대 점프 RJUMPI와 RJUMPV의 64비트 변형을 추가한다.","tags":["evm","eof","evm64","opcodes","core"],"related":[7937,3540,3670,4200,7692],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-7957/","markdown":"## 어떤 문제를 해결하나요?\n\n[EIP-7937](/eip-7937/)은 \"EVM64\"를 제안합니다. 프리픽스 바이트 `0xC0`이 뒤따르는 오퍼코드를 64비트 모드로 전환하여, 256비트 워드가 필요 없는 산술이 더 빠르고 싸게 실행될 수 있게 합니다. 그 결과 일부 명령어는 2바이트 길이가 됩니다.\n\nEVM Object Format(EOF, [EIP-3540](/eip-3540/) 및 관련 EIP를 [EIP-7692](/eip-7692/)로 모은 것)은 배포 시점에 바이트코드를 한 번 검증하여 정의되지 않은 오퍼코드와 잘못된 점프를 거부합니다. 2바이트짜리 \"모드 + 오퍼코드\" 시퀀스에는 자체 검증 규칙이 필요하고, EOF의 정적 상대 점프([EIP-4200](/eip-4200/))에도 64비트 대응 명령어가 필요합니다. EIP-7957은 둘 다 제공합니다.\n\n## 어떻게 동작하나요?\n\n**코드 검증**([EIP-3670](/eip-3670/)의 확장). EOF 컨트랙트 생성 시 PUSH 데이터 바깥에 `0xC0`이 나타날 때마다 다음이 요구됩니다.\n\n- 다음 오퍼코드가 있어야 하고,\n- 그것은 `RJUMPI64`, `RJUMPV64`, 또는 EIP-7937의 핵심 64비트 오퍼코드 중 하나여야 하며, `JUMP64`와 `JUMPI64`는 제외됩니다(EOF에는 동적 점프가 없기 때문).\n\n**새로운 64비트 상대 점프:**\n\n| 오퍼코드 | 바이트 | 동작 | 가스 |\n| --- | --- | --- | --- |\n| `RJUMPI64` | `0xC0 0xE1` | `RJUMPI`와 같지만 조건의 하위 64비트만 읽음 | 3 |\n| `RJUMPV64` | `0xC0 0xE2` | `RJUMPV`와 같지만 case 인덱스의 하위 64비트만 읽음 | 3 |\n\n일반 `RJUMP`는 스택을 건드리지 않으므로 64비트 변형이 필요 없습니다.\n\n## 샘플 코드\n\n64비트 조건 점프를 사용하는 EOF 코드 섹션 바이트의 예(오프셋은 EIP-4200처럼 상대값):\n\n```text\n5f            PUSH0                ; condition = 0\nc0 e1 0003    RJUMPI64 +3          ; jump if low 64 bits of condition != 0\n...           (fall-through code)\n```\n\n의사 코드로 나타낸 검증 규칙:\n\n```python\ndef validate_c0(code, i, evm64_core_ops):\n    # i points at a 0xC0 byte that is not inside PUSH data\n    if i + 1 \u003e= len(code):\n        raise InvalidCode(\"C0 must be followed by an opcode\")\n    nxt = code[i + 1]\n    allowed = {0xE1, 0xE2} | (evm64_core_ops - {JUMP64, JUMPI64})\n    if nxt not in allowed:\n        raise InvalidCode(\"invalid opcode after C0\")\n```\n\n## 알아둘 점\n\n- **상태: Stagnant.** 테스트 케이스, 참조 구현, 보안 분석은 추가되지 않았습니다(사양에는 \"to be added\" / \"needs discussion\").\n- 자체적으로도 활성화되지 않은 두 제안에 의존합니다. EVM64([EIP-7937](/eip-7937/), Draft)와 EOF([EIP-7692](/eip-7692/), Stagnant)입니다. EOF는 메인넷 업그레이드에 포함되지 않았으므로 이 EIP는 현재 실질적인 효과가 없습니다.\n- 위의 오퍼코드 번호는 사양의 표기(`0xc0e1`, `0xc0e2`)를 따르며, 바뀔 수 있는 EIP-7937의 프리픽스 설계에 달려 있습니다.\n"},"zh":{"lang":"zh","tldr":"定义提议中的 64 位 EVM 模式（EVM64）如何纳入 EOF 代码验证，并增加相对跳转 RJUMPI 和 RJUMPV 的 64 位变体。","tags":["evm","eof","evm64","opcodes","core"],"related":[7937,3540,3670,4200,7692],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-7957/","markdown":"## 它解决什么问题？\n\n[EIP-7937](/eip-7937/) 提出了\"EVM64\"：一个前缀字节 `0xC0` 把紧随其后的操作码切换到 64 位模式，这样不需要 256 位字的算术运算可以运行得更快、更便宜。这使得一些指令变成两个字节长。\n\nEVM 对象格式（EOF，[EIP-3540](/eip-3540/) 及相关 EIP，汇总于 [EIP-7692](/eip-7692/)）在部署时对字节码做一次验证，拒绝未定义的操作码和格式错误的跳转。一个两字节的\"模式 + 操作码\"序列需要自己的验证规则，而 EOF 的静态相对跳转（[EIP-4200](/eip-4200/)）也需要对应的 64 位版本。EIP-7957 同时提供了这两者。\n\n## 它如何运作\n\n**代码验证**（对 [EIP-3670](/eip-3670/) 的扩展）。在创建 EOF 合约时，每当 `0xC0` 出现在 PUSH 数据之外：\n\n- 必须存在下一个操作码，并且\n- 它必须是 `RJUMPI64`、`RJUMPV64`，或 EIP-7937 中的某个核心 64 位操作码，但不包括 `JUMP64` 和 `JUMPI64`（EOF 没有动态跳转）。\n\n**新的 64 位相对跳转：**\n\n| 操作码 | 字节 | 行为 | Gas |\n| --- | --- | --- | --- |\n| `RJUMPI64` | `0xC0 0xE1` | 与 `RJUMPI` 类似，但只读取条件的低 64 位 | 3 |\n| `RJUMPV64` | `0xC0 0xE2` | 与 `RJUMPV` 类似，但只读取 case 索引的低 64 位 | 3 |\n\n普通的 `RJUMP` 不需要 64 位变体，因为它不触及栈。\n\n## 示例代码\n\n使用 64 位条件跳转的 EOF 代码段字节示例（偏移量是相对的，如 EIP-4200）：\n\n```text\n5f            PUSH0                ; condition = 0\nc0 e1 0003    RJUMPI64 +3          ; jump if low 64 bits of condition != 0\n...           (fall-through code)\n```\n\n以伪代码表示的验证规则：\n\n```python\ndef validate_c0(code, i, evm64_core_ops):\n    # i points at a 0xC0 byte that is not inside PUSH data\n    if i + 1 \u003e= len(code):\n        raise InvalidCode(\"C0 must be followed by an opcode\")\n    nxt = code[i + 1]\n    allowed = {0xE1, 0xE2} | (evm64_core_ops - {JUMP64, JUMPI64})\n    if nxt not in allowed:\n        raise InvalidCode(\"invalid opcode after C0\")\n```\n\n## 需要注意\n\n- **状态：Stagnant。**测试用例、参考实现和安全分析从未添加（规范中写着\"to be added\"/\"needs discussion\"）。\n- 它依赖于两个本身也未生效的提案：EVM64（[EIP-7937](/eip-7937/)，Draft）和 EOF（[EIP-7692](/eip-7692/)，Stagnant）。EOF 没有被纳入主网升级，因此这个 EIP 目前没有实际效果。\n- 上面的操作码编号遵循规范的写法（`0xc0e1`、`0xc0e2`），并取决于 EIP-7937 的前缀设计，而该设计可能会改变。\n"}}}
