Skip to content

Commit 37270eb

Browse files
authored
Add security considerations to ERC2771Forwarder (#4406)
1 parent 621b867 commit 37270eb

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

contracts/metatx/ERC2771Forwarder.sol

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,25 @@ import {Address} from "../utils/Address.sol";
2020
* * `nonce`: A unique transaction ordering identifier to avoid replayability and request invalidation.
2121
* * `deadline`: A timestamp after which the request is not executable anymore.
2222
* * `data`: Encoded `msg.data` to send with the requested call.
23+
*
24+
* Relayers are able to submit batches if they are processing a high volume of requests. With high
25+
* throughput, relayers may run into limitations of the chain such as limits on the number of
26+
* transactions in the mempool. In these cases the recommendation is to distribute the load among
27+
* multiple accounts.
28+
*
29+
* ==== Security Considerations
30+
*
31+
* If a relayer submits a forward request, it should be willing to pay up to 100% of the gas amount
32+
* specified in the request. This contract does not implement any kind of retribution for this gas,
33+
* and it is assumed that there is an out of band incentive for relayers to pay for execution on
34+
* behalf of signers. Often, the relayer is operated by a project that will consider it a user
35+
* acquisition cost.
36+
*
37+
* By offering to pay for gas, relayers are at risk of having that gas used by an attacker toward
38+
* some other purpose that is not aligned with the expected out of band incentives. If you operate a
39+
* relayer, consider whitelisting target contracts and function selectors. When relaying ERC-721 or
40+
* ERC-1155 transfers specifically, consider rejecting the use of the `data` field, since it can be
41+
* used to execute arbitrary code.
2342
*/
2443
contract ERC2771Forwarder is EIP712, Nonces {
2544
using ECDSA for bytes32;

0 commit comments

Comments
 (0)