EIPs Explained

EIP-3756 · Stagnant · Core · 2021-08-21

EIP-3756: Gas Limit Cap

A proposed hard cap of 30 million gas per block, so that block producers could lower the gas limit but never raise it past a value set through the EIP process.

What problem does it solve?

On Ethereum the block gas limit is not set by a hard fork. Block producers vote it up or down a little with every block they produce, so in principle they can push it as high as they like without going through an EIP or All Core Devs.

The author points to two risks with that:

  • Benign growth. A higher gas limit makes state and history grow faster than nodes may be able to sustain.
  • Attacks. Some denial-of-service attacks do more damage when a block can hold more gas.

EIP-3756 would make the upper limit a protocol rule. Raising it would then need a hard fork, so it would be decided in the open.

How it works

The specification is a single rule. From the fork block onward, any block with gas_limit greater than 30,000,000 is invalid.

Proposers keep the power to lower the gas limit. The rationale treats this as an important safety lever: if the network becomes unstable or is under attack, proposers can shrink blocks quickly without waiting for a fork. The cap is only a ceiling, not a fixed gas limit.

Nothing else changes. The existing rule that limits how far the gas limit may move from one block to the next still applies, and so does the EIP-1559 gas target, which is half the limit.

Sample code

The extra validity check a client would add, in pseudocode:

GAS_LIMIT_CAP = 30_000_000

def validate_header(header, parent, fork_block):
    # existing checks: gas limit may move only ~1/1024 per block, etc.
    validate_gas_limit_delta(header.gas_limit, parent.gas_limit)

    if header.number >= fork_block and header.gas_limit > GAS_LIMIT_CAP:
        raise InvalidBlock("gas_limit above protocol cap")

Checking the current limit against the proposed cap (ethers v6):

import { JsonRpcProvider } from "ethers";

const provider = new JsonRpcProvider(process.env.RPC_URL);
const block = await provider.getBlock("latest");
const CAP = 30_000_000n;
console.log("gas limit:", block!.gasLimit.toString(),
            block!.gasLimit > CAP ? "(above the EIP-3756 cap)" : "(within the cap)");

Things to know

  • Status: Stagnant. EIP-3756 was never scheduled for a network upgrade, and Ethereum has no in-protocol gas limit cap.
  • The spec leaves test cases "TBD" and names no fork block.
  • The 30M figure was mainnet's gas limit when the EIP was written. Validators have since raised the limit above it. EIP-7935 proposes a new default for clients (60M), which shows the direction has been to raise the limit by coordination, not to fix a ceiling.
  • Do not confuse this with EIP-7825, which caps the gas a single transaction may use. EIP-3756 caps the whole block.

#gas #gas-limit #core #consensus #security

Details

Authors
lightclient (@lightclient)
Status
Stagnant
Type
Standards Track / Core
Created
2021-08-21

Machine-readable: Markdown · JSON