主页EIPs
EIPsEIP-1285
EIP-1285

Increase Gcallstipend gas in the CALL opcode

StagnantStandards Track: Core
创建时间: 2018-08-01
Ben Kaufman <ben@daostack.io>, Adam Levi <adam@daostack.io>
社区讨论原文链接编辑
1 分钟了解

相关视频
欢迎补充好内容
去提交
正文

Simple Summary

Increase the Gcallstipend fee parameter in the CALL opcode from 2,300 to 3,500 gas units.

Abstract

Currently, the CALL opcode forwards a stipend of 2,300 gas units for a non zero value CALL operations where a contract is called. This stipend is given to the contract to allow execution of its fallback function. The stipend given is intentionally small in order to prevent the called contract from spending the call gas or performing an attack (like re-entrancy). While the stipend is small it should still give the sufficient gas required for some cheap opcodes like LOG, but it's not enough for some more complex and modern logics to be implemented. This EIP proposes to increase the given stipend from 2,300 to 3,500 to increase the usability of the fallback function.

Motivation

The main motivation behind this EIP is to allow simple fallback functions to be implemented for contracts following the "Proxy" pattern. Simply explained, a "Proxy Contract" is a contract which use DELEGATECALL in its fallback function to behave according to the logic of another contract and serve as an independent instance for the logic of the contract it points to. This pattern is very useful for saving gas per deployment (as Proxy contracts are very lean) and it opens the ability to experiment with upgradability of contracts. On average, the DELEGATECALL functionality of a proxy contract costs about 1,000 gas units. When a contract transfers ETH to a proxy contract, the proxy logic will consume about 1,000 gas units before the fallback function of the logic contract will be executed. This leaves merely about 1,300 gas units for the execution of the logic. This is a severe limitation as it is not enough for an average LOG operation (it might be enough for a LOG with one parameter). By slightly increasing the gas units given in the stipend we allow proxy contracts have proper fallback logic without increasing the attack surface of the calling contract.

Specification

Increase the Gcallstipend fee parameter in the CALL opcode from 2,300 to 3,500 gas unit. The actual change to the Ethereum clients would be to change the CallStipend they store as a constant. For an implementation example you can find a Geth client implementation linked here. The actual change to the code can be found here.

Rationale

The rational for increasing the Gcallstipend gas parameter by 1,200 gas units comes from the cost of performing DELEGATECALL and SLOAD with a small margin for some small additional operations. All while still keeping the stipend relatively small and insufficient for accessing the storage or changing the state.

Backwards Compatibility

This EIP requires a backwards incompatible change for the Gcallstipend gas parameter in the CALL opcode.

Copyright and related rights waived via CC0.

扩展阅读
欢迎补充好内容
去提交
相关项目
欢迎补充好内容
去提交

不想错过最新的 EIP 动态?

订阅 EIPs Fun 周刊以跟进相关更新,建⽴你与 EIP 之间的连接 ,更好地建设以太坊。

详情
聚集 EIP 贡献者, 扩展以太坊
资源
GitHub
支持社区