{"eip":8057,"title":"Inter-Block Temporal Locality Gas Discounts","description":"Multi‑block temporal locality discounts for state and account access","authors":["Ben Adams (@benaadams)","Toni Wahrstätter (@nerolation)","Maria Inês Silva (@misilva73)","Amirul Ashraf (@asdacap)"],"status":"Draft","type":"Standards Track","category":"Core","created":"2025-10-20","requires":[2929,7928],"discussionsTo":"https://ethereum-magicians.org/t/eip-8057-block-temporal-locality-gas-discounts/25912","repo":"EIPs","label":"EIP-8057","officialUrl":"https://eips.ethereum.org/EIPS/eip-8057","sourceUrl":"https://github.com/ethereum/EIPs/blob/master/EIPS/eip-8057.md","url":"https://eips.huatuo.xyz/eip-8057/","tldr":{"en":"Discounts the cold-access surcharge for accounts and storage slots that were touched in the last 32 blocks, using block-level access lists so the discount is deterministic and known in advance.","ja":"直近 32 ブロック内に触れられたアカウントとストレージスロットに対し、ブロックレベルのアクセスリストを使って、コールドアクセスの追加料金を割り引く。これにより割引は決定的で、事前に分かる。","ko":"블록 단위 액세스 리스트를 사용해, 최근 32개 블록 안에 접근된 계정과 스토리지 슬롯의 콜드 접근 추가 요금을 할인한다. 그래서 할인은 결정적이며 미리 알 수 있다.","zh":"利用区块级访问列表，对最近 32 个区块内被访问过的账户和存储槽位减免冷访问附加费，使折扣具有确定性且可提前获知。"},"tags":["gas","storage","repricing","state-access","core"],"explainers":{"en":{"lang":"en","tldr":"Discounts the cold-access surcharge for accounts and storage slots that were touched in the last 32 blocks, using block-level access lists so the discount is deterministic and known in advance.","tags":["gas","storage","repricing","state-access","core"],"related":[2929,7928,2930,8007],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-8057/","markdown":"## What problem does it solve?\n\nSince [EIP-2929](/eip-2929/), the first touch of an account or storage slot in a transaction pays a large \"cold\" surcharge (2600 for accounts, 2100 for slots) because it might require a disk read. That models the worst case well.\n\nIn practice, clients keep recently accessed state in memory caches, and popular contracts are touched again and again within a few blocks. Those accesses are much cheaper for the node than the gas schedule says. Because gas must cover the worst case, this gap limits how far the gas limit can rise. EIP-8057 prices the common case more accurately without touching the worst case.\n\n## How it works\n\n- For the **first access in a transaction** to an account or storage slot, look up the most recent earlier block (within `WINDOW_SIZE_BLOCKS = 32`) in which it was accessed.\n- The block distance `D` determines a discount on the cold surcharge using a reversed smoothstep curve: full discount at `D = 1` (charged like a warm access), falling smoothly to zero at `D = 32`.\n- Beyond the window, or if never seen, normal cold pricing applies.\n- Same-transaction warming and [EIP-2930](/eip-2930/) access lists work as today; items pre-warmed by an access list get no extra discount. Precompiles are unaffected.\n- It is a discount on what is charged, not a refund.\n\nThe history comes from block-level access lists ([EIP-7928](/eip-7928/)), which commit to the accounts and slots each block touched. A freshly synced node only needs the access lists of the previous 32 blocks to price the next one, with no historical re-execution.\n\n## Sample code\n\nDiscount calculation (floating point for clarity; consensus code must use integers):\n\n```python\nWINDOW = 32\nCOLD_SLOAD_SURCHARGE = 2100\nWARM = 100\n\ndef smoothstep(x: float) -\u003e float:\n    x = max(0.0, min(1.0, x))\n    return x * x * (3.0 - 2.0 * x)\n\ndef sload_first_access_cost(distance: int) -\u003e int:\n    if distance \u003c 1 or distance \u003e WINDOW:\n        discount = 0\n    else:\n        x = (distance - 1) / (WINDOW - 1)\n        discount = round(COLD_SLOAD_SURCHARGE * (1.0 - smoothstep(x)))\n    return WARM + max(0, COLD_SLOAD_SURCHARGE - discount)\n\nsload_first_access_cost(1)   # 100  (warm price)\nsload_first_access_cost(32)  # 2200 (normal cold price)\n```\n\n## Things to know\n\n- **Status: Draft.** The Glamsterdam repricing directory ([EIP-8007](/eip-8007/)) lists it as declined for inclusion in that fork.\n- Wallets should not assume a discount when estimating gas, because the landing block is uncertain. The spec recommends pricing as if no discount applies.\n- Operators who can reliably target a specific block might plan around exact discounts, but the spec calls this an advanced, non-default case.\n- Clients need a rolling index of the last 32 blocks' access lists; reorgs deeper than the window are handled like a resync.\n"},"ja":{"lang":"ja","tldr":"直近 32 ブロック内に触れられたアカウントとストレージスロットに対し、ブロックレベルのアクセスリストを使って、コールドアクセスの追加料金を割り引く。これにより割引は決定的で、事前に分かる。","tags":["gas","storage","repricing","state-access","core"],"related":[2929,7928,2930,8007],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-8057/","markdown":"## 何を解決するのか\n\n[EIP-2929](/eip-2929/) 以降、トランザクション内でアカウントやストレージスロットに最初に触れると、ディスク読み取りが必要になるかもしれないという理由で、大きな「コールド」追加料金（アカウントは 2600、スロットは 2100）がかかります。これは最悪のケースをうまくモデル化しています。\n\n実際には、クライアントは最近アクセスしたステートをメモリキャッシュに保持しており、人気のコントラクトは数ブロックの間に何度も触れられます。こうしたアクセスは、ガススケジュールが示すよりもノードにとってずっと安価です。ガスは最悪のケースをカバーしなければならないため、このギャップがガスリミットをどこまで引き上げられるかを制限します。EIP-8057 は、最悪のケースには手を触れずに、一般的なケースをより正確に価格付けします。\n\n## 仕組み\n\n- トランザクション内でアカウントやストレージスロットに**最初にアクセス**するとき、それがアクセスされた直近の過去のブロック（`WINDOW_SIZE_BLOCKS = 32` 以内）を調べます。\n- ブロック距離 `D` により、反転させた smoothstep 曲線を使ってコールド追加料金の割引が決まります。`D = 1` で全額割引（warm アクセスと同じ課金）、`D = 32` に向けてなめらかに 0 まで下がります。\n- ウィンドウを超える場合や、一度も見られていない場合は、通常のコールド価格が適用されます。\n- 同一トランザクション内のウォーミングと [EIP-2930](/eip-2930/) のアクセスリストは従来どおり機能します。アクセスリストで事前にウォームされた項目に追加の割引はありません。プリコンパイルは影響を受けません。\n- これは課金額に対する割引であり、払い戻しではありません。\n\n履歴は、各ブロックが触れたアカウントとスロットにコミットするブロックレベルのアクセスリスト（[EIP-7928](/eip-7928/)）から得られます。同期したばかりのノードは、次のブロックの価格を決めるために直前 32 ブロックのアクセスリストさえあればよく、過去の再実行は不要です。\n\n## サンプルコード\n\n割引の計算（分かりやすさのため浮動小数点を使用。コンセンサスコードは整数を使う必要があります）:\n\n```python\nWINDOW = 32\nCOLD_SLOAD_SURCHARGE = 2100\nWARM = 100\n\ndef smoothstep(x: float) -\u003e float:\n    x = max(0.0, min(1.0, x))\n    return x * x * (3.0 - 2.0 * x)\n\ndef sload_first_access_cost(distance: int) -\u003e int:\n    if distance \u003c 1 or distance \u003e WINDOW:\n        discount = 0\n    else:\n        x = (distance - 1) / (WINDOW - 1)\n        discount = round(COLD_SLOAD_SURCHARGE * (1.0 - smoothstep(x)))\n    return WARM + max(0, COLD_SLOAD_SURCHARGE - discount)\n\nsload_first_access_cost(1)   # 100  (warm price)\nsload_first_access_cost(32)  # 2200 (normal cold price)\n```\n\n## 知っておくべきこと\n\n- **ステータス: Draft。** Glamsterdam の価格改定ディレクトリ（[EIP-8007](/eip-8007/)）は、これを当該フォークへの採用見送りとして挙げています。\n- 取り込まれるブロックが不確かなため、ウォレットはガス見積もり時に割引を前提にすべきではありません。仕様は、割引が適用されないものとして価格を見積もることを推奨しています。\n- 特定のブロックを確実に狙えるオペレーターは、正確な割引を見込んで計画できるかもしれませんが、仕様はこれを高度な、デフォルトではないケースとしています。\n- クライアントには直近 32 ブロックのアクセスリストのローリングインデックスが必要です。ウィンドウより深いリオルグは再同期と同様に扱われます。\n"},"ko":{"lang":"ko","tldr":"블록 단위 액세스 리스트를 사용해, 최근 32개 블록 안에 접근된 계정과 스토리지 슬롯의 콜드 접근 추가 요금을 할인한다. 그래서 할인은 결정적이며 미리 알 수 있다.","tags":["gas","storage","repricing","state-access","core"],"related":[2929,7928,2930,8007],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-8057/","markdown":"## 어떤 문제를 해결하나요?\n\n[EIP-2929](/eip-2929/) 이후, 트랜잭션에서 계정이나 스토리지 슬롯을 처음 건드리면 디스크 읽기가 필요할 수 있다는 이유로 큰 \"콜드\" 추가 요금(계정 2600, 슬롯 2100)을 냅니다. 이는 최악의 경우를 잘 반영합니다.\n\n실제로 클라이언트는 최근 접근한 상태를 메모리 캐시에 보관하고, 인기 있는 컨트랙트는 몇 블록 안에 계속 다시 접근됩니다. 이런 접근은 가스 스케줄이 말하는 것보다 노드에게 훨씬 저렴합니다. 가스는 최악의 경우를 감당해야 하므로, 이 격차가 가스 한도를 얼마나 올릴 수 있는지를 제한합니다. EIP-8057은 최악의 경우를 건드리지 않으면서 흔한 경우를 더 정확하게 가격에 반영합니다.\n\n## 어떻게 동작하나요?\n\n- 트랜잭션에서 계정이나 스토리지 슬롯에 **처음 접근**할 때, 그것이 접근되었던 가장 최근의 이전 블록(`WINDOW_SIZE_BLOCKS = 32` 이내)을 찾습니다.\n- 블록 거리 `D`가 뒤집은 smoothstep 곡선으로 콜드 추가 요금의 할인율을 결정합니다. `D = 1`이면 전액 할인(warm 접근처럼 청구), 부드럽게 줄어 `D = 32`에서 0이 됩니다.\n- 윈도우를 벗어나거나 본 적이 없으면 일반 콜드 가격이 적용됩니다.\n- 같은 트랜잭션 내 워밍과 [EIP-2930](/eip-2930/) 액세스 리스트는 지금처럼 동작하며, 액세스 리스트로 미리 워밍된 항목은 추가 할인을 받지 않습니다. 프리컴파일은 영향을 받지 않습니다.\n- 청구 금액에 대한 할인이지 환불이 아닙니다.\n\n이력은 각 블록이 접근한 계정과 슬롯을 커밋하는 블록 단위 액세스 리스트([EIP-7928](/eip-7928/))에서 얻습니다. 방금 동기화한 노드는 다음 블록의 가격을 매기는 데 직전 32개 블록의 액세스 리스트만 있으면 되며, 과거 재실행은 필요 없습니다.\n\n## 샘플 코드\n\n할인 계산(이해를 돕기 위해 부동소수점 사용. 합의 코드는 정수를 써야 함):\n\n```python\nWINDOW = 32\nCOLD_SLOAD_SURCHARGE = 2100\nWARM = 100\n\ndef smoothstep(x: float) -\u003e float:\n    x = max(0.0, min(1.0, x))\n    return x * x * (3.0 - 2.0 * x)\n\ndef sload_first_access_cost(distance: int) -\u003e int:\n    if distance \u003c 1 or distance \u003e WINDOW:\n        discount = 0\n    else:\n        x = (distance - 1) / (WINDOW - 1)\n        discount = round(COLD_SLOAD_SURCHARGE * (1.0 - smoothstep(x)))\n    return WARM + max(0, COLD_SLOAD_SURCHARGE - discount)\n\nsload_first_access_cost(1)   # 100  (warm price)\nsload_first_access_cost(32)  # 2200 (normal cold price)\n```\n\n## 알아둘 점\n\n- **상태: Draft.** Glamsterdam 가격 재조정 디렉터리([EIP-8007](/eip-8007/))는 이를 해당 포크에 포함하지 않기로 한 제안으로 분류합니다.\n- 트랜잭션이 어느 블록에 들어갈지 불확실하므로, 지갑은 가스를 추정할 때 할인을 가정해서는 안 됩니다. 스펙은 할인이 없는 것으로 가격을 매기라고 권고합니다.\n- 특정 블록을 안정적으로 노릴 수 있는 운영자는 정확한 할인을 계획에 넣을 수도 있지만, 스펙은 이를 고급 사용이자 기본이 아닌 경우라고 말합니다.\n- 클라이언트는 최근 32개 블록 액세스 리스트의 롤링 인덱스가 필요합니다. 윈도우보다 깊은 리오그는 재동기화처럼 처리됩니다.\n"},"zh":{"lang":"zh","tldr":"利用区块级访问列表，对最近 32 个区块内被访问过的账户和存储槽位减免冷访问附加费，使折扣具有确定性且可提前获知。","tags":["gas","storage","repricing","state-access","core"],"related":[2929,7928,2930,8007],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-8057/","markdown":"## 它解决什么问题？\n\n自 [EIP-2929](/eip-2929/) 以来，在一笔交易中首次访问某个账户或存储槽位需要支付较高的“冷”附加费（账户 2600，槽位 2100），因为这可能需要读磁盘。这很好地模拟了最坏情况。\n\n实际上，客户端会把最近访问过的状态保存在内存缓存中，热门合约在几个区块内会被反复访问。这些访问对节点来说比 gas 表所示的要便宜得多。由于 gas 必须覆盖最坏情况，这一差距限制了 gas 上限能提高多少。EIP-8057 在不触动最坏情况的前提下，更准确地为常见情况定价。\n\n## 它如何运作\n\n- 对一笔交易中**首次访问**某个账户或存储槽位时，查找它最近一次被访问的更早区块（在 `WINDOW_SIZE_BLOCKS = 32` 之内）。\n- 区块距离 `D` 通过一条反向的 smoothstep 曲线决定冷附加费的折扣：`D = 1` 时全额折扣（按 warm 访问收费），平滑下降，到 `D = 32` 时为零。\n- 超出窗口或从未见过时，按正常的冷访问定价。\n- 同一交易内的预热和 [EIP-2930](/eip-2930/) 访问列表照常工作；已被访问列表预热的项目不会获得额外折扣。预编译合约不受影响。\n- 这是对所收费用的折扣，而不是退款。\n\n历史数据来自区块级访问列表（[EIP-7928](/eip-7928/)），它们承诺了每个区块访问过的账户和槽位。刚同步完成的节点只需要前 32 个区块的访问列表就能为下一个区块定价，无需重放历史。\n\n## 示例代码\n\n折扣计算（为清晰起见使用浮点数；共识代码必须使用整数）：\n\n```python\nWINDOW = 32\nCOLD_SLOAD_SURCHARGE = 2100\nWARM = 100\n\ndef smoothstep(x: float) -\u003e float:\n    x = max(0.0, min(1.0, x))\n    return x * x * (3.0 - 2.0 * x)\n\ndef sload_first_access_cost(distance: int) -\u003e int:\n    if distance \u003c 1 or distance \u003e WINDOW:\n        discount = 0\n    else:\n        x = (distance - 1) / (WINDOW - 1)\n        discount = round(COLD_SLOAD_SURCHARGE * (1.0 - smoothstep(x)))\n    return WARM + max(0, COLD_SLOAD_SURCHARGE - discount)\n\nsload_first_access_cost(1)   # 100  (warm price)\nsload_first_access_cost(32)  # 2200 (normal cold price)\n```\n\n## 需要注意\n\n- **状态：Draft。** Glamsterdam 重新定价目录（[EIP-8007](/eip-8007/)）把它列为该分叉中被拒绝纳入的提案。\n- 钱包在估算 gas 时不应假定有折扣，因为交易落入哪个区块并不确定。规范建议按没有折扣来定价。\n- 能够可靠地瞄准特定区块的运营者或许可以按确切折扣来规划，但规范把这称为高级的、非默认的情形。\n- 客户端需要为最近 32 个区块的访问列表维护滚动索引；比窗口更深的重组按重新同步处理。\n"}},"requiredBy":[8007]}
