Skip to content

Commit 4f3ca42

Browse files
fixes in README and configs
1 parent 2dfdb56 commit 4f3ca42

File tree

3 files changed

+36
-20
lines changed

3 files changed

+36
-20
lines changed

README.md

+11-12
Original file line numberDiff line numberDiff line change
@@ -128,25 +128,18 @@ testMode: assertion
128128
testLimit: 100000
129129
deployer: "0x10000"
130130
sender: ["0x10000", "0x20000", "0x30000"]
131+
# Uncomment the following line for external testing
132+
#allContracts: true
131133
```
132134

133-
If you're using external testing, you will also need to specify:
134-
135-
```yaml
136-
allContracts: true
137-
```
138-
139-
To perform more than one test, save the files with a descriptive path, to identify what test each file or corpus belongs to. For these examples, we use `tests/crytic/erc20/echidna-internal.yaml` and `tests/crytic/erc20/echidna-external.yaml` for the Echidna tests for ERC20. We recommended to modify the `corpusDir` for external tests accordingly.
140-
141-
The above configuration will start Echidna in assertion mode. Contract will be deployed from address `0x10000`, and transactions will be sent from the owner and two different users (`0x20000` and `0x30000`). There is an initial limit of `100000` tests, but depending on the token code complexity, this can be increased. Finally, once Echidna finishes the fuzzing campaign, corpus and coverage results will be available in the `tests/crytic/erc20/echidna-corpus-internal` directory.
142-
143135
**Medusa**
144136

145137
Create the following Medusa config file:
146138

147139
```json
148140
{
149141
"fuzzing": {
142+
"testLimit": 100000,
150143
"corpusDirectory": "tests/medusa-corpus",
151144
"deployerAddress": "0x10000",
152145
"senderAddresses": [
@@ -164,6 +157,10 @@ Create the following Medusa config file:
164157
"enabled": false,
165158
},
166159
},
160+
// Uncomment the following lines for external testing
161+
// "testing": {
162+
// "testAllContracts": true
163+
// },
167164
"compilation": {
168165
"platform": "crytic-compile",
169166
"platformConfig": {
@@ -176,15 +173,17 @@ Create the following Medusa config file:
176173
}
177174
```
178175

176+
To perform more than one test, save the files with a descriptive path, to identify what test each file or corpus belongs to. For instace, for these examples, we use `tests/crytic/erc20/echidna-internal.yaml` and `tests/crytic/erc20/echidna-external.yaml` for the Echidna tests for ERC20. We recommended to modify the corpus directory config opction for external tests accordingly.
177+
178+
The above configuration will start Echidna or Medusa in assertion mode. The target contract(s) will be deployed from address `0x10000`, and transactions will be sent from the owner as well as two different users (`0x20000` and `0x30000`). There is an initial limit of `100000` tests, but depending on the token code complexity, this can be increased. Finally, once our fuzzing tools finish the fuzzing campaign, corpus and coverage results will be available in the specified corpus directory.
179+
179180
#### Run
180181

181182
**Echidna**
182183

183184
- For internal testing: `echidna . --contract CryticERC20InternalHarness --config tests/crytic/erc20/echidna-internal.yaml`
184185
- For external testing: `echidna . --contract CryticERC20ExternalHarness --config tests/crytic/erc20/echidna-external.yaml`
185186

186-
Finally, inspect the coverage report in `tests/crytic/erc20/echidna-corpus-internal` or `tests/crytic/erc20/echidna-corpus-external` when it finishes.
187-
188187
**Medusa**
189188

190189
- Go to the directory `cd tests/crytic/erc20`

tests/ERC20/foundry/medusa-config-ext.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"stopOnFailedTest": true,
2525
"stopOnFailedContractMatching": false,
2626
"stopOnNoTests": true,
27-
"testAllContracts": false,
27+
"testAllContracts": true,
2828
"traceAll": false,
2929
"assertionTesting": {
3030
"enabled": true,

tests/ERC20/hardhat/medusa-config-ext.json

+24-7
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"callSequenceLength": 100,
88
"corpusDirectory": "tests/medusa-corpus-ext",
99
"coverageEnabled": true,
10-
"deploymentOrder": [],
10+
"targetContracts": [],
11+
"targetContractsBalances": [],
1112
"constructorArgs": {},
1213
"deployerAddress": "0x10000",
1314
"senderAddresses": [
@@ -21,19 +22,30 @@
2122
"transactionGasLimit": 12500000,
2223
"testing": {
2324
"stopOnFailedTest": true,
24-
"stopOnFailedContractMatching": true,
25+
"stopOnFailedContractMatching": false,
2526
"stopOnNoTests": true,
26-
"testAllContracts": false,
27-
"onlyCallFromDeploymentOrder": false,
27+
"testAllContracts": true,
2828
"traceAll": false,
2929
"assertionTesting": {
3030
"enabled": true,
31-
"testViewMethods": false
31+
"testViewMethods": false,
32+
"panicCodeConfig": {
33+
"failOnCompilerInsertedPanic": false,
34+
"failOnAssertion": true,
35+
"failOnArithmeticUnderflow": false,
36+
"failOnDivideByZero": false,
37+
"failOnEnumTypeConversionOutOfBounds": false,
38+
"failOnIncorrectStorageAccess": false,
39+
"failOnPopEmptyArray": false,
40+
"failOnOutOfBoundsArrayAccess": false,
41+
"failOnAllocateTooMuchMemory": false,
42+
"failOnCallUninitializedVariable": false
43+
}
3244
},
3345
"propertyTesting": {
3446
"enabled": false,
3547
"testPrefixes": [
36-
"fuzz_"
48+
"property_"
3749
]
3850
},
3951
"optimizationTesting": {
@@ -59,5 +71,10 @@
5971
"exportDirectory": "",
6072
"args": []
6173
}
74+
},
75+
"logging": {
76+
"level": "info",
77+
"logDirectory": "",
78+
"noColor": false
6279
}
63-
}
80+
}

0 commit comments

Comments
 (0)