-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #253 from microsoft/shuvendu-tokens
first draft of locals in modifiers #248
- Loading branch information
Showing
7 changed files
with
110 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"recursionBound": 8, | ||
"k": 1, | ||
"main": "CorralEntry_ReentrancyGuard", | ||
"expectedResult": "Program has a potential bug: True bug" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
pragma solidity ^0.5.0; | ||
|
||
contract ReentrancyGuard { | ||
/// @dev counter to allow mutex lock with only one SSTORE operation | ||
uint256 private _guardCounter; | ||
|
||
constructor () internal { | ||
// The counter starts at one to prevent changing it from zero to a non-zero | ||
// value, which is a more expensive operation. | ||
_guardCounter = 1; | ||
} | ||
|
||
function foo() public checkIncrement() { | ||
_guardCounter += 1; | ||
} | ||
|
||
modifier checkIncrement() { | ||
uint256 localCounter = _guardCounter; | ||
int x = 5; | ||
_; | ||
int y = 10; | ||
assert(localCounter != _guardCounter - 1); // should fail | ||
assert (x == y - 5); | ||
} | ||
} |