EIPs Explained

EIP-1285 · Stagnant · Core · 2018-08-01

EIP-1285: Increase Gcallstipend gas in the CALL opcode

Proposed raising the free 2,300-gas stipend given to a contract receiving ETH via CALL to 3,500, so proxy contracts could run a meaningful fallback.

What problem does it solve?

When a contract sends ETH with a value-bearing CALL, the EVM adds a small free gas allowance, the call stipend (Gcallstipend, 2,300 gas), so the receiving contract's fallback can run. It is kept small on purpose: enough to emit a log, not enough to write storage or re-enter in dangerous ways. Solidity's transfer() and send() forward only this stipend.

The problem raised in 2018 was proxy contracts. A proxy forwards every call to a logic contract with DELEGATECALL, which the authors estimated costs about 1,000 gas on its own. That leaves roughly 1,300 gas for the real fallback logic, too little even for a typical LOG. In practice, ETH sent with transfer() to a proxy-based wallet could fail.

How it works

The change is a single constant:

Parameter Before Proposed
Gcallstipend 2,300 3,500

The extra 1,200 gas was chosen to cover a DELEGATECALL plus an SLOAD (to read the implementation address) with a small margin, while still staying too low to change state. Clients would simply update the constant they store; the authors linked a Geth branch doing exactly that.

It is a backwards-incompatible consensus change and would have needed a hard fork.

Sample code

The pattern that motivated the EIP: a contract paying out with the stipend-limited transfer, and a proxy whose fallback must fit inside it.

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

contract Payer {
    function pay(address payable to) external payable {
        // Forwards only the 2,300 gas stipend to `to`.
        // If `to` is a proxy, DELEGATECALL + logic must fit in that budget.
        to.transfer(msg.value);
    }

    function paySafe(address payable to) external payable {
        // Modern practice: forward all gas and check the result,
        // guarding against reentrancy elsewhere.
        (bool ok, ) = to.call{value: msg.value}("");
        require(ok, "send failed");
    }
}

Pseudocode of the client change:

CALL_STIPEND = 2300   # current
CALL_STIPEND = 3500   # EIP-1285

Things to know

  • Status: Stagnant. It was never scheduled for a hard fork; the stipend on Ethereum Mainnet is still 2,300 gas.
  • Later repricings went the other way: storage access got more expensive (EIP-1884, EIP-2929), which made the fixed stipend even tighter for proxies.
  • The common workaround is to avoid transfer()/send() and use call{value: ...}("") with a reentrancy guard, so the receiver gets enough gas.
  • Proxies usually read their implementation from a standard slot such as ERC-1967; that SLOAD is part of why the stipend is too small.

#evm #gas #call #proxy #stagnant

Details

Authors
Ben Kaufman <[email protected]>, Adam Levi <[email protected]>
Status
Stagnant
Type
Standards Track / Core
Created
2018-08-01

Machine-readable: Markdown · JSON