Skip to content

Commit

Permalink
add checks effects interact pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
autistic-symposium-helper authored Aug 31, 2023
1 parent ae4b6ac commit 5fd2098
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions advanced_expert/vulnerabilities/reentrancy_attacks/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## reentrancy attacks

<br>

<p align="center">
<img src="https://github.com/go-outside-labs/blockchain-auditing/assets/138340846/8f6f4c12-2990-420d-95d6-f3d5379bc72c" width="55%" align="center" style="padding:1px;border:1px solid black;"/>
</p>
Expand Down Expand Up @@ -73,6 +74,14 @@ function withdrawBalance() public noReentrant {

#### Option 2: CEI (checks effects interaction) pattern

<br>

<p align="center">
<img src="https://github.com/go-outside-labs/blockchain-auditing/assets/138340846/8a57158e-82d8-4be2-bdf1-22faaaab97f7" width="55%" align="center" style="padding:1px;border:1px solid black;"/>
</p>

<br>

```
function withdrawBalance() public {
uint amountToWithdraw = userBalances[msg.sender];
Expand All @@ -90,6 +99,8 @@ function withdrawBalance() public {

### resources

<br>

* [reentrancy on solidity docs](https://docs.soliditylang.org/en/latest/security-considerations.html#re-entrancy)
* [reentrancy on DASP](https://www.dasp.co/#item-1)
* [reentrancy on SWC](https://swcregistry.io/docs/SWC-107)
Expand Down

0 comments on commit 5fd2098

Please sign in to comment.