EIP-8057 Gas discount for temporal locality across blocks (Inter-Block Temporal Locality Gas Discounts)

No call decision · Fees & gas · EIP status Draft · created 2025-10-20

A proposal that, when a transaction first reads an account or storage slot accessed within the last 32 blocks, discounts the cold gas fee more the more recent the last access was.

Why it is needed

Today, Ethereum charges the most expensive cold fee every time a transaction reads an account or storage slot for the first time. In practice, however, because clients (node software) keep recently used data cached in memory for a short time, the actual cost of rereading data that was just used is much lower. In other words, the gas fee schedule is set for the worst case, and it diverges from the actual cost of the common case. This gap also makes it hard to raise the block gas limit, because nodes must provision for the worst case rather than the average case. This proposal discounts the first-access fee for items accessed within the last 32 blocks based on recency, bringing the gas price closer to the actual processing cost and allowing more execution to fit within the same gas limit. The original text explains that most actively used contracts are accessed repeatedly within a few blocks, and in that case total gas usage per block can drop by several percent.

What changes

Today

After EIP-8057

Who is affected

In depth

What gets discounted: only the first access within a transaction

The discount applies only to the first access of an item within a transaction. It covers operations that read a slot first, such as SLOAD and the read phase of SSTORE, as well as accesses that carry a cold account surcharge, such as BALANCE, EXTCODEHASH, EXTCODESIZE, EXTCODECOPY, and the target account of CALL, CALLCODE, DELEGATECALL, and STATICCALL. Write-specific costs and refund rules are unchanged. Precompiles never had a cold fee, so they are not eligible for this discount. Items already warmed in advance via an EIP-2930 access list are also not eligible for this discount. Carrying warm state across transactions within a block is intentionally not introduced.

Discount function: reverse Hermite smoothstep

The discount decreases along a smoothstep curve as a function of block distance D. NORMALIZED_DISTANCE = (D - 1) / (WINDOW_SIZE_BLOCKS - 1) is clamped to [0, 1], the smoothstep value 3x² - 2x³ is computed, and then inverted as DISCOUNT_FACTOR = 1 - SMOOTHSTEP_VALUE. At D = 1 the discount rate is maximal, and at D = WINDOW_SIZE_BLOCKS (32 by default) it is 0. The consensus code must implement this with integer arithmetic, and the reference implementation uses 2²⁵ (33,554,432) as a fixed-point scale with round-half-up rounding. All intermediate values stay below 2⁵³, so JavaScript clients produce the same result without a bignum library. Because the curve is gentle, the discount stays near its maximum through roughly the first 12 to 16 blocks and only converges to 0 near the end of the window, so missing the exact block does not make cost jump off a cliff.

Charging rules and actual figures

An item that is already warm within the transaction, or pre-warmed via the access list, pays the existing warm fee unchanged. Otherwise, if 1 <= D <= 32, the discount is subtracted from the cold surcharge. For storage, SLOAD_FIRST_ACCESS_COST = SLOAD_WARM_GAS_COST + max(0, SLOAD_COLD_SURCHARGE_GAS - DISCOUNT), and accounts follow the same structure. As example figures, a first storage read costs 100 gas at D=1, 373 at D=8, 1099 at D=16, and 2200 gas at D=32 or above. Account access costs 100 gas at D=1, 1337 at D=16, and 2700 gas at D=32 or above. This mechanism is a prepaid discount rather than a refund, so refund accounting and receipts are unchanged.

Determinism guaranteed by the BAL and initial sync

The discount is based solely on past block data committed via the EIP-7928 block-level access list (BAL). A newly synced node can collect the BALs of the previous 32 blocks and build an index of each item's last access block, allowing it to charge correctly from the very first block it validates without re-executing past transactions. A stateless validator can also verify pricing with a single succinct proof that an item appears in a recent BAL. A reorg shorter than the window simply rebuilds the index from the new chain's access lists, while a reorg longer than the window follows the same procedure as an initial resync, treating items absent from the new window as cold. Because the discount is determined solely from publicly available past data, users, builders, and wallets can compute the exact cost at submission time.

Client implementation: rolling index

The source recommends a rolling in-memory index so that past blocks are not rescanned on every block. It keeps a ring buffer of WINDOW_SIZE_BLOCKS buckets, one per recent block, each storing the accounts and storage keys first accessed in that block. Two maps, LAST_SEEN_ACCOUNT and LAST_SEEN_STORAGE_KEY, track the block at which each item last appeared within the window, and the oldest bucket is dropped as blocks advance. Memory usage is bounded by window size times the number of unique first accesses per block, which is itself bounded by the block gas limit divided by the minimum cost per item. Other implementations are also allowed, such as reusing existing caches or embedding block-distance hints in the state trie.

Warm-up spam and multi-EOA strategies

Because the maximum discount exactly equals the cold surcharge, warming a slot in block N and writing it in block N+1 actually costs slightly more than a single cold access (2200 + 100 > 2200). So keeping it open through spam yields no economic benefit. An actor coordinating multiple EOAs could use a warm-up transaction to turn the next block's access into a warm-priced one, but the gain is capped at or below the cold surcharge, and coordination costs, priority fees, and inclusion uncertainty constrain it further. The source regards this kind of cross-block pipelining as a constructive behavior that increases the temporal locality of state access and reduces client load. If desired, DISCOUNT_MAX_* could be set slightly below the cold surcharge to further reduce the incentive, but the source treats this as an optional tuning rather than a security necessity.

Guidance for wallets and gas estimators

Since it is not known at submission time exactly which block a transaction will land in, general wallet and RPC gas estimators should assume no discount applies when computing price. Only operators who can predict inclusion in a specific block with high confidence, via private order flow and priority fee settings, can reflect the exact discount, and the source designates this as an advanced usage path that should not become the default behavior for general-purpose wallets.

Status and compatibility

A hard fork is required because this changes gas charging. However, since the cost of affected operations only decreases or stays the same, and the upper bound on warm/cold costs does not rise, it does not create new failure modes for existing contracts. This proposal assumes EIP-2929 and EIP-7928 and is in Draft status, created on October 20, 2025. Being at the Draft stage, figures such as window size and the discount cap, as well as detailed rules, may still change. There is no core developer call decision yet on inclusion in a specific hard fork.

Original EIP · ← EIPs