-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: use medusa instead of echidna (#87)
- Loading branch information
1 parent
0db7d79
commit c3b80dd
Showing
11 changed files
with
163 additions
and
81 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
{ | ||
"fuzzing": { | ||
"workers": 10, | ||
"workerResetLimit": 50, | ||
"timeout": 0, | ||
"testLimit": 0, | ||
"shrinkLimit": 5000, | ||
"callSequenceLength": 100, | ||
"corpusDirectory": "", | ||
"coverageEnabled": true, | ||
"coverageFormats": [ | ||
"html", | ||
"lcov" | ||
], | ||
"targetContracts": ["FuzzTest"], | ||
"predeployedContracts": {}, | ||
"targetContractsBalances": [], | ||
"constructorArgs": {}, | ||
"deployerAddress": "0x30000", | ||
"senderAddresses": [ | ||
"0x10000", | ||
"0x20000", | ||
"0x30000" | ||
], | ||
"blockNumberDelayMax": 60480, | ||
"blockTimestampDelayMax": 604800, | ||
"blockGasLimit": 125000000, | ||
"transactionGasLimit": 12500000, | ||
"testing": { | ||
"stopOnFailedTest": true, | ||
"stopOnFailedContractMatching": false, | ||
"stopOnNoTests": true, | ||
"testAllContracts": false, | ||
"traceAll": false, | ||
"assertionTesting": { | ||
"enabled": true, | ||
"testViewMethods": true, | ||
"panicCodeConfig": { | ||
"failOnCompilerInsertedPanic": false, | ||
"failOnAssertion": true, | ||
"failOnArithmeticUnderflow": false, | ||
"failOnDivideByZero": false, | ||
"failOnEnumTypeConversionOutOfBounds": false, | ||
"failOnIncorrectStorageAccess": false, | ||
"failOnPopEmptyArray": false, | ||
"failOnOutOfBoundsArrayAccess": false, | ||
"failOnAllocateTooMuchMemory": false, | ||
"failOnCallUninitializedVariable": false | ||
} | ||
}, | ||
"propertyTesting": { | ||
"enabled": false, | ||
"testPrefixes": [ | ||
"property_" | ||
] | ||
}, | ||
"optimizationTesting": { | ||
"enabled": false, | ||
"testPrefixes": [ | ||
"optimize_" | ||
] | ||
}, | ||
"targetFunctionSignatures": [], | ||
"excludeFunctionSignatures": [] | ||
}, | ||
"chainConfig": { | ||
"codeSizeCheckDisabled": true, | ||
"cheatCodes": { | ||
"cheatCodesEnabled": true, | ||
"enableFFI": false | ||
}, | ||
"skipAccountChecks": true | ||
} | ||
}, | ||
"compilation": { | ||
"platform": "crytic-compile", | ||
"platformConfig": { | ||
"target": "test/invariants/fuzz/FuzzTest.t.sol", | ||
"solcVersion": "", | ||
"exportDirectory": "", | ||
"args": [] | ||
} | ||
}, | ||
"logging": { | ||
"level": "info", | ||
"logDirectory": "", | ||
"noColor": false | ||
} | ||
} |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
| Properties | Type | | ||
|---------------------------------------------------|------------| | ||
| Greeting should never be empty | Valid state | | ||
| Only the owner can set the greeting | State transition | | ||
| Id | Properties | Type | | ||
| --- | --------------------------------------------------- | ------------ | | ||
| 1 | Greeting should never be empty | Valid state | | ||
| 2 | Only the owner can set the greeting | State transition | |
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,8 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity 0.8.23; | ||
|
||
import {GreeterGuidedHandlers} from './handlers/guided/Greeter.t.sol'; | ||
import {GreeterUnguidedHandlers} from './handlers/unguided/Greeter.t.sol'; | ||
import {GreeterProperties} from './properties/Greeter.t.sol'; | ||
|
||
contract FuzzTest is GreeterGuidedHandlers, GreeterUnguidedHandlers, GreeterProperties {} |
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity 0.8.23; | ||
|
||
import {GreeterSetup} from '../../setup/Greeter.t.sol'; | ||
|
||
contract GreeterGuidedHandlers is GreeterSetup { | ||
function handler_setGreeting(string memory _newGreeting) external { | ||
// no need to prank since this contract deployed the greeter and is therefore its owner | ||
try _targetContract.setGreeting(_newGreeting) { | ||
assert(keccak256(bytes(_targetContract.greeting())) == keccak256(bytes(_newGreeting))); | ||
} catch { | ||
assert(keccak256(bytes(_newGreeting)) == keccak256('')); | ||
} | ||
} | ||
} |
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,18 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity 0.8.23; | ||
|
||
import {GreeterSetup} from '../../setup/Greeter.t.sol'; | ||
|
||
contract GreeterUnguidedHandlers is GreeterSetup { | ||
/// @custom:property-id 2 | ||
/// @custom:property Only the owner can set the greeting | ||
function handler_setGreeting(address _caller, string memory _newGreeting) external { | ||
vm.prank(_caller); | ||
try _targetContract.setGreeting(_newGreeting) { | ||
assert(keccak256(bytes(_targetContract.greeting())) == keccak256(bytes(_newGreeting))); | ||
assert(_caller == _targetContract.OWNER()); | ||
} catch { | ||
assert(_caller != _targetContract.OWNER() || keccak256(bytes(_newGreeting)) == keccak256('')); | ||
} | ||
} | ||
} |
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,12 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity 0.8.23; | ||
|
||
import {GreeterSetup} from '../setup/Greeter.t.sol'; | ||
|
||
contract GreeterProperties is GreeterSetup { | ||
/// @custom:property-id 1 | ||
/// @custom:property Greeting should never be empty | ||
function property_greetingIsNeverEmpty() external view { | ||
assert(keccak256(bytes(_targetContract.greeting())) != keccak256('')); | ||
} | ||
} |
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,13 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity 0.8.23; | ||
|
||
import {Greeter, IERC20} from 'contracts/Greeter.sol'; | ||
import {CommonBase} from 'forge-std/Base.sol'; | ||
|
||
contract GreeterSetup is CommonBase { | ||
Greeter internal _targetContract; | ||
|
||
constructor() { | ||
_targetContract = new Greeter('a', IERC20(address(1))); | ||
} | ||
} |