---
eip: 7778
label: EIP-7778
title: Block Gas Accounting without Refunds
status: Last Call
type: Standards Track
category: Core
created: 2024-10-01
official: https://eips.ethereum.org/EIPS/eip-7778
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-7778.md
canonical: https://eips.huatuo.xyz/eip-7778/
lang: en
tldr: Stops gas refunds from reducing the gas counted against the block gas limit, so blocks cannot carry more real work than the limit allows, while users still get their refunds.
tags: [gas, refunds, block-limit, core, dos]
---

# EIP-7778: Block Gas Accounting without Refunds

> Prevent Block Gas Limit Circumvention by Excluding Refunds from Block Gas Accounting

**TL;DR:** Stops gas refunds from reducing the gas counted against the block gas limit, so blocks cannot carry more real work than the limit allows, while users still get their refunds.

## What problem does it solve?

Some operations, most notably setting a storage slot back to zero with `SSTORE`, earn a **gas refund**. Today that refund is subtracted twice: from what the user pays, and from the gas the transaction counts toward the **block gas limit**.

The second part is the problem. The block gas limit exists to cap how much computation a block contains. If refunds shrink the counted gas, a block can include more actual work than the limit intends. The spec cites mainnet block `20878522`: 28.5M net gas used, but 4.01M of refunds, so about 32.5M gas of real work in a block whose limit was 30M.

That gap can be used for oversized blocks and denial-of-service attempts, and makes block processing time less predictable.

## How it works

The EIP separates what the user pays from what the block counts.

**User side (unchanged):**

```
gas_spent = max(tx_gas_used - gas_refund, calldata_floor_gas_cost)
```

**Block side (new):** refunds are not subtracted.

```
block.gas_used += max(tx_gas_used, calldata_floor_gas_cost)
```

The `calldata_floor_gas_cost` term comes from [EIP-7623](/eip-7623/).

Only *refunds* are excluded. Discounts that reflect genuinely less work, such as warm storage access or restoring a slot to its original value under net gas metering ([EIP-2200](/eip-2200/)), still count at their discounted cost.

## Sample code

Pseudocode for applying a transaction during block building:

```python
def apply_transaction(block, tx):
    result = execute(tx)                      # result.gas_used is before refunds
    floor = calldata_floor_gas_cost(tx)       # EIP-7623

    # What the sender pays: refunds still apply
    user_gas = max(result.gas_used - result.gas_refund, floor)
    charge_sender(tx, user_gas)

    # What counts toward the block gas limit: refunds ignored
    block_gas = max(result.gas_used, floor)
    if block.gas_used + block_gas > block.gas_limit:
        raise InvalidBlock("gas limit exceeded")
    block.gas_used += block_gas
```

## Things to know

- **Status: Last Call** (deadline 2026-11-01). It is not yet Final and requires a hard fork to activate.
- Individual users see no difference in what they pay; refunds work as today.
- Block builders must change transaction selection. A block that is "full" by the old net accounting may exceed the limit under the new rule, so refund-heavy transactions take more block space than before.
- After the change the header's `gasUsed` is no longer the sum of what users were charged, which matters for tools that assume the two are equal.
- Refunds were already capped by [EIP-3529](/eip-3529/); this EIP removes their effect on block capacity entirely.


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-7778
