Prevent the circumvention of the block gas limit by excluding certain gas discounts and refunds from block gas accounting, except for those reflecting actual reductions in computational work.
This proposal aims to align the block gas usage with the Ethereum Virtual Machine’s (EVM) real workload, preventing “block gas smuggling.” It complements EIP-7623 by further reducing the maximum block size and its variance, enhancing network stability and efficiency.
Example block 20878522 “uses” 28.5 MGas, but also in that net figure is 4.01 MGas of refunds for a total of 32.51 MGas gross; which is 2.51MGas above the current mainnet block gaslimit.
Abstract
This EIP modifies the gas accounting mechanism to prevent block gas smuggling — situations where transactions include more gas-consuming operations than the block gas limit intends due to gas discounts and refunds.
By excluding these discounts and refunds from block gas limit calculations, except for those corresponding to actual workload reductions (e.g., warm storage accesses, SSTORE reverting to original values), the proposal ensures that the block gas limit accurately reflects the EVM’s computational and storage workload.
It complements EIP-7623, which increases calldata costs for data availability (DA) transactions, by further reducing maximum block sizes and over-the-wire data.
Motivation
Preventing Block Gas Smuggling
Current Issue:
Gas discounts and refunds can be exploited to include more operations in a block than the block gas limit permits.
This “smuggling” allows for oversized blocks, leading to network instability and potential denial-of-service (DoS) vectors.
Need for Change:
Align block gas accounting with actual EVM workload.
Prevent blocks from exceeding intended computational limits.
Preserve user incentives for efficient behavior without compromising network performance.
Complementing EIP-7623
EIP-7623 Goals:
Increase calldata costs for DA-heavy transactions to reduce maximum block size and variance.
Encourage the adoption of more efficient data availability solutions (e.g., blobs from EIP-4844).
Complementary Approach:
By preventing block gas smuggling, we further reduce maximum block sizes and over-the-wire data.
Ensure that block gas usage accurately reflects computational workload, enhancing the effectiveness of EIP-7623.
Specification
Gas Cost Adjustments
User Gas Costs:
SSTORE Operations:
Users receive gas refunds when resetting storage to zero or reverting to original values.
Warm vs. Cold Storage Access Costs:
Users benefit from lower gas costs for warm storage accesses.
Block Gas Accounting:
SSTORE Operations:
Setting Storage to Zero:
Charged at full cost in block gas accounting without subtracting refunds.
Reverting Storage to Original Value:
Receive discounts in block gas accounting, reflecting reduced workload (no actual write to storage).
Warm vs. Cold Storage Access:
Discounts for warm storage accesses are preserved in block gas accounting, as they correspond to reduced computational effort.
Other Discounts and Refunds:
Exclude any discounts and refunds not associated with actual reductions in computational workload from block gas accounting.
Transaction Gas Calculation (Adjusted)
With EIP-7623 for transactions, the gas used (tx.gasUsed) is calculated as: