{"eip":3690,"title":"EOF - JUMPDEST Table","description":"A special EOF section for storing the list of JUMPDESTs, which simplifies execution time analysis.","authors":["Alex Beregszaszi (@axic)","Paweł Bylica (@chfast)","Andrei Maiboroda (@gumb0)"],"status":"Stagnant","type":"Standards Track","category":"Core","created":"2021-06-23","requires":[3540,3670],"discussionsTo":"https://ethereum-magicians.org/t/eip-3690-eof-jumpdest-table/6806","repo":"EIPs","label":"EIP-3690","officialUrl":"https://eips.ethereum.org/EIPS/eip-3690","sourceUrl":"https://github.com/ethereum/EIPs/blob/master/EIPS/eip-3690.md","url":"https://eips.huatuo.xyz/eip-3690/","tldr":{"en":"Proposed storing an EOF contract's valid jump targets in a dedicated, creation-time-validated table so clients no longer scan code for JUMPDEST bytes on every execution.","ja":"EOF コントラクトの有効なジャンプ先を、作成時に検証される専用テーブルに保存することを提案し、クライアントが実行のたびに JUMPDEST バイトをコードからスキャンしなくて済むようにした。","ko":"EOF 컨트랙트의 유효한 점프 대상을 생성 시점에 검증되는 전용 테이블에 저장하자고 제안해, 클라이언트가 실행할 때마다 코드에서 JUMPDEST 바이트를 스캔하지 않아도 되게 했다.","zh":"提议把 EOF 合约的有效跳转目标存入创建时验证的专用表中，使客户端不必在每次执行时扫描代码中的 JUMPDEST 字节。"},"tags":["evm","eof","bytecode","jumps","core"],"explainers":{"en":{"lang":"en","tldr":"Proposed storing an EOF contract's valid jump targets in a dedicated, creation-time-validated table so clients no longer scan code for JUMPDEST bytes on every execution.","tags":["evm","eof","bytecode","jumps","core"],"related":[3540,3670,4200,7692],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-3690/","markdown":"## What problem does it solve?\n\nIn the legacy EVM, a `JUMP` or `JUMPI` may only land on a `JUMPDEST` (0x5b) opcode. But a 0x5b byte can also appear inside `PUSH` data, where it is not a real instruction. So before running any contract, a client must walk the whole bytecode to work out which 0x5b bytes are genuine jump destinations. This \"jumpdest analysis\" is repeated every time code runs and grows linearly with code size.\n\nEIP-3690 moves that work to deployment time for contracts using the EVM Object Format ([EIP-3540](/eip-3540/)). The list of valid jump targets is written into the container and checked once when the contract is created; at execution time the client just loads the list. The authors' benchmarks on popular mainnet contracts showed loading the table to be roughly 10x faster than the analysis it replaces, with the worst case about the same.\n\n## How it works\n\n- A new EOF section, `jumpdests` (section kind 3), holds a list of jump locations. It sits directly before the code section and must be present **if and only if** the code uses `JUMP` or `JUMPI`.\n- Locations are **delta-encoded** (each value is the distance from the previous one) and each delta is written as **unsigned LEB128**, the variable-length integer format used by WebAssembly. Because jump targets are usually close together, most entries take a single byte.\n- Encoding must be minimal (no padding zero bytes), and only the first delta may be 0, so there are no duplicates.\n- At creation, every location must point to a real opcode: not into `PUSH` data and not outside the code section.\n- In EOF code the `JUMPDEST` opcode itself becomes invalid, since the table replaces it. Code containing it fails validation (via the rules of [EIP-3670](/eip-3670/)).\n- At runtime, a `JUMP` or a taken `JUMPI` to a target not in the table aborts with \"bad jump destination\", as before.\n\nLegacy (non-EOF) contracts are completely unaffected.\n\n## Sample code\n\nEncoding and decoding a jumpdest table (Python, following the spec's rules):\n\n```python\ndef leb128u(n: int) -\u003e bytes:\n    out = bytearray()\n    while True:\n        b = n \u0026 0x7F\n        n \u003e\u003e= 7\n        out.append(b | (0x80 if n else 0))\n        if not n:\n            return bytes(out)\n\ndef encode_table(absolute: list[int]) -\u003e bytes:\n    deltas, prev = [], 0\n    for pos in sorted(absolute):\n        deltas.append(pos - prev)\n        prev = pos\n    return b\"\".join(leb128u(d) for d in deltas)\n\n# Jump targets at code offsets 0, 5 and 200\nprint(encode_table([0, 5, 200]).hex())   # \"0005c301\"\n\n# Decoding: absolute offset of entry n is the partial sum of deltas\ndef jumpdest(n: int, deltas: list[int]) -\u003e int:\n    return sum(deltas[: n + 1])\n```\n\n## Things to know\n\n- **Status: Stagnant.** This proposal was not adopted. Later EOF designs dropped dynamic jumps entirely in favour of static relative jumps ([EIP-4200](/eip-4200/)), which remove the need for a jumpdest table altogether. See the EOF meta proposal [EIP-7692](/eip-7692/) for how the overall EOF bundle evolved.\n- It depended on EOF v1 ([EIP-3540](/eip-3540/)) and code validation ([EIP-3670](/eip-3670/)), both of which are also Stagnant.\n- The table size is bounded by the EOF maximum section size (0xffff), which also put an implicit bound on initcode analysis for EOF code; legacy code remained unaffected and unbounded by this change.\n- Delta encoding keeps total bytecode size roughly unchanged, because each removed 0x5b byte is replaced by about one table byte. Contracts with jump targets more than 127 bytes apart grow slightly.\n"},"ja":{"lang":"ja","tldr":"EOF コントラクトの有効なジャンプ先を、作成時に検証される専用テーブルに保存することを提案し、クライアントが実行のたびに JUMPDEST バイトをコードからスキャンしなくて済むようにした。","tags":["evm","eof","bytecode","jumps","core"],"related":[3540,3670,4200,7692],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-3690/","markdown":"## 何を解決するのか\n\n従来の EVM では、`JUMP` や `JUMPI` は `JUMPDEST`（0x5b）opcode にしか着地できません。しかし、0x5b バイトは `PUSH` のデータ内にも現れることがあり、その場合は本物の命令ではありません。そのためクライアントは、コントラクトを実行する前に、バイトコード全体を走査して、どの 0x5b バイトが本物のジャンプ先かを調べなければなりません。この「jumpdest 分析」はコードが実行されるたびに繰り返され、コードサイズに比例して増えます。\n\nEIP-3690 は、EVM Object Format（[EIP-3540](/eip-3540/)）を使うコントラクトについて、その作業をデプロイ時に移します。有効なジャンプ先のリストはコンテナに書き込まれ、コントラクトの作成時に一度だけ検証されます。実行時には、クライアントはリストを読み込むだけです。作者がメインネットの人気コントラクトで行ったベンチマークでは、テーブルの読み込みは、置き換える分析より約 10 倍高速で、最悪ケースでもほぼ同等でした。\n\n## 仕組み\n\n- 新しい EOF セクション `jumpdests`（セクション種別 3）が、ジャンプ位置のリストを保持します。コードセクションの直前に置かれ、コードが `JUMP` または `JUMPI` を使う場合に**限り**（かつその場合は必ず）存在しなければなりません。\n- 位置は**差分エンコード**され（各値は直前の値からの距離）、各差分は **unsigned LEB128**（WebAssembly で使われる可変長整数形式）で書かれます。ジャンプ先は通常近くに集まっているため、ほとんどのエントリは 1 バイトで済みます。\n- エンコーディングは最小でなければならず（ゼロのパディングバイトなし）、0 にできるのは最初の差分だけなので、重複はありません。\n- 作成時に、すべての位置が本物の opcode を指していなければなりません。`PUSH` のデータ内やコードセクションの外を指してはなりません。\n- EOF コードでは、テーブルがその役割を置き換えるため、`JUMPDEST` opcode 自体が無効になります。これを含むコードは検証に失敗します（[EIP-3670](/eip-3670/) のルールによる）。\n- 実行時には、テーブルにないジャンプ先への `JUMP`、または実行される `JUMPI` は、従来どおり「bad jump destination」で中断します。\n\n従来の（非 EOF）コントラクトにはまったく影響しません。\n\n## サンプルコード\n\njumpdest テーブルのエンコードとデコード（Python、仕様のルールに従う）:\n\n```python\ndef leb128u(n: int) -\u003e bytes:\n    out = bytearray()\n    while True:\n        b = n \u0026 0x7F\n        n \u003e\u003e= 7\n        out.append(b | (0x80 if n else 0))\n        if not n:\n            return bytes(out)\n\ndef encode_table(absolute: list[int]) -\u003e bytes:\n    deltas, prev = [], 0\n    for pos in sorted(absolute):\n        deltas.append(pos - prev)\n        prev = pos\n    return b\"\".join(leb128u(d) for d in deltas)\n\n# Jump targets at code offsets 0, 5 and 200\nprint(encode_table([0, 5, 200]).hex())   # \"0005c301\"\n\n# Decoding: absolute offset of entry n is the partial sum of deltas\ndef jumpdest(n: int, deltas: list[int]) -\u003e int:\n    return sum(deltas[: n + 1])\n```\n\n## 知っておくべきこと\n\n- **ステータス: Stagnant。** この提案は採用されませんでした。その後の EOF の設計では、動的ジャンプを完全に廃止して静的な相対ジャンプ（[EIP-4200](/eip-4200/)）を採用し、jumpdest テーブルそのものが不要になりました。EOF バンドル全体がどう進化したかは、EOF のメタ提案 [EIP-7692](/eip-7692/) を参照してください。\n- EOF v1（[EIP-3540](/eip-3540/)）とコード検証（[EIP-3670](/eip-3670/)）に依存していましたが、どちらも Stagnant です。\n- テーブルのサイズは EOF のセクションサイズの上限（0xffff）で制限され、これは EOF コードの initcode 分析にも暗黙の上限を与えていました。従来のコードはこの変更の影響を受けず、上限もありませんでした。\n- 差分エンコードにより、バイトコード全体のサイズはほぼ変わりません。取り除かれた 0x5b バイトごとに、約 1 バイトのテーブルエントリに置き換わるためです。ジャンプ先が 127 バイトより離れているコントラクトは、わずかに大きくなります。\n"},"ko":{"lang":"ko","tldr":"EOF 컨트랙트의 유효한 점프 대상을 생성 시점에 검증되는 전용 테이블에 저장하자고 제안해, 클라이언트가 실행할 때마다 코드에서 JUMPDEST 바이트를 스캔하지 않아도 되게 했다.","tags":["evm","eof","bytecode","jumps","core"],"related":[3540,3670,4200,7692],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-3690/","markdown":"## 어떤 문제를 해결하나요?\n\n레거시 EVM에서 `JUMP`나 `JUMPI`는 `JUMPDEST`(0x5b) opcode에만 착지할 수 있습니다. 그런데 0x5b 바이트는 `PUSH` 데이터 안에도 나타날 수 있고, 그 경우 실제 명령이 아닙니다. 그래서 컨트랙트를 실행하기 전에 클라이언트는 바이트코드 전체를 훑어 어떤 0x5b 바이트가 진짜 점프 대상인지 알아내야 합니다. 이 \"jumpdest 분석\"은 코드가 실행될 때마다 반복되고 코드 크기에 비례해 늘어납니다.\n\nEIP-3690은 EVM Object Format([EIP-3540](/eip-3540/))을 사용하는 컨트랙트에 대해 그 작업을 배포 시점으로 옮깁니다. 유효한 점프 대상 목록은 컨테이너에 기록되고 컨트랙트가 생성될 때 한 번 검사됩니다. 실행 시에는 클라이언트가 목록을 불러오기만 하면 됩니다. 저자들이 메인넷의 인기 컨트랙트로 한 벤치마크에서, 테이블을 불러오는 것은 그것이 대체하는 분석보다 약 10배 빨랐고 최악의 경우에도 거의 같았습니다.\n\n## 어떻게 동작하나요?\n\n- 새 EOF 섹션 `jumpdests`(섹션 종류 3)가 점프 위치 목록을 담습니다. 코드 섹션 바로 앞에 놓이며, 코드가 `JUMP` 또는 `JUMPI`를 사용하는 경우**에만**(그리고 그런 경우에는 반드시) 존재해야 합니다.\n- 위치는 **델타 인코딩**되고(각 값은 직전 값으로부터의 거리), 각 델타는 **unsigned LEB128**(WebAssembly가 쓰는 가변 길이 정수 형식)로 기록됩니다. 점프 대상은 보통 서로 가깝기 때문에 대부분의 항목은 1바이트로 충분합니다.\n- 인코딩은 최소여야 하며(패딩용 0 바이트 없음) 첫 번째 델타만 0일 수 있으므로 중복이 없습니다.\n- 생성 시 모든 위치는 실제 opcode를 가리켜야 합니다. `PUSH` 데이터 안이나 코드 섹션 밖을 가리켜서는 안 됩니다.\n- EOF 코드에서는 테이블이 그 역할을 대체하므로 `JUMPDEST` opcode 자체가 무효가 됩니다. 이를 포함한 코드는 검증에 실패합니다([EIP-3670](/eip-3670/)의 규칙에 따라).\n- 런타임에 테이블에 없는 대상으로 가는 `JUMP` 또는 실행되는 `JUMPI`는 이전처럼 \"bad jump destination\"으로 중단됩니다.\n\n레거시(비 EOF) 컨트랙트는 전혀 영향을 받지 않습니다.\n\n## 샘플 코드\n\njumpdest 테이블 인코딩과 디코딩(Python, 스펙의 규칙을 따름):\n\n```python\ndef leb128u(n: int) -\u003e bytes:\n    out = bytearray()\n    while True:\n        b = n \u0026 0x7F\n        n \u003e\u003e= 7\n        out.append(b | (0x80 if n else 0))\n        if not n:\n            return bytes(out)\n\ndef encode_table(absolute: list[int]) -\u003e bytes:\n    deltas, prev = [], 0\n    for pos in sorted(absolute):\n        deltas.append(pos - prev)\n        prev = pos\n    return b\"\".join(leb128u(d) for d in deltas)\n\n# Jump targets at code offsets 0, 5 and 200\nprint(encode_table([0, 5, 200]).hex())   # \"0005c301\"\n\n# Decoding: absolute offset of entry n is the partial sum of deltas\ndef jumpdest(n: int, deltas: list[int]) -\u003e int:\n    return sum(deltas[: n + 1])\n```\n\n## 알아둘 점\n\n- **상태: Stagnant.** 이 제안은 채택되지 않았습니다. 이후 EOF 설계는 동적 점프를 완전히 버리고 정적 상대 점프([EIP-4200](/eip-4200/))를 택해, jumpdest 테이블이 아예 필요 없어졌습니다. EOF 번들 전체가 어떻게 발전했는지는 EOF 메타 제안 [EIP-7692](/eip-7692/)를 참고하세요.\n- EOF v1([EIP-3540](/eip-3540/))과 코드 검증([EIP-3670](/eip-3670/))에 의존했으며, 둘 다 Stagnant입니다.\n- 테이블 크기는 EOF 최대 섹션 크기(0xffff)로 제한되며, 이는 EOF 코드의 initcode 분석에도 암묵적인 상한을 둡니다. 레거시 코드는 이 변경의 영향을 받지 않았고 상한도 없었습니다.\n- 델타 인코딩 덕분에 전체 바이트코드 크기는 거의 그대로입니다. 제거되는 0x5b 바이트마다 약 1바이트의 테이블 항목으로 대체되기 때문입니다. 점프 대상이 127바이트보다 멀리 떨어진 컨트랙트는 약간 커집니다.\n"},"zh":{"lang":"zh","tldr":"提议把 EOF 合约的有效跳转目标存入创建时验证的专用表中，使客户端不必在每次执行时扫描代码中的 JUMPDEST 字节。","tags":["evm","eof","bytecode","jumps","core"],"related":[3540,3670,4200,7692],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-3690/","markdown":"## 它解决什么问题？\n\n在传统 EVM 中，`JUMP` 或 `JUMPI` 只能落在 `JUMPDEST`（0x5b）opcode 上。但 0x5b 字节也可能出现在 `PUSH` 数据中，此时它并不是真正的指令。因此在运行任何合约之前，客户端必须遍历整个字节码，找出哪些 0x5b 字节是真正的跳转目标。这种「jumpdest 分析」每次代码运行时都要重复，并且随代码大小线性增长。\n\nEIP-3690 把使用 EVM Object Format（[EIP-3540](/eip-3540/)）的合约的这项工作转移到部署时。有效跳转目标的列表被写入容器，并在合约创建时检查一次；执行时，客户端只需加载该列表。作者对主网热门合约的基准测试显示，加载该表比它所取代的分析快约 10 倍，最坏情况下大致相当。\n\n## 它如何运作\n\n- 新的 EOF 节 `jumpdests`（节类型 3）保存跳转位置列表。它紧邻代码节之前，**当且仅当**代码使用 `JUMP` 或 `JUMPI` 时必须存在。\n- 位置采用**差分编码**（每个值是与前一个值的距离），每个差值以**无符号 LEB128**（WebAssembly 使用的变长整数格式）写入。由于跳转目标通常彼此靠近，大多数条目只占一个字节。\n- 编码必须是最小的（没有填充的零字节），并且只有第一个差值可以为 0，因此不会出现重复。\n- 创建时，每个位置都必须指向真实的 opcode：不能指向 `PUSH` 数据内部，也不能在代码节之外。\n- 在 EOF 代码中，`JUMPDEST` opcode 本身变为无效，因为该表取代了它。包含它的代码无法通过验证（依据 [EIP-3670](/eip-3670/) 的规则）。\n- 运行时，`JUMP` 或被执行的 `JUMPI` 跳往不在表中的目标时，会像以前一样以「bad jump destination」中止。\n\n传统（非 EOF）合约完全不受影响。\n\n## 示例代码\n\njumpdest 表的编码与解码（Python，遵循规范的规则）：\n\n```python\ndef leb128u(n: int) -\u003e bytes:\n    out = bytearray()\n    while True:\n        b = n \u0026 0x7F\n        n \u003e\u003e= 7\n        out.append(b | (0x80 if n else 0))\n        if not n:\n            return bytes(out)\n\ndef encode_table(absolute: list[int]) -\u003e bytes:\n    deltas, prev = [], 0\n    for pos in sorted(absolute):\n        deltas.append(pos - prev)\n        prev = pos\n    return b\"\".join(leb128u(d) for d in deltas)\n\n# Jump targets at code offsets 0, 5 and 200\nprint(encode_table([0, 5, 200]).hex())   # \"0005c301\"\n\n# Decoding: absolute offset of entry n is the partial sum of deltas\ndef jumpdest(n: int, deltas: list[int]) -\u003e int:\n    return sum(deltas[: n + 1])\n```\n\n## 需要注意\n\n- **状态：Stagnant。** 该提案未被采纳。后来的 EOF 设计完全放弃了动态跳转，改用静态相对跳转（[EIP-4200](/eip-4200/)），这使得 jumpdest 表完全不再需要。关于整个 EOF 方案如何演进，请参见 EOF 元提案 [EIP-7692](/eip-7692/)。\n- 它依赖于 EOF v1（[EIP-3540](/eip-3540/)）和代码验证（[EIP-3670](/eip-3670/)），这两者同样是 Stagnant。\n- 表的大小受 EOF 最大节大小（0xffff）限制，这也为 EOF 代码的 initcode 分析设定了隐含上限；传统代码不受此变更影响，也没有上限。\n- 差分编码使总字节码大小大致不变，因为每个被移除的 0x5b 字节会被大约一个表字节取代。跳转目标之间相距超过 127 字节的合约会略微变大。\n"}}}
