Alert Source Discuss
⚠️ Draft Standards Track: Core

EIP-8131: Add Auth Data to EIP-7623 Floor

Add EIP-7702 authorization data to the EIP-7623 floor calculation

Authors Toni Wahrstätter (@nerolation)
Created 2025-01-21
Discussion Link https://ethereum-magicians.org/t/eip-9999-add-auth-data-to-eip-7623-floor/12345
Requires EIP-7623, EIP-7702

Abstract

This EIP includes EIP-7702 authorization data in the EIP-7623 floor calculation, preventing circumvention of floor pricing through authorization lists.

Motivation

EIP-7702 authorization tuples are priced for execution (PER_EMPTY_ACCOUNT_COST = 25,000 gas per authorization) but do not contribute to the EIP-7623 floor calculation.

This enables achieving ~9% larger blocks than intended by combining calldata with authorization data at an optimal ratio, circumventing the floor pricing mechanism.

Specification

Parameter Value Source
TOTAL_COST_FLOOR_PER_TOKEN 10 EIP-7623
FLOOR_COST_PER_AUTH 4040 101 bytes × 4 tokens × 10 gas
PER_EMPTY_ACCOUNT_COST 25000 EIP-7702

The EIP-7623 floor calculation is modified to include authorization data:

tokens_in_calldata = zero_bytes_in_calldata + nonzero_bytes_in_calldata * 4

floor_gas = (
    TX_BASE_COST
    + TOTAL_COST_FLOOR_PER_TOKEN * tokens_in_calldata
    + FLOOR_COST_PER_AUTH * num_authorizations
)

The gas used calculation becomes:

tx.gasUsed = (
    21000
    +
    max(
        STANDARD_TOKEN_COST * tokens_in_calldata
        + execution_gas_used
        + isContractCreation * (32000 + INITCODE_WORD_COST * words(calldata))
        + access_list_cost
        + PER_EMPTY_ACCOUNT_COST * num_authorizations,
        TOTAL_COST_FLOOR_PER_TOKEN * tokens_in_calldata
        + FLOOR_COST_PER_AUTH * num_authorizations
    )
)

Any transaction with a gas limit below floor_gas or below its intrinsic gas cost is considered invalid.

Rationale

Flat Cost Per Authorization

Each authorization is charged a flat FLOOR_COST_PER_AUTH = 4040 gas toward the floor, derived from:

  • 101 bytes per authorization tuple (as specified in EIP-7702)
  • 4 tokens per byte (treating all bytes as non-zero)
  • 10 gas per token (TOTAL_COST_FLOOR_PER_TOKEN)

This conservative approach avoids byte-level zero/non-zero accounting while ensuring authorization data is properly reflected in the floor calculation.

Floor-Only Modification

Authorization costs are added to the floor calculation only, not to intrinsic gas. This differs from EIP-7981 (access lists) because:

  • Authorization execution cost (25,000 gas) far exceeds floor contribution (4,040 gas per auth)
  • Floor-only modification is sufficient to prevent bypass

With this change:

  • Authorization data contributes to the floor path
  • High-execution transactions remain unaffected (execution exceeds floor)
  • Data-heavy transactions cannot use authorizations to bypass floor pricing

Backwards Compatibility

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

Requires updates to gas estimation in wallets and nodes. Normal usage patterns remain largely unaffected since authorization execution cost typically dominates the floor contribution.

Test Cases

Case 1: Transaction with Authorizations Only

  • Calldata: 0 bytes
  • Authorizations: 10

Old floor: 21,000 gas New floor: 21,000 + 10 × 4,040 = 61,400 gas Execution: 10 × 25,000 = 250,000 gas Result: Pay execution (250,000) - unchanged, execution dominates

Case 2: Bypass Attempt (Now Blocked)

  • Calldata: 100,000 bytes (400,000 tokens)
  • Authorizations: 100

Old floor: 21,000 + 400,000 × 10 = 4,021,000 gas New floor: 21,000 + 400,000 × 10 + 100 × 4,040 = 4,425,000 gas Execution: 21,000 + 1,600,000 + 2,500,000 = 4,121,000 gas Result: Pay new floor (4,425,000) - bypass blocked

Reference Implementation

FLOOR_COST_PER_AUTH = 4040  # 101 bytes * 4 tokens/byte * 10 gas/token


def calculate_intrinsic_cost(tx: Transaction) -> Tuple[Uint, Uint]:
    """
    Calculate intrinsic gas cost and floor gas cost.
    Returns (intrinsic_gas, floor_gas).
    """
    # Calldata tokens
    calldata_zero = sum(1 for b in tx.data if b == 0)
    tokens_in_calldata = Uint(calldata_zero + (len(tx.data) - calldata_zero) * 4)

    # Authorization costs
    num_authorizations = Uint(0)
    auth_exec_cost = Uint(0)
    if isinstance(tx, SetCodeTransaction):
        num_authorizations = Uint(len(tx.authorizations))
        auth_exec_cost = PER_EMPTY_ACCOUNT_COST * num_authorizations

    # Floor: calldata + flat cost per authorization
    floor_gas = (
        TX_BASE_COST
        + tokens_in_calldata * TOTAL_COST_FLOOR_PER_TOKEN
        + num_authorizations * FLOOR_COST_PER_AUTH
    )

    # Intrinsic: calldata + authorization execution cost
    calldata_cost = tokens_in_calldata * STANDARD_TOKEN_COST
    intrinsic_gas = TX_BASE_COST + calldata_cost + access_list_cost + auth_exec_cost

    return intrinsic_gas, floor_gas

Security Considerations

This EIP closes a loophole that allows circumventing EIP-7623 floor pricing. Without this fix, adversaries can achieve ~9% larger blocks by combining calldata with authorization data.

Interaction with EIP-7981

If EIP-7981 is also adopted, both EIPs work together: access list tokens and authorization tokens are both included in the floor calculation. There are no conflicts.

Copyright and related rights waived via CC0.

Citation

Please cite this document as:

Toni Wahrstätter (@nerolation), "EIP-8131: Add Auth Data to EIP-7623 Floor [DRAFT]," Ethereum Improvement Proposals, no. 8131, January 2025. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-8131.