---
eip: 7981
label: EIP-7981
title: Increase Access List Cost
status: Last Call
type: Standards Track
category: Core
created: 2024-12-27
requires: 2930, 7623, 7976
official: https://eips.ethereum.org/EIPS/eip-7981
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-7981.md
canonical: https://eips.huatuo.xyz/zh/eip-7981/
lang: zh
tldr: 对访问列表的每个字节数据额外收取 64 gas，使其无法再与 calldata 组合来规避 calldata 下限价格，最坏情况下的区块大小约减少 21%。
tags: [gas, access-lists, calldata, core, glamsterdam]
---

# EIP-7981: Increase Access List Cost

> Price access lists for data to reduce maximum block size

**TL;DR:** 对访问列表的每个字节数据额外收取 64 gas，使其无法再与 calldata 组合来规避 calldata 下限价格，最坏情况下的区块大小约减少 21%。

## 它解决什么问题？

[EIP-7623](/eip-7623/) 及其后续的 [EIP-7976](/eip-7976/) 为 calldata 定价设了**下限**：携带大量数据但几乎不做计算的交易，每字节要付更高的价格。这限制了区块在字节数上能增长到多大。

然而，[EIP-2930](/eip-2930/) 访问列表的定价只对应它带来的存储预热（每个地址 2,400 gas，每个存储键 1,900 gas），并不对它给区块增加的字节收费。它的 gas 被算作“执行侧”gas，因此交易可以按合适的比例混合使用访问列表和 calldata，在从不触及下限的情况下达到最大区块大小。EIP-7981 堵上了这个漏洞。规范估计，它能把最坏情况下的区块大小降低约 21%，对普通用户影响很小。

## 它如何运作

- 统计访问列表的字节数：**每个地址 20 字节 + 每个存储键 32 字节**。
- `access_list_data_cost = 64 × access_list_bytes`，即**每个地址 1,280 gas**、**每个存储键 2,048 gas**。每字节 64 gas 与 EIP-7976 的下限费率一致。
- 这笔费用作为**固定附加费**加在普通固有 gas + 执行 gas 与 calldata 下限之间的 `max(…)` **之外**。现有的 EIP-2930 费用和 EIP-7976 的下限公式保持不变。

```python
tx.gasUsed = (
    21000
    + access_list_data_cost
    + max(
        STANDARD_TOKEN_COST * tokens_in_calldata
        + execution_gas_used
        + is_create * (32000 + INITCODE_WORD_COST * words(calldata))
        + access_list_cost,
        TOTAL_COST_FLOOR_PER_TOKEN * floor_tokens_in_calldata,
    )
)
```

如果交易的 gas limit 低于按执行 gas 为零计算出的 `tx.gasUsed`，则该交易无效。

## 示例代码

估算访问列表新增附加费（TypeScript）：

```ts
type AccessListEntry = { address: string; storageKeys: string[] };

const BYTES_PER_ADDRESS = 20;
const BYTES_PER_KEY = 32;
const GAS_PER_BYTE = 64n;

function accessListDataCost(list: AccessListEntry[]): bigint {
  const bytes = list.reduce(
    (sum, e) => sum + BYTES_PER_ADDRESS + BYTES_PER_KEY * e.storageKeys.length, 0);
  return BigInt(bytes) * GAS_PER_BYTE;
}

// One address with two keys: (20 + 64) * 64 = 5,376 extra gas
// on top of the EIP-2930 cost of 2,400 + 2 * 1,900 = 6,200.
console.log(accessListDataCost([{ address: "0x" + "11".repeat(20), storageKeys: ["0x01", "0x02"] }]));
```

## 需要注意

- **状态：Last Call**（规范中的截止日期为 2026-11-01）。它在 Glamsterdam 元 EIP（[EIP-7773](/eip-7773/)）中被列为 Scheduled for Inclusion，而该元 EIP 本身仍处于 Review。激活需要硬分叉。
- 访问列表会明显变贵。过去通过预热存储槽稍微节省 gas 的列表，现在花费可能超过节省。会自动附加访问列表的钱包和 SDK 应重新检查它们是否仍然有益。
- 钱包和节点中的 gas 估算必须更新。
- 规范的原理（rationale）文字把访问列表 token 描述为下限计算的一部分，而公式和参考代码则是加上一笔单独的固定附加费；公式才是规范性的部分。


---

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