EIPs Explained

EIP-7703 · Stagnant · Core · 2024-05-07

EIP-7703: Increase calldata cost

Proposed tripling calldata gas (4→12 per zero byte, 16→48 per non-zero byte) to shrink the worst-case block size so the gas limit could be raised safely.

What problem does it solve?

The biggest possible Ethereum block, in bytes, is reached by filling it with cheap calldata. Big blocks take longer to propagate across the network, so this worst case, not typical usage, is one of the things holding back increases to the block gas limit.

EIP-7703 takes the most direct route: make calldata three times more expensive. With the same gas limit, the maximum block size shrinks by about a factor of three, which gives room to raise the gas limit without making the worst case worse.

How it works

The proposal changes two constants and nothing else:

Constant Today EIP-7703
G_CALLDATAZERO (per zero byte) 4 12
G_CALLDATANONZERO (per non-zero byte) 16 48

Every transaction pays these per byte of data as part of its intrinsic gas. Execution gas, storage, and blob pricing (EIP-4844) are untouched.

Because the change is blunt, it raises costs for every transaction that carries calldata, including ordinary contract calls, not only for data-heavy ones.

Sample code

Intrinsic calldata cost before and after (TypeScript, no dependencies):

function calldataGas(data: Uint8Array, zero: number, nonZero: number): number {
  let gas = 0;
  for (const b of data) gas += b === 0 ? zero : nonZero;
  return gas;
}

const hex = "a9059cbb000000000000000000000000d8da6bf26964af9d7eed9e10e5d4ba5f1c42e8f20000000000000000000000000000000000000000000000000de0b6b3a7640000";
const data = Uint8Array.from(hex.match(/../g)!.map((h) => parseInt(h, 16)));

console.log("today:   ", calldataGas(data, 4, 16));  // 21000 + this = intrinsic gas
console.log("EIP-7703:", calldataGas(data, 12, 48)); // exactly 3x

Rough maximum block size from calldata alone:

gas_limit = 30_000_000   # illustrative gas limit
print(gas_limit // 16)   # ~1.87 MB of non-zero calldata today
print(gas_limit // 48)   # ~0.62 MB under EIP-7703

Things to know

  • Status is Stagnant. Ethereum instead adopted EIP-7623 (Pectra), which introduces a higher floor price that only applies to transactions that are mostly data and do little execution. That caps the worst-case block size while leaving normal transactions' costs unchanged. EIP-7976 proposes raising that floor further.
  • The spec notes that activation could make some transactions run out of gas if their gas limit was estimated under the old prices; wallets would need to estimate with the new constants ahead of the fork.
  • Rollups that still post data as calldata rather than blobs would have been hit hardest by a flat tripling.

#gas #calldata #block-size #core #scaling

Details

Authors
William Morriss (@wjmelements)
Status
Stagnant
Type
Standards Track / Core
Created
2024-05-07

Machine-readable: Markdown · JSON