EIPs Explained

EIP-7904 · Last Call · Informational · 2025-02-05

EIP-7904: Compute Gas Cost Analysis

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.

What problem does it solve?

Raising 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.

After client optimisations enabled by Block-Level Access Lists (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.

How it works

  • 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.
  • 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.
  • 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² > 0.5 and p < 0.05 are used.
  • Worst client wins: the slowest client for each operation defines that operation's cost for the whole network.
  • Conversion: runtime is converted into an implied gas cost at the target rate.

Of 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.

Sample code

The conversion from measured runtime to implied gas, as used in the analysis:

ANCHOR_RATE = 100_000_000  # gas per second (100 Mgas/s)

def implied_gas(runtime_ms: float) -> float:
    """Gas an operation 'should' cost if it must run at the anchor rate."""
    return ANCHOR_RATE * runtime_ms / 1000

# Model for a simple opcode, fitted per client with NNLS:
#   block_runtime = intercept + slope * op_count
# slope (ms per op) is the per-operation runtime.
slope_ms = 0.00000841          # illustrative value
print(implied_gas(slope_ms))   # ≈ 0.84 gas -> compare with the current price

Things to know

  • Status: Last Call. It is Informational: it changes nothing in the protocol or the gas schedule. It is a reference for future repricing work.
  • 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.
  • Lowering gas costs was explicitly out of scope, even where operations measured cheaper than their price.
  • It measures CPU time only. State access, storage growth and ZK proving cost are not covered.
  • Related work cited includes the ModExp repricing in EIP-7883, which used a consistent measurement approach.

#gas #benchmarks #opcodes #precompiles #informational

Details

Authors
Jacek Glen (@JacekGlen), Lukasz Glen (@lukasz-glen), Maria Silva (@misilva73)
Status
Last Call
Type
Informational
Created
2025-02-05
Required by

Machine-readable: Markdown · JSON