{"eip":8059,"title":"Gas Units Rebase for High-precision Metering","description":"Gas parameters and variables are increased to a factor of `REBASE_FACTOR` to reduce rounding errors without major changes to the EVM","authors":["Maria Silva (@misilva73)"],"status":"Draft","type":"Standards Track","category":"Core","created":"2025-10-22","discussionsTo":"https://ethereum-magicians.org/t/eip-8059-gas-rebase-for-high-precision-gas-metering/25945","repo":"EIPs","label":"EIP-8059","officialUrl":"https://eips.ethereum.org/EIPS/eip-8059","sourceUrl":"https://github.com/ethereum/EIPs/blob/master/EIPS/eip-8059.md","url":"https://eips.huatuo.xyz/eip-8059/","tldr":{"en":"Multiplies every gas cost, limit and price-related variable by 1000 so cheap opcodes can be priced precisely without fractional gas.","ja":"ガスに関わるすべてのコスト、上限、価格関連の変数を 1000 倍し、小数のガスを使わずに安価なオペコードを精密に価格設定できるようにする。","ko":"모든 가스 비용, 한도, 가격 관련 변수에 1000을 곱해, 소수 가스 없이도 저렴한 opcode의 가격을 정밀하게 매길 수 있게 한다.","zh":"将每一项 gas 成本、上限和与价格相关的变量都乘以 1000，这样便宜的操作码也能被精确定价，而不需要小数 gas。"},"tags":["gas","repricing","evm","scaling","metering"],"explainers":{"en":{"lang":"en","tldr":"Multiplies every gas cost, limit and price-related variable by 1000 so cheap opcodes can be priced precisely without fractional gas.","tags":["gas","repricing","evm","scaling","metering"],"related":[7904,8032,8037,8038],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-8059/","markdown":"## What problem does it solve?\n\nGas is an integer, and the cheapest opcodes already cost 1–3 gas. Benchmarks show compute opcodes like `ADD` or `MUL` are now overpriced relative to state access (`SSTORE`, `SLOAD`, `CREATE`), which keeps getting slower as state grows.\n\nRepricing hits a wall:\n\n- Make compute cheaper ([EIP-7904](/eip-7904/)), and many opcodes would \"want\" to cost a fraction of 1 gas but get rounded up, wasting block capacity. The spec's analysis puts the average rounding error near 59 % at a 50 Mgas/s anchor.\n- Raise everything else so the cheapest op is 1 gas, and state operations become so expensive that throughput collapses at current limits.\n\nFractional gas would fix it but complicates every gas calculation.\n\n## How it works\n\nIntroduce `REBASE_FACTOR = 1000` and, at the fork, multiply **all** gas-related parameters and variables by it: opcode costs, intrinsic costs, the block gas limit and target, transaction gas limits, and so on. Nothing changes in relative terms, but there are three extra decimal digits of precision for future repricings.\n\nAt the fork boundary, the base-fee calculation is updated so the parent block's `gas_used` and `base_fee_per_gas` are also scaled by the factor, letting the fee market carry on across the switch.\n\nWhy 1000: it is large enough to remove rounding error even at much higher throughput targets, and easy to reason about: block limits move from millions to billions and opcode costs from units to thousands.\n\n## Sample code\n\nIllustrative before/after (numbers are today's values × 1000, not a final schedule):\n\n```text\n                       before           after rebase\nADD                    3                3_000\nSLOAD (warm)           100              100_000\ntx intrinsic           21_000           21_000_000\nblock gas limit        60_000_000       60_000_000_000\n\n# a later compute repricing could then set\nADD                    -\u003e  250          # i.e. 0.25 \"old\" gas, impossible before\n```\n\nFork-boundary base fee step (pseudocode):\n\n```python\nif block.number == FORK_BLOCK:\n    parent_gas_used *= REBASE_FACTOR\n    parent_base_fee_per_gas *= REBASE_FACTOR  # as stated in the spec\nbase_fee = calculate_base_fee_per_gas(parent_gas_used, parent_base_fee_per_gas, ...)\n```\n\n## Things to know\n\n- Status is **Draft**; the spec is short and leaves the full list of affected parameters implicit (\"all gas-related\"). It also does not spell out how wei-per-gas prices (base fee, priority fees) relate to the new unit, so wallets and fee estimators should wait for that detail.\n- Every tool that hardcodes gas numbers (`21000`, gas estimates, `gasleft()` thresholds in contracts) would need review. Contracts that forward a fixed gas amount are a particular concern.\n- The spec notes block headers grow by about 2 bytes because `gasLimit` and `gasUsed` get larger.\n- It is an enabler for repricing efforts such as [EIP-7904](/eip-7904/), [EIP-8032](/eip-8032/), [EIP-8037](/eip-8037/) and [EIP-8038](/eip-8038/), not a repricing by itself.\n"},"ja":{"lang":"ja","tldr":"ガスに関わるすべてのコスト、上限、価格関連の変数を 1000 倍し、小数のガスを使わずに安価なオペコードを精密に価格設定できるようにする。","tags":["gas","repricing","evm","scaling","metering"],"related":[7904,8032,8037,8038],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-8059/","markdown":"## 何を解決するのか\n\nガスは整数であり、最も安いオペコードはすでに 1〜3 gas です。ベンチマークによると、`ADD` や `MUL` のような計算系オペコードは、ステートアクセス（`SSTORE`、`SLOAD`、`CREATE`）に比べて今や割高です。ステートアクセスはステートが増えるにつれて遅くなり続けています。\n\n価格の見直しは壁にぶつかります。\n\n- 計算を安くする（[EIP-7904](/eip-7904/)）と、多くのオペコードは 1 gas の端数のコストが「望ましい」のに切り上げられてしまい、ブロックの容量が無駄になります。仕様の分析では、50 Mgas/s を基準にした場合の平均丸め誤差は 59 % 近くになります。\n- 最も安い演算が 1 gas になるよう他のすべてを引き上げると、ステート操作が高くなりすぎ、現在の上限ではスループットが崩壊します。\n\n小数のガスなら解決できますが、あらゆるガス計算が複雑になります。\n\n## 仕組み\n\n`REBASE_FACTOR = 1000` を導入し、フォーク時にガスに関わる**すべての**パラメーターと変数にこれを掛けます。オペコードのコスト、固有コスト（intrinsic cost）、ブロックのガスリミットとターゲット、トランザクションのガスリミットなどです。相対的には何も変わりませんが、将来の価格見直しのために小数点以下 3 桁分の精度が加わります。\n\nフォークの境界では、base fee の計算が更新され、親ブロックの `gas_used` と `base_fee_per_gas` も同じ係数でスケールされるため、手数料市場は切り替えをまたいで継続できます。\n\nなぜ 1000 なのか。はるかに高いスループット目標でも丸め誤差をなくせるだけ大きく、しかも理解しやすいからです。ブロックのリミットは数百万から数十億に、オペコードのコストは 1 桁台から数千になります。\n\n## サンプルコード\n\n前後の対比の例（数値は現在の値 × 1000 であり、最終的なスケジュールではありません）:\n\n```text\n                       before           after rebase\nADD                    3                3_000\nSLOAD (warm)           100              100_000\ntx intrinsic           21_000           21_000_000\nblock gas limit        60_000_000       60_000_000_000\n\n# a later compute repricing could then set\nADD                    -\u003e  250          # i.e. 0.25 \"old\" gas, impossible before\n```\n\nフォーク境界での base fee の処理（擬似コード）:\n\n```python\nif block.number == FORK_BLOCK:\n    parent_gas_used *= REBASE_FACTOR\n    parent_base_fee_per_gas *= REBASE_FACTOR  # as stated in the spec\nbase_fee = calculate_base_fee_per_gas(parent_gas_used, parent_base_fee_per_gas, ...)\n```\n\n## 知っておくべきこと\n\n- ステータスは **Draft** です。仕様は短く、影響を受けるパラメーターの完全な一覧は暗黙のまま（「ガスに関わるすべて」）です。また、wei/gas の価格（base fee、priority fee）が新しい単位とどう関係するかも明記されていないため、ウォレットや手数料見積もりツールはその詳細を待つべきです。\n- ガスの数値をハードコードしているあらゆるツール（`21000`、ガス見積もり、コントラクト内の `gasleft()` のしきい値）は見直しが必要になります。固定量のガスを転送するコントラクトは特に懸念されます。\n- 仕様によると、`gasLimit` と `gasUsed` が大きくなるため、ブロックヘッダーは約 2 バイト増えます。\n- これは [EIP-7904](/eip-7904/)、[EIP-8032](/eip-8032/)、[EIP-8037](/eip-8037/)、[EIP-8038](/eip-8038/) のような価格見直しの取り組みを可能にするもので、それ自体が価格見直しではありません。\n"},"ko":{"lang":"ko","tldr":"모든 가스 비용, 한도, 가격 관련 변수에 1000을 곱해, 소수 가스 없이도 저렴한 opcode의 가격을 정밀하게 매길 수 있게 한다.","tags":["gas","repricing","evm","scaling","metering"],"related":[7904,8032,8037,8038],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-8059/","markdown":"## 어떤 문제를 해결하나요?\n\n가스는 정수이고 가장 저렴한 opcode는 이미 1~3 gas입니다. 벤치마크에 따르면 `ADD`나 `MUL` 같은 연산 opcode는 이제 상태 접근(`SSTORE`, `SLOAD`, `CREATE`)에 비해 가격이 과하게 높습니다. 상태 접근은 상태가 커질수록 계속 느려집니다.\n\n가격 재조정은 벽에 부딪힙니다.\n\n- 연산을 더 싸게 하면([EIP-7904](/eip-7904/)) 많은 opcode가 1 gas의 소수 몇 분의 일만 \"받아야 하는데\" 올림 처리되어 블록 용량이 낭비됩니다. 스펙의 분석에서는 50 Mgas/s 기준으로 평균 반올림 오차가 59 % 가까이 됩니다.\n- 가장 싼 연산이 1 gas가 되도록 나머지를 모두 올리면, 상태 연산이 너무 비싸져 현재 한도에서는 처리량이 무너집니다.\n\n소수 가스를 도입하면 해결되지만, 모든 가스 계산이 복잡해집니다.\n\n## 어떻게 동작하나요?\n\n`REBASE_FACTOR = 1000`을 도입하고, 포크 시점에 가스와 관련된 **모든** 파라미터와 변수에 이를 곱합니다. opcode 비용, 고유 비용(intrinsic cost), 블록 가스 한도와 목표, 트랜잭션 가스 한도 등이 포함됩니다. 상대적으로는 아무것도 바뀌지 않지만, 앞으로의 가격 재조정을 위해 소수점 아래 세 자리의 정밀도가 생깁니다.\n\n포크 경계에서는 base fee 계산이 갱신되어 부모 블록의 `gas_used`와 `base_fee_per_gas`도 같은 계수로 스케일되므로, 수수료 시장이 전환을 넘어 이어질 수 있습니다.\n\n왜 1000일까요. 훨씬 높은 처리량 목표에서도 반올림 오차를 없앨 만큼 크고, 이해하기도 쉽기 때문입니다. 블록 한도는 수백만에서 수십억으로, opcode 비용은 한 자리 수에서 수천으로 바뀝니다.\n\n## 샘플 코드\n\n전후 비교 예시(숫자는 현재 값 × 1000이며 최종 비용표가 아닙니다):\n\n```text\n                       before           after rebase\nADD                    3                3_000\nSLOAD (warm)           100              100_000\ntx intrinsic           21_000           21_000_000\nblock gas limit        60_000_000       60_000_000_000\n\n# a later compute repricing could then set\nADD                    -\u003e  250          # i.e. 0.25 \"old\" gas, impossible before\n```\n\n포크 경계에서의 base fee 처리(의사 코드):\n\n```python\nif block.number == FORK_BLOCK:\n    parent_gas_used *= REBASE_FACTOR\n    parent_base_fee_per_gas *= REBASE_FACTOR  # as stated in the spec\nbase_fee = calculate_base_fee_per_gas(parent_gas_used, parent_base_fee_per_gas, ...)\n```\n\n## 알아둘 점\n\n- 상태는 **Draft**입니다. 스펙은 짧고 영향을 받는 파라미터의 전체 목록을 암묵적으로(\"가스와 관련된 모든 것\") 남겨 둡니다. 또한 wei/gas 가격(base fee, priority fee)이 새 단위와 어떻게 연결되는지도 명시하지 않으므로, 지갑과 수수료 추정기는 그 세부 사항을 기다려야 합니다.\n- 가스 숫자를 하드코딩한 모든 도구(`21000`, 가스 추정, 컨트랙트 안의 `gasleft()` 임계값)는 검토가 필요합니다. 고정된 양의 가스를 전달하는 컨트랙트가 특히 우려됩니다.\n- 스펙에 따르면 `gasLimit`과 `gasUsed`가 커지므로 블록 헤더가 약 2바이트 늘어납니다.\n- [EIP-7904](/eip-7904/), [EIP-8032](/eip-8032/), [EIP-8037](/eip-8037/), [EIP-8038](/eip-8038/) 같은 가격 재조정 작업을 가능하게 하는 기반이며, 그 자체가 가격 재조정은 아닙니다.\n"},"zh":{"lang":"zh","tldr":"将每一项 gas 成本、上限和与价格相关的变量都乘以 1000，这样便宜的操作码也能被精确定价，而不需要小数 gas。","tags":["gas","repricing","evm","scaling","metering"],"related":[7904,8032,8037,8038],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-8059/","markdown":"## 它解决什么问题？\n\ngas 是整数，而最便宜的操作码本来就只要 1 到 3 gas。基准测试显示，`ADD` 或 `MUL` 这类计算操作码相对于状态访问（`SSTORE`、`SLOAD`、`CREATE`）现在已经定价过高，而状态访问会随着状态增长变得越来越慢。\n\n重新定价会碰壁：\n\n- 如果让计算更便宜（[EIP-7904](/eip-7904/)），许多操作码“本该”只花 1 gas 的零头，却被向上取整，浪费了区块容量。规范的分析显示，以 50 Mgas/s 为基准，平均取整误差接近 59 %。\n- 如果把其他一切都调高，使最便宜的操作为 1 gas，状态操作就会贵到在当前上限下吞吐量崩溃。\n\n小数 gas 可以解决问题，但会让所有 gas 计算变得复杂。\n\n## 它如何运作\n\n引入 `REBASE_FACTOR = 1000`，并在分叉时把**所有**与 gas 相关的参数和变量都乘以它：操作码成本、固有成本（intrinsic cost）、区块 gas 上限和目标、交易 gas 上限等等。相对关系没有任何变化，但为未来的重新定价增加了三位小数的精度。\n\n在分叉边界，base fee 的计算会更新，使父区块的 `gas_used` 和 `base_fee_per_gas` 也按该系数缩放，让费用市场能够跨越切换继续运行。\n\n为什么是 1000：它足够大，即使吞吐目标高得多也能消除取整误差，而且容易理解：区块上限从百万级变成十亿级，操作码成本从个位数变成数千。\n\n## 示例代码\n\n前后对比示意（数字是当前值 × 1000，并非最终的价目表）：\n\n```text\n                       before           after rebase\nADD                    3                3_000\nSLOAD (warm)           100              100_000\ntx intrinsic           21_000           21_000_000\nblock gas limit        60_000_000       60_000_000_000\n\n# a later compute repricing could then set\nADD                    -\u003e  250          # i.e. 0.25 \"old\" gas, impossible before\n```\n\n分叉边界的 base fee 步骤（伪代码）：\n\n```python\nif block.number == FORK_BLOCK:\n    parent_gas_used *= REBASE_FACTOR\n    parent_base_fee_per_gas *= REBASE_FACTOR  # as stated in the spec\nbase_fee = calculate_base_fee_per_gas(parent_gas_used, parent_base_fee_per_gas, ...)\n```\n\n## 需要注意\n\n- 状态为 **Draft**；规范很短，受影响参数的完整清单是隐含的（“所有与 gas 相关的”）。它也没有明确说明 wei/gas 的价格（base fee、priority fee）与新单位的关系，因此钱包和费用估算器应等待这一细节。\n- 所有硬编码了 gas 数值的工具（`21000`、gas 估算、合约中 `gasleft()` 的阈值）都需要审查。转发固定 gas 数量的合约尤其值得关注。\n- 规范指出，由于 `gasLimit` 和 `gasUsed` 变大，区块头会增加约 2 字节。\n- 它是 [EIP-7904](/eip-7904/)、[EIP-8032](/eip-8032/)、[EIP-8037](/eip-8037/)、[EIP-8038](/eip-8038/) 等重新定价工作的前提条件，本身并不是重新定价。\n"}},"requiredBy":[8007]}
