Skip to content

Commit

Permalink
Update TransientStorage.sol
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcusWentz authored Apr 18, 2024
1 parent f40b668 commit ad88546
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Contracts/TransientStorage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ contract ReentrancyGuardTransient {
uint256 bal = balances[msg.sender];
require(bal > 0);

//REENTRANCY ATTACK VECTOR. NEED TO USE LOCK MODIFIER TO PREVENT CALLING MULTIPLE TIMES. OTHERWISE UPDATE BALANCES FIRST.
//REENTRANCY ATTACK VECTOR. NEED TO USE THE LOCK MODIFIER TO PREVENT REENTRANCY. OTHERWISE UPDATE BALANCES BEFORE SENDING ETHER.
(bool sent,) = msg.sender.call{value: bal}("");
require(sent, "Failed to send Ether");

//SHOULD UPDATE BALANCES BEFORE SENDING ETHER BUT IT PLACED AFTER TO TEST LOCK MODIFIER.
//SHOULD UPDATE BALANCES BEFORE SENDING ETHER, BUT IT PLACED AFTER TO TEST THE LOCK MODIFIER.
balances[msg.sender] = 0;
}

Expand Down

0 comments on commit ad88546

Please sign in to comment.