Skip to content

Latest commit

 

History

History
14 lines (10 loc) · 881 Bytes

12.md

File metadata and controls

14 lines (10 loc) · 881 Bytes

DoS with Failed Call

Description:

External calls can fail accidentally or deliberately, which can cause a DoS condition in the contract. To minimize the damage caused by such failures, it is better to isolate each external call into its own transaction that can be initiated by the recipient of the call. This is especially relevant for payments, where it is better to let users withdraw funds rather than push funds to them automatically (this also reduces the chance of problems with the gas limit).

Remediation

It is recommended to follow call best practices:

  1. Avoid combining multiple calls in a single transaction, especially when calls are executed as part of a loop
  2. Always assume that external calls can fail
  3. Implement the contract logic to handle failed calls

References:

https://swcregistry.io/docs/SWC-113