{"eip":7904,"title":"Compute Gas Cost Analysis","description":"Empirical analysis of EVM compute operation runtimes concluding that no compute gas cost needs repricing at the target throughput","authors":["Jacek Glen (@JacekGlen)","Lukasz Glen (@lukasz-glen)","Maria Silva (@misilva73)"],"status":"Last Call","type":"Informational","created":"2025-02-05","discussionsTo":"https://ethereum-magicians.org/t/gas-cost-repricing-to-reflect-computational-complexity/23067","repo":"EIPs","label":"EIP-7904","officialUrl":"https://eips.ethereum.org/EIPS/eip-7904","sourceUrl":"https://github.com/ethereum/EIPs/blob/master/EIPS/eip-7904.md","url":"https://eips.huatuo.xyz/eip-7904/","tldr":{"en":"An empirical study of how long EVM compute opcodes and precompiles take across major clients, concluding that at a 100 Mgas/s target none of them needs a gas-cost increase.","ja":"主要クライアントにおける EVM の計算系オペコードとプリコンパイルの実行時間を調べた実証的研究。100 Mgas/s を目標とした場合、どれもガスコストの引き上げは不要と結論づけている。","ko":"주요 클라이언트에서 EVM 연산 오퍼코드와 프리컴파일이 얼마나 걸리는지 조사한 실증 연구. 100 Mgas/s 목표에서는 어느 것도 가스 비용 인상이 필요하지 않다고 결론짓는다.","zh":"一项实证研究，考察主要客户端上 EVM 计算类操作码和预编译的耗时，结论是在 100 Mgas/s 的目标下，它们都不需要提高 gas 成本。"},"tags":["gas","benchmarks","opcodes","precompiles","informational"],"explainers":{"en":{"lang":"en","tldr":"An empirical study of how long EVM compute opcodes and precompiles take across major clients, concluding that at a 100 Mgas/s target none of them needs a gas-cost increase.","tags":["gas","benchmarks","opcodes","precompiles","informational"],"related":[7928,7883,7825],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-7904/","markdown":"## What problem does it solve?\n\nRaising Ethereum's gas limit is only safe if no single operation lets an attacker fill a block with work that takes far longer to execute than its gas implies. Earlier versions of EIP-7904 were a Standards Track proposal to *raise* the price of a set of opcodes and precompiles that benchmarks had shown to be slow for their gas cost, removing them as bottlenecks.\n\nAfter client optimisations enabled by Block-Level Access Lists ([EIP-7928](/eip-7928/)) stabilised (parallel disk reads, parallel transaction validation, executionless state updates), the authors re-ran the measurements. The underpricing disappeared, so the document was turned into an **Informational** EIP that records the method, data and conclusion: no compute gas cost needs to change.\n\n## How it works\n\n- **Target throughput:** an operation counts as adequately priced if, at its current gas cost, clients execute it at 100 million gas per second or faster.\n- **Data collection:** synthetic blocks stress one operation at a time with varying counts and inputs (from the EEST benchmark suite). The Benchmarkoor tool measures block execution time on Besu, Erigon, ethrex, Geth, Nethermind and Reth, running each block several times.\n- **Estimation:** a non-negative least-squares regression separates fixed overhead from per-operation runtime (and per-byte / per-round terms for variable-cost operations). Only fits with R² \u003e 0.5 and p \u003c 0.05 are used.\n- **Worst client wins:** the slowest client for each operation defines that operation's cost for the whole network.\n- **Conversion:** runtime is converted into an implied gas cost at the target rate.\n\nOf the 18 parameters examined (`DIV`, `MOD`, `ADDMOD`, `MULMOD`, `KECCAK256`, `ECRECOVER`, BLS and BN254 precompiles, point evaluation, `P256VERIFY`, …), 16 measured *cheaper* than today's price and one was unchanged. The only higher value is the `BLAKE2F` base cost, which is currently 0 and measured at 94 gas, judged negligible.\n\n## Sample code\n\nThe conversion from measured runtime to implied gas, as used in the analysis:\n\n```python\nANCHOR_RATE = 100_000_000  # gas per second (100 Mgas/s)\n\ndef implied_gas(runtime_ms: float) -\u003e float:\n    \"\"\"Gas an operation 'should' cost if it must run at the anchor rate.\"\"\"\n    return ANCHOR_RATE * runtime_ms / 1000\n\n# Model for a simple opcode, fitted per client with NNLS:\n#   block_runtime = intercept + slope * op_count\n# slope (ms per op) is the per-operation runtime.\nslope_ms = 0.00000841          # illustrative value\nprint(implied_gas(slope_ms))   # ≈ 0.84 gas -\u003e compare with the current price\n```\n\n## Things to know\n\n- **Status: Last Call.** It is Informational: it changes **nothing** in the protocol or the gas schedule. It is a reference for future repricing work.\n- The conclusion depends on clients keeping the EIP-7928-era optimisations. The authors note that if those change, or new operations are added, the analysis should be re-run.\n- Lowering gas costs was explicitly out of scope, even where operations measured cheaper than their price.\n- It measures CPU time only. State access, storage growth and ZK proving cost are not covered.\n- Related work cited includes the ModExp repricing in [EIP-7883](/eip-7883/), which used a consistent measurement approach.\n"},"ja":{"lang":"ja","tldr":"主要クライアントにおける EVM の計算系オペコードとプリコンパイルの実行時間を調べた実証的研究。100 Mgas/s を目標とした場合、どれもガスコストの引き上げは不要と結論づけている。","tags":["gas","benchmarks","opcodes","precompiles","informational"],"related":[7928,7883,7825],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-7904/","markdown":"## 何を解決するのか\n\nEthereum のガスリミットを引き上げても安全なのは、ガスから想定される時間よりはるかに長く実行に時間がかかる処理でブロックを埋め尽くせる単一の操作が存在しない場合だけです。EIP-7904 の初期バージョンは、ガスコストに対して遅いことがベンチマークで示されたオペコードとプリコンパイルの価格を*引き上げ*、ボトルネックを解消する Standards Track の提案でした。\n\nBlock-Level Access Lists（[EIP-7928](/eip-7928/)）によって可能になったクライアントの最適化（並列ディスク読み取り、並列トランザクション検証、実行を伴わないステート更新）が安定した後、著者らは測定をやり直しました。過小な価格設定は解消していたため、この文書は、方法、データ、結論を記録する **Informational** な EIP に改められました。結論は、計算系のガスコストを変更する必要はない、というものです。\n\n## 仕組み\n\n- **目標スループット:** 現在のガスコストで、クライアントが 1 秒あたり 1 億ガス以上の速度でその操作を実行できれば、適切に価格設定されているとみなします。\n- **データ収集:** 合成ブロックが、回数や入力を変えながら、1 つずつ操作に負荷をかけます（EEST のベンチマークスイートによる）。Benchmarkoor ツールが、Besu、Erigon、ethrex、Geth、Nethermind、Reth でブロックの実行時間を測定し、各ブロックを複数回実行します。\n- **推定:** 非負最小二乗法の回帰で、固定オーバーヘッドと操作ごとの実行時間（および可変コストの操作ではバイトごと・ラウンドごとの項）を切り分けます。R² \u003e 0.5 かつ p \u003c 0.05 の当てはまりだけを使います。\n- **最も遅いクライアントが基準:** 各操作について、最も遅いクライアントがネットワーク全体におけるその操作のコストを決めます。\n- **換算:** 実行時間を、目標レートでの暗黙のガスコストに換算します。\n\n調べた 18 個のパラメーター（`DIV`、`MOD`、`ADDMOD`、`MULMOD`、`KECCAK256`、`ECRECOVER`、BLS と BN254 のプリコンパイル、ポイント評価、`P256VERIFY` など）のうち、16 個は現在の価格より*安く*測定され、1 個は変わりませんでした。唯一高くなったのは `BLAKE2F` の基本コストで、現在は 0 ですが 94 ガスと測定され、無視できる程度と判断されました。\n\n## サンプルコード\n\n分析で使われた、測定した実行時間から暗黙のガスへの換算:\n\n```python\nANCHOR_RATE = 100_000_000  # gas per second (100 Mgas/s)\n\ndef implied_gas(runtime_ms: float) -\u003e float:\n    \"\"\"Gas an operation 'should' cost if it must run at the anchor rate.\"\"\"\n    return ANCHOR_RATE * runtime_ms / 1000\n\n# Model for a simple opcode, fitted per client with NNLS:\n#   block_runtime = intercept + slope * op_count\n# slope (ms per op) is the per-operation runtime.\nslope_ms = 0.00000841          # illustrative value\nprint(implied_gas(slope_ms))   # ≈ 0.84 gas -\u003e compare with the current price\n```\n\n## 知っておくべきこと\n\n- **ステータス: Last Call。** これは Informational で、プロトコルやガススケジュールには**何も**変更を加えません。将来の価格見直し作業のための参考資料です。\n- 結論は、クライアントが EIP-7928 以降の最適化を維持していることに依存します。著者は、それらが変わった場合や新しい操作が追加された場合は、分析をやり直すべきだと述べています。\n- ガスコストの引き下げは、価格より安く測定された操作についても、明示的にスコープ外でした。\n- 測定するのは CPU 時間だけです。ステートアクセス、ストレージの増加、ZK 証明のコストは対象外です。\n- 引用されている関連作業には、一貫した測定手法を用いた [EIP-7883](/eip-7883/) の ModExp の価格見直しがあります。\n"},"ko":{"lang":"ko","tldr":"주요 클라이언트에서 EVM 연산 오퍼코드와 프리컴파일이 얼마나 걸리는지 조사한 실증 연구. 100 Mgas/s 목표에서는 어느 것도 가스 비용 인상이 필요하지 않다고 결론짓는다.","tags":["gas","benchmarks","opcodes","precompiles","informational"],"related":[7928,7883,7825],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-7904/","markdown":"## 어떤 문제를 해결하나요?\n\n이더리움의 가스 한도를 올리는 것이 안전한 것은, 가스가 암시하는 시간보다 훨씬 오래 실행되는 작업으로 공격자가 블록을 채울 수 있는 단일 연산이 없을 때뿐입니다. EIP-7904의 초기 버전은 가스 비용에 비해 느린 것으로 벤치마크에서 드러난 오퍼코드와 프리컴파일의 가격을 *올려* 병목을 없애려는 Standards Track 제안이었습니다.\n\n블록 수준 접근 목록([EIP-7928](/eip-7928/))으로 가능해진 클라이언트 최적화(병렬 디스크 읽기, 병렬 트랜잭션 검증, 실행 없는 상태 업데이트)가 안정화된 뒤, 작성자들은 측정을 다시 수행했습니다. 가격이 낮게 책정된 문제가 사라졌으므로, 이 문서는 방법, 데이터, 결론을 기록하는 **Informational** EIP로 바뀌었습니다. 결론은 어떤 연산 가스 비용도 바꿀 필요가 없다는 것입니다.\n\n## 어떻게 동작하나요?\n\n- **목표 처리량:** 현재 가스 비용에서 클라이언트가 초당 1억 가스 이상의 속도로 어떤 연산을 실행하면 적절히 가격이 책정된 것으로 봅니다.\n- **데이터 수집:** 합성 블록이 횟수와 입력을 바꿔 가며 한 번에 하나의 연산에 부하를 줍니다(EEST 벤치마크 스위트 사용). Benchmarkoor 도구가 Besu, Erigon, ethrex, Geth, Nethermind, Reth에서 블록 실행 시간을 측정하며 각 블록을 여러 번 실행합니다.\n- **추정:** 비음수 최소제곱 회귀로 고정 오버헤드와 연산당 실행 시간(그리고 가변 비용 연산의 경우 바이트당/라운드당 항)을 분리합니다. R² \u003e 0.5이고 p \u003c 0.05인 적합만 사용합니다.\n- **가장 느린 클라이언트가 기준:** 각 연산에서 가장 느린 클라이언트가 네트워크 전체에서 그 연산의 비용을 결정합니다.\n- **환산:** 실행 시간을 목표 속도에서의 암묵적 가스 비용으로 환산합니다.\n\n조사한 18개 파라미터(`DIV`, `MOD`, `ADDMOD`, `MULMOD`, `KECCAK256`, `ECRECOVER`, BLS 및 BN254 프리컴파일, 포인트 평가, `P256VERIFY` 등) 중 16개는 현재 가격보다 *싸게* 측정되었고 1개는 그대로였습니다. 유일하게 더 높은 값은 `BLAKE2F` 기본 비용으로, 현재 0이며 94 가스로 측정되었으나 무시할 만한 수준으로 판단되었습니다.\n\n## 샘플 코드\n\n분석에 사용된, 측정한 실행 시간에서 암묵적 가스로의 환산:\n\n```python\nANCHOR_RATE = 100_000_000  # gas per second (100 Mgas/s)\n\ndef implied_gas(runtime_ms: float) -\u003e float:\n    \"\"\"Gas an operation 'should' cost if it must run at the anchor rate.\"\"\"\n    return ANCHOR_RATE * runtime_ms / 1000\n\n# Model for a simple opcode, fitted per client with NNLS:\n#   block_runtime = intercept + slope * op_count\n# slope (ms per op) is the per-operation runtime.\nslope_ms = 0.00000841          # illustrative value\nprint(implied_gas(slope_ms))   # ≈ 0.84 gas -\u003e compare with the current price\n```\n\n## 알아둘 점\n\n- **상태: Last Call.** Informational이며 프로토콜이나 가스 스케줄에는 **아무것도** 바꾸지 않습니다. 앞으로의 가격 재조정 작업을 위한 참고 자료입니다.\n- 결론은 클라이언트가 EIP-7928 시대의 최적화를 유지한다는 데 달려 있습니다. 작성자들은 그것이 바뀌거나 새 연산이 추가되면 분석을 다시 수행해야 한다고 밝힙니다.\n- 가스 비용을 낮추는 것은, 가격보다 싸게 측정된 연산에 대해서도 명시적으로 범위 밖이었습니다.\n- CPU 시간만 측정합니다. 상태 접근, 스토리지 증가, ZK 증명 비용은 다루지 않습니다.\n- 인용된 관련 작업에는 일관된 측정 방식을 사용한 [EIP-7883](/eip-7883/)의 ModExp 가격 재조정이 있습니다.\n"},"zh":{"lang":"zh","tldr":"一项实证研究，考察主要客户端上 EVM 计算类操作码和预编译的耗时，结论是在 100 Mgas/s 的目标下，它们都不需要提高 gas 成本。","tags":["gas","benchmarks","opcodes","precompiles","informational"],"related":[7928,7883,7825],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-7904/","markdown":"## 它解决什么问题？\n\n只有在没有任何单一操作能让攻击者用执行耗时远超其 gas 所暗示的工作量填满一个区块时，提高以太坊的 gas 上限才是安全的。EIP-7904 的早期版本是一项 Standards Track 提案，旨在*提高*一组操作码和预编译的价格，这些操作码和预编译经基准测试证明相对于其 gas 成本而言执行较慢，从而消除它们作为瓶颈的问题。\n\n在区块级访问列表（[EIP-7928](/eip-7928/)）所带来的客户端优化（并行磁盘读取、并行交易验证、无需执行的状态更新）稳定之后，作者重新进行了测量。定价过低的情况消失了，因此该文档被改为一份 **Informational** EIP，用来记录方法、数据和结论：无需更改任何计算类 gas 成本。\n\n## 它如何运作\n\n- **目标吞吐量：**如果按其当前 gas 成本，客户端执行某个操作的速度达到或超过每秒 1 亿 gas，则认为该操作定价合理。\n- **数据收集：**合成区块每次只对一个操作施压，并改变次数和输入（来自 EEST 基准套件）。Benchmarkoor 工具测量 Besu、Erigon、ethrex、Geth、Nethermind 和 Reth 上的区块执行时间，每个区块运行多次。\n- **估算：**用非负最小二乘回归把固定开销与每次操作的运行时间分离开（对于可变成本的操作，还包括每字节/每轮的项）。只使用 R² \u003e 0.5 且 p \u003c 0.05 的拟合结果。\n- **以最慢的客户端为准：**每个操作中最慢的客户端决定该操作对整个网络的成本。\n- **换算：**把运行时间按目标速率换算为隐含的 gas 成本。\n\n在所考察的 18 个参数（`DIV`、`MOD`、`ADDMOD`、`MULMOD`、`KECCAK256`、`ECRECOVER`、BLS 和 BN254 预编译、点求值、`P256VERIFY` 等）中，16 个测得的结果比现在的价格*更低*，1 个保持不变。唯一更高的值是 `BLAKE2F` 的基础成本，目前为 0，测得为 94 gas，被判定为可以忽略。\n\n## 示例代码\n\n分析中使用的、从测得运行时间到隐含 gas 的换算：\n\n```python\nANCHOR_RATE = 100_000_000  # gas per second (100 Mgas/s)\n\ndef implied_gas(runtime_ms: float) -\u003e float:\n    \"\"\"Gas an operation 'should' cost if it must run at the anchor rate.\"\"\"\n    return ANCHOR_RATE * runtime_ms / 1000\n\n# Model for a simple opcode, fitted per client with NNLS:\n#   block_runtime = intercept + slope * op_count\n# slope (ms per op) is the per-operation runtime.\nslope_ms = 0.00000841          # illustrative value\nprint(implied_gas(slope_ms))   # ≈ 0.84 gas -\u003e compare with the current price\n```\n\n## 需要注意\n\n- **状态：Last Call。**它是 Informational 的：对协议或 gas 表**不做任何**更改。它是未来重新定价工作的参考。\n- 结论取决于客户端保持 EIP-7928 时代的优化。作者指出，如果这些优化发生变化，或者新增了操作，就应重新进行分析。\n- 降低 gas 成本明确不在范围之内，即使有些操作测得的结果比其价格更低。\n- 它只测量 CPU 时间。状态访问、存储增长和 ZK 证明成本都不在涵盖范围内。\n- 所引用的相关工作包括 [EIP-7883](/eip-7883/) 中的 ModExp 重新定价，其采用了一致的测量方法。\n"}},"requiredBy":[8007]}
