Skip to content

Commit

Permalink
✅ Better ReentrancyGuard test
Browse files Browse the repository at this point in the history
  • Loading branch information
transmissions11 committed May 31, 2022
1 parent 1681dc5 commit eaaccf8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ MultiRolesAuthorityTest:testSetTargetCustomAuthority() (gas: 27976)
OwnedTest:testCallFunctionAsNonOwner() (gas: 11311)
OwnedTest:testCallFunctionAsOwner() (gas: 10479)
OwnedTest:testSetOwner() (gas: 13035)
ReentrancyGuardTest:testFailUnprotectedCall() (gas: 45665)
ReentrancyGuardTest:testFailUnprotectedCall() (gas: 46167)
ReentrancyGuardTest:testNoReentrancy() (gas: 7515)
ReentrancyGuardTest:testProtectedCall() (gas: 32949)
ReentrancyGuardTest:testProtectedCall() (gas: 33470)
RolesAuthorityTest:testCanCallPublicCapability() (gas: 33336)
RolesAuthorityTest:testCanCallWithAuthorizedRole() (gas: 79601)
RolesAuthorityTest:testSetPublicCapabilities() (gas: 29183)
Expand Down
4 changes: 2 additions & 2 deletions src/test/ReentrancyGuard.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ contract RiskyContract is ReentrancyGuard {

if (enterTimes > 1) return;

protectedCall();
this.protectedCall();
}

function protectedCall() public nonReentrant {
enterTimes++;

if (enterTimes > 1) return;

protectedCall();
this.protectedCall();
}

function overprotectedCall() public nonReentrant {}
Expand Down

0 comments on commit eaaccf8

Please sign in to comment.