Alert Source Discuss
⚠️ Draft Standards Track: Core

EIP-7623: Increase calldata cost

Increase calldata cost to decrease the maximum block size

Authors Toni Wahrstätter (@nerolation), Vitalik Buterin (@vbuterin)
Created 2024-02-13
Discussion Link https://ethereum-magicians.org/t/eip-7623-increase-calldata-cost/18647

Abstract

The current calldata pricing allows for significantly large blocks of up to 2.8 MB while the average block size is much smaller at 125 KB. This EIP proposes an adjustment in the Ethereum calldata cost to reduce the maximum possible block size and its variance without impacting regular users. This is achieved by increasing the calldata cost for transactions primarily using Ethereum for data availability.

Motivation

The block gas limit has not been increased since EIP-1559, while the average size of blocks has continuously increased due to the growing number of rollups posting data to Ethereum. Furthermore, the cost for calldata hasn’t been adjusted since EIP-2028. EIP-4844 introduces blobs as a preferred method for data availability (DA). This transition demands a reevaluation of calldata pricing, especially with regards to mitigating the inefficiency between the average block size and the maximum one possible. By introducing a floor cost dependent on calldata for transactions that are mainly using Ethereum for DA, this proposal aims to reduce the maximum block size to make room for adding more blobs.

Specification

Parameter Value
STANDARD_TOKEN_COST 4
TOTAL_COST_FLOOR_PER_TOKEN 12

Let tokens_in_calldata = zero_bytes_in_calldata + nonzero_bytes_in_calldata * 4.

Let isContractCreation be a boolean indicating the respective event.

The current formula for determining the gas used per transaction, typically described as nonzero_bytes_in_calldata * 16 + zero_bytes_in_calldata * 4, is equivalent to:

tx.gasused = (
    21000 \ 
        + isContractCreation * (32000 + InitCodeWordGas * words(calldata)) \
        + STANDARD_TOKEN_COST * tokens_in_calldata \
        + evm_gas_used
)

The formula for determining the gas used per transaction changes to:

tx.gasUsed = {
    21000 \ 
    + 
    max (
        STANDARD_TOKEN_COST * tokens_in_calldata \
           + evm_gas_used \
           + isContractCreation * (32000 + InitCodeWordGas * words(calldata)),
        TOTAL_COST_FLOOR_PER_TOKEN * tokens_in_calldata
    )

For implementation this means that the TOTAL_COST_FLOOR_PER_TOKEN must be deducted before execution to avoid invalidation after execution.

Rationale

The current maximum block size is approximately 1.79 MB (30_000_000/16). One can create blocks full of zero bytes that go up to 7.5 MB, but it is now standard to wrap blocks with snappy compression at the p2p layer and so such zero-byte-heavy blocks would end up smaller than 1.79 MB in practice. With the implementation of EIP-4844 this increased to ~2.54 MB. Furthermore, the cost for calldata bytes hasn’t been adjusted since EIP-2028.

This proposal aims to increase the cost of calldata to 16/48 gas for transactions that do not exceed a certain threshold of gas spent on EVM operations. This change will significantly reduce the maximum block size by limiting the number and size of pure-data transactions that can fit into a single block. Specifically, by adjusting the cost of calldata bytes to from 4/16 to 16/48 gas for DA transactions, the goal is to lower the maximum possible block size to roughly 0.6 MB without impacting the vast majority of users.

This reduction makes room for increasing the block gas limit or the number of blobs, while ensuring network security and efficiency. Importantly, regular users (sending ETH/Tokens/NFTs, engaging in DeFi, social media, restaking, bridging, etc.) who do not use Ethereum almost exclusively for DA, may remain unaffected. The calldata cost for transactions involving significant EVM computation remains at 4/16 gas per byte, ensuring those transactions experience no change.

Backwards Compatibility

This is a backwards incompatible gas repricing that requires a scheduled network upgrade.

Users will be able to continue operating with no changes.

Security Considerations

As the maximum possible block size is reduced, no security concerns were raised.

Copyright and related rights waived via CC0.

Citation

Please cite this document as:

Toni Wahrstätter (@nerolation), Vitalik Buterin (@vbuterin), "EIP-7623: Increase calldata cost [DRAFT]," Ethereum Improvement Proposals, no. 7623, February 2024. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-7623.