argotorg / argotorg/solidity

Remove .send and .transfer.

Open
#7,455 37 comments 19 reactions 0 assignees View on GitHub
breaking change :warning: high impact language design :rage4: low effort needs design
Dominant language
C++
Stars
25.7k
Forks
6.2k
Avg merge
1d 11h
Merged PRs (30d)
21

Description

## Description

Once again, necessary gas cost adjustments in the EVM are being contested because people incorrectly have made assumptions that gas costs are fixed rather than variable. I think a lot of this stems from the fact that Solidity actively encourages this behavior through `.send` and `.transfer` methods. The _only_ input into deciding the gas cost for any given operation is the operational cost of that instruction relative to other EVM instructions. As seen with Constantinople, and now Istanbul, the operational costs of various operations _can_ change (both up and down) over time as EVM implementations gain/lose optimizations.

The advice that is constantly doled out telling people to use `.transfer` and `send` to protect from reentrancy has resulted in Constantinople being cancelled and Petersburg having some silly code to deal with the fact that the community has been giving bad advice to new Solidity engineers for years. Similar advice is now causing pushback against the proposed gas cost changes in Istanbul because people have hard-coded things like, `if (gasleft() < 2300)` I suspect largely because of the `.transfer` and `.send` methods.

I know that writing secure code is hard, and I'm a huge advocate for making writing secure code easier. However, `.transfer` and `.send` are likely going to eventually cause security issues (like almost happened with Constantinople) because it creates a false sense of security. Also, while we may not ever be able to drop SSTORE costs down to below 2300 in ETH 1.x because of legacy code that depends on it, ETH 2.0 or any other new platform running the EVM who doesn't have to support legacy contracts _can_ set gas costs appropriately and not have to worry about breaking legacy code. However, as long as `.transfer` and `.send` exist people will continue using them and even new EVM based platforms will continue being in this bad place where gas costs are not calculated the way they should be.

TL;DR: Please remove .transfer and .send from Solidity (can deprecate for a couple years first) and advise people to follow development strategies that do not rely on on gas costs being fixed.

Contributor guide

Open the contributing guide

Research direction

The issue identifies Solidity's .send and .transfer methods as the entry points, but names no files or tests. Start by locating their compiler and language-documentation references, then determine the deprecation or removal scope and how guidance should change; done means the methods no longer encourage fixed-gas assumptions without breaking the intended migration path.

Written by the indexing model from the issue text.

Assessment

Tech stack
solidity
Domain
blockchain, compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.