Skip to content

Commit

Permalink
expand the motivation a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
charles-cooper committed May 25, 2023
1 parent 6791956 commit 34a9fe0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion EIPS/eip-5920.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ This EIP introduces a new opcode, `PAY`, taking two stack parameters, `addr` and

## Motivation

Currently, to send ether to an address requires you to call a function of that address, which has a few issues. First of all, it opens a reentrancy attack vector, as the recipient can call back into the sender. Secondly, it opens a DoS vector, so parent functions must be cognizant of the possibility that the recipient will run out of gas or revert. Finally, the `CALL` opcode is needlessly expensive for simple ether transfers, as it requires the memory and stack to be expanded, the recipient's full data including code and memory to be loaded, and finally needs to execute a call, which might do other unintentional operations. Having a dedicated opcode for ether transfers solves all of these issues, and would be a useful addition to the EVM.
Currently, to send ether to an address requires you to call into that address, which transfers execution context to that address, which creates several issues:
- First of all, it opens a reentrancy attack vector, as the recipient can call back into the sender. More generally, the recipient can unilaterally execute arbitrary state changes, limited only by the gas stipend, which is not desirable from the point of view of the sender.
- Secondly, it opens a DoS vector. Contracts which want to send ether must be cognizant of the possibility that the recipient will run out of gas or revert.
- Finally, the `CALL` opcode is needlessly expensive for simple ether transfers, as it requires the memory and stack to be expanded, the recipient's full data including code and memory to be loaded, and finally needs to execute a call, which might do other unintentional operations. Having a dedicated opcode for ether transfers solves all of these issues, and would be a useful addition to the EVM.

## Specification

Expand Down

0 comments on commit 34a9fe0

Please sign in to comment.