-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: disable fuzz fixtures in Solidity
- Loading branch information
Showing
9 changed files
with
115 additions
and
39 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
33 changes: 33 additions & 0 deletions
33
js/integration-tests/solidity-tests/contracts/FuzzFixture.t.sol
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,33 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.24; | ||
|
||
import "./test.sol"; | ||
import "./Vm.sol"; | ||
|
||
// Contract to be tested with overflow vulnerability | ||
contract IdentityContract { | ||
function identity(uint256 amount) view public returns(uint256) { | ||
require(amount != 7191815684697958081204101901807852913954269296144377099693178655035380638910, "Got value from fixture"); | ||
return amount; | ||
} | ||
} | ||
|
||
// Test that fuzz fixtures specified in Solidity are not supported. | ||
contract FuzzFixtureTest is DSTest { | ||
Vm constant vm = Vm(HEVM_ADDRESS); | ||
|
||
IdentityContract testDummy; | ||
|
||
uint256[] public fixtureAmount = [ | ||
// This is a random value | ||
7191815684697958081204101901807852913954269296144377099693178655035380638910 | ||
]; | ||
|
||
function setUp() public { | ||
testDummy = new IdentityContract(); | ||
} | ||
|
||
function testFuzzDummy(uint256 amount) public { | ||
assertEq(testDummy.identity(amount), amount); | ||
} | ||
} |
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