Skip to content

Commit 64e40cf

Browse files
fixup! Update docs
1 parent d731eca commit 64e40cf

File tree

5 files changed

+39
-14
lines changed

5 files changed

+39
-14
lines changed

docs/cheatsheet.rst

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,15 @@ Members of ``address``
5757
- ``<address payable>.transfer(uint256 amount)``: send given amount of Wei to :ref:`address`, throws on failure
5858

5959
.. warning::
60-
``send`` and ``transfer`` are deprecated and scheduled for removal.
61-
Use the :ref:`call function <address_call_functions>` with an optionally provided maximum amount of
62-
gas (by default forwards 63/64 of the remaining gas) and an empty calldata parameter, e.g., ``call{value: amount}("")``.
60+
`send()` and `transfer()` are deprecated and scheduled for removal.
61+
Simple ether transfers can still be performed using the [`call()`](...) function with empty payload, i.e., `call{value: <amount>}("")`.
62+
By default this forwards all the remaining gas, subject to additional limits imposed by some EVM versions
63+
(such as the [63/64th rule](https://eips.ethereum.org/EIPS/eip-150) introduced by `tangerineWhistle`).
64+
As with any external call, the `gas` call option can be used to set a lower limit.
65+
66+
While it is possible to recreate the functionality by explicitly setting the limit to the value of the stipend (2300 gas),
67+
this value no longer holds its original meaning due to changing opcode costs.
68+
It is recommended to use different means to protect against reentrancy.
6369

6470
.. index:: blockhash, blobhash, block, block;basefee, block;blobbasefee, block;chainid, block;coinbase, block;difficulty, block;gaslimit, block;number, block;prevrandao, block;timestamp
6571
.. index:: gasleft, msg;data, msg;sender, msg;sig, msg;value, tx;gasprice, tx;origin

docs/contracts/functions.rst

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,15 @@ will consume more gas than the 2300 gas stipend:
311311
- Sending Ether
312312

313313
.. warning::
314-
``send`` and ``transfer`` are deprecated and scheduled.
315-
Use the :ref:`call function <address_call_functions>` with an optionally provided maximum amount of
316-
gas (default forwards all remaining gas) and an empty calldata parameter, e.g., ``call{value: amount}("")``.
314+
`send()` and `transfer()` are deprecated and scheduled for removal.
315+
Simple ether transfers can still be performed using the [`call()`](...) function with empty payload, i.e., `call{value: <amount>}("")`.
316+
By default this forwards all the remaining gas, subject to additional limits imposed by some EVM versions
317+
(such as the [63/64th rule](https://eips.ethereum.org/EIPS/eip-150) introduced by `tangerineWhistle`).
318+
As with any external call, the `gas` call option can be used to set a lower limit.
319+
320+
While it is possible to recreate the functionality by explicitly setting the limit to the value of the stipend (2300 gas),
321+
this value no longer holds its original meaning due to changing opcode costs.
322+
It is recommended to use different means to protect against reentrancy.
317323

318324
.. warning::
319325
When Ether is sent directly to a contract (without a function call, i.e. sender uses ``send`` or ``transfer``)

docs/security-considerations.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,9 @@ Sending and Receiving Ether
160160
(for example in the "details" section in Remix).
161161

162162
- There is a way to forward more gas to the receiving contract using ``addr.call{value: x}("")``.
163-
This is essentially the same as ``addr.transfer(x)``, only that it forwards all remaining gas
164-
and opens up the ability for the recipient to perform more expensive actions
163+
This is essentially the same as ``addr.transfer(x)``, only that it forwards all remaining gas,
164+
subject to additional limits imposed by some EVM versions (such as the [63/64th rule](https://eips.ethereum.org/EIPS/eip-150)
165+
introduced by `tangerineWhistle`), and opens up the ability for the recipient to perform more expensive actions
165166
(and it returns a failure code instead of automatically propagating the error).
166167
This might include calling back into the sending contract or other state changes you might not have thought of.
167168
So it allows for great flexibility for honest users but also for malicious actors.

docs/types/value-types.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,9 @@ For a quick reference of all members of address, see :ref:`address_related`.
264264
.. warning::
265265
``transfer`` is deprecated and scheduled for removal.
266266
Use the :ref:`call function <address_call_functions>` with an optionally provided maximum amount of
267-
gas (default forwards all remaining gas) and an empty calldata parameter, e.g., ``call{value: amount}("")``.
267+
gas and an empty calldata parameter, e.g., ``call{value: amount}("")``.
268+
By default forwards all remaining gas, subject to additional limits imposed by some EVM versions (such as the [63/64th rule](https://eips.ethereum.org/EIPS/eip-150) introduced by `tangerineWhistle`).
269+
As with any external call, the `gas` call option can be used to set a lower limit.
268270

269271
* ``send``
270272

@@ -279,7 +281,9 @@ For a quick reference of all members of address, see :ref:`address_related`.
279281
.. warning::
280282
``send`` is deprecated and scheduled for removal.
281283
Use the :ref:`call function <address_call_functions>` with an optionally provided maximum amount of
282-
gas (default forwards all remaining gas) and an empty calldata parameter, e.g., ``call{value: amount}("")``.
284+
gas and an empty calldata parameter, e.g., ``call{value: amount}("")``.
285+
By default forwards all remaining gas, subject to additional limits imposed by some EVM versions (such as the [63/64th rule](https://eips.ethereum.org/EIPS/eip-150) introduced by `tangerineWhistle`).
286+
As with any external call, the `gas` call option can be used to set a lower limit.
283287

284288
.. _address_call_functions:
285289

docs/units-and-global-variables.rst

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,19 +269,27 @@ Members of Address Types
269269
send given amount of Wei to :ref:`address`, returns ``false`` on failure, forwards 2300 gas stipend, not adjustable
270270

271271
.. warning::
272-
``send`` and ``transfer`` are deprecated and scheduled for removal.
273-
Use the :ref:`call function <address_call_functions>` with an optionally provided maximum amount of
274-
gas (default forwards all remaining gas) and an empty calldata parameter, e.g., ``call{value: amount}("")``.
272+
`send()` and `transfer()` are deprecated and scheduled for removal.
273+
Simple ether transfers can still be performed using the [`call()`](...) function with empty payload, i.e., `call{value: <amount>}("")`.
274+
By default this forwards all the remaining gas, subject to additional limits imposed by some EVM versions (such as the [63/64th rule](https://eips.ethereum.org/EIPS/eip-150) introduced by `tangerineWhistle`).
275+
As with any external call, the `gas` call option can be used to set a lower limit.
276+
277+
While it is possible to recreate the functionality by explicitly setting the limit to the value of the stipend (2300 gas), this value no longer holds its original meaning due to changing opcode costs.
278+
It is recommended to use different means to protect against reentrancy.
275279

276280
``<address>.call(bytes memory) returns (bool, bytes memory)``
277-
issue low-level ``CALL`` with the given payload, returns success condition and return data, forwards all available gas, adjustable
281+
issue low-level ``CALL`` with the given payload, returns success condition and return data, forwards all available gas, adjustable
278282

279283
``<address>.delegatecall(bytes memory) returns (bool, bytes memory)``
280284
issue low-level ``DELEGATECALL`` with the given payload, returns success condition and return data, forwards all available gas, adjustable
281285

282286
``<address>.staticcall(bytes memory) returns (bool, bytes memory)``
283287
issue low-level ``STATICCALL`` with the given payload, returns success condition and return data, forwards all available gas, adjustable
284288

289+
Note that functions ``send``, ``transfer``, ``delegatecall`` and ``staticcall`` gas forwarding is subject to limits
290+
imposed by some EVM versions such as the [63/64th rule](https://eips.ethereum.org/EIPS/eip-150) introduced by `tangerineWhistle`))
291+
As with any external call, the `gas` call option can be used to set a lower limit.
292+
285293
For more information, see the section on :ref:`address`.
286294

287295
.. warning::

0 commit comments

Comments
 (0)