---
eip: 7783
label: EIP-7783
title: Add Controlled Gas Limit Increase Strategy
status: Stagnant
type: Informational
created: 2024-10-06
official: https://eips.ethereum.org/EIPS/eip-7783
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-7783.md
canonical: https://eips.huatuo.xyz/zh/eip-7783/
lang: zh
tldr: 提议一个客户端默认的调度方案，让区块 gas 上限随时间缓慢且可预测地提高，而不是依赖临时性的验证者投票。
tags: [gas-limit, scaling, validators, clients, informational]
---

# EIP-7783: Add Controlled Gas Limit Increase Strategy

> Adds a controlled gas limit increase strategy.

**TL;DR:** 提议一个客户端默认的调度方案，让区块 gas 上限随时间缓慢且可预测地提高，而不是依赖临时性的验证者投票。

## 它解决什么问题？

在以太坊上，区块 gas 上限并不是由协议固定的。每个区块提议者可以朝着其客户端中配置的目标，把它小幅上调或下调。实际上，这个目标只有在运营者协调并重新配置软件时才会改变，这往往造成突然且难以预测的跳变。

这个信息类 EIP 建议采用不同的默认方式：客户端自带一套**渐进的、基于规则的调度**，每个区块（或每隔几千个区块）把目标稍微提高一点，直到某个上限。增长变得可预测，生态有时间观察各项指标，运营者也仍可随时覆盖这套调度。

## 它如何运作

该提案是面向区块生产者的 gas 上限*选择策略*，不是共识规则：提议者仍须遵守协议中已有的关于每个区块 gas 上限最多可变化多少的限制。该策略只是决定提议者要瞄准的数值。

所有变体共有的输入：

- `blockNumStart`：开始提升的区块
- `initialGasLimit`：起始上限
- `gasLimitCap`：提升停止的上限值

文中描述了三种变体：

1. **线性**：每个区块增加 `r` gas，直到上限。
2. **阶梯线性**：每 `step_blocks_interval` 个区块增加 `r` gas。台阶更大、更明显，并带有"冷却"期，以便收集稳定的指标。
3. **指数**：每 `doubling_blocks_interval` 个区块把上限翻倍，直到上限值。

这个上限值起到停用保障的作用：一旦达到，增长就停止，社区可以重新评估。验证者也可以随时停止提升或切换为固定值，例如在发生 DoS 事件期间。

## 示例代码

客户端可以实现的阶梯线性策略（Python，基于规范中的伪代码）：

```python
def target_gas_limit(block_num: int,
                     block_num_start: int,
                     initial_gas_limit: int,
                     r: int,
                     step_blocks_interval: int,
                     gas_limit_cap: int) -> int:
    if block_num < block_num_start:
        return initial_gas_limit
    steps = (block_num - block_num_start) // step_blocks_interval
    return min(gas_limit_cap, initial_gas_limit + r * steps)

# The proposer then moves the actual gas limit toward this target,
# within the per-block adjustment bounds the protocol already enforces.
```

## 需要注意

- **状态：Stagnant**，类型为 Informational：它不改变共识，也不需要硬分叉。
- 规范没有给出针对主网的单一推荐参数集；其示例仅作说明，而且文中的示例数字内部并不一致，所以不要把它们当作计划。
- 规范的伪代码比较松散（有些变量被使用却没有传入）；请把它当作草图。
- 此后 gas 上限的变更已通过其他方式协调，例如 [EIP-7935](/eip-7935/)，它把客户端的默认 gas 上限设为 60M。


---

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