Skip to content

Commit 33fe787

Browse files
authored
Merge pull request #218 from crytic/reorder
Reorder file
2 parents 05a6d3a + d695945 commit 33fe787

36 files changed

+370
-343
lines changed

SUMMARY.md

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -68,35 +68,36 @@
6868

6969
- [Program Analysis](./program-analysis/README.md)
7070
- [Echidna](./program-analysis/echidna/README.md)
71-
- [Introduction]()
72-
- [Introduction to fuzzing](./program-analysis/echidna/fuzzing-introduction.md)
73-
- [How to test a property](./program-analysis/echidna/how-to-test-a-property.md)
74-
- [Basic]()
75-
- [How to select the most suitable testing mode](./program-analysis/echidna/testing-modes.md)
76-
- [How to select the best testing approach](./program-analysis/echidna/common-testing-approaches.md)
77-
- [How to filter functions](./program-analysis/echidna/filtering-functions.md)
78-
- [How to test assertions](./program-analysis/echidna/assertion-checking.md)
79-
- [How to write good properties step by step](./program-analysis/echidna/property-creation.md)
80-
- [Frequently Asked Questions](./program-analysis/echidna/frequently_asked_questions.md)
81-
- [Advanced]()
82-
- [How to collect a corpus](./program-analysis/echidna/collecting-a-corpus.md)
83-
- [How to use optimization mode](./program-analysis/echidna/optimization_mode.md)
84-
- [How to detect high gas consumption](./program-analysis/echidna/finding-transactions-with-high-gas-consumption.md)
85-
- [How to perform smart contract fuzzing at a large scale](./program-analysis/echidna/smart-contract-fuzzing-at-scale.md)
71+
- [Introduction](./program-analysis/echidna/introduction/README.md)
72+
- [Introduction to fuzzing](./program-analysis/echidna/introduction/fuzzing-introduction.md)
73+
- [How to test a property](./program-analysis/echidna/introduction/how-to-test-a-property.md)
74+
- [Basic](./program-analysis/echidna/basic/README.md)
75+
- [How to select the most suitable testing mode](./program-analysis/echidna/basic/testing-modes.md)
76+
- [How to select the best testing approach](./program-analysis/echidna/basic/common-testing-approaches.md)
77+
- [How to filter functions](./program-analysis/echidna/basic/filtering-functions.md)
78+
- [How to test assertions](./program-analysis/echidna/basic/assertion-checking.md)
79+
- [How to write good properties step by step](./program-analysis/echidna/basic/property-creation.md)
80+
- [Advanced](./program-analysis/echidna/advanced/README.md)
81+
- [How to collect a corpus](./program-analysis/echidna/advanced/collecting-a-corpus.md)
82+
- [How to use optimization mode](./program-analysis/echidna/advanced/optimization_mode.md)
83+
- [How to detect high gas consumption](./program-analysis/echidna/advanced/finding-transactions-with-high-gas-consumption.md)
84+
- [How to perform smart contract fuzzing at a large scale](./program-analysis/echidna/advanced/smart-contract-fuzzing-at-scale.md)
8685

87-
- [How to test bytecode-only contracts](./program-analysis/echidna/testing-bytecode.md)
88-
- [How to use hevm cheats to test permit](./program-analysis/echidna/hevm-cheats-to-test-permit.md)
89-
- [How to seed Echidna with unit tests](./program-analysis/echidna/end-to-end-testing.md)
90-
- [Understanding and using `multi-abi`](./program-analysis/echidna/using-multi-abi.md)
91-
- [Fuzzing tips](./program-analysis/echidna/fuzzing_tips.md)
92-
- [Exercises]()
93-
- [Exercise 1](./program-analysis/echidna/Exercise-2.md)
94-
- [Exercise 3](./program-analysis/echidna/Exercise-3.md)
95-
- [Exercise 4](./program-analysis/echidna/Exercise-4.md)
96-
- [Exercise 5](./program-analysis/echidna/Exercise-5.md)
97-
- [Exercise 6](./program-analysis/echidna/Exercise-6.md)
98-
- [Exercise 7](./program-analysis/echidna/Exercise-7.md)
99-
- [Exercise 8](./program-analysis/echidna/Exercise-8.md)
86+
- [How to test bytecode-only contracts](./program-analysis/echidna/advanced/testing-bytecode.md)
87+
- [How to use hevm cheats to test permit](./program-analysis/echidna/advanced/hevm-cheats-to-test-permit.md)
88+
- [How to seed Echidna with unit tests](./program-analysis/echidna/advanced/end-to-end-testing.md)
89+
- [Understanding and using `multi-abi`](./program-analysis/echidna/advanced/using-multi-abi.md)
90+
- [Fuzzing tips](./program-analysis/echidna/fuzzing_tips.md)
91+
- [Frequently Asked Questions](./program-analysis/echidna/frequently_asked_questions.md)
92+
- [Exercises](./program-analysis/echidna/exercises/README.md)
93+
- [Exercise 1](./program-analysis/echidna/exercises/Exercise-1.md)
94+
- [Exercise 2](./program-analysis/echidna/exercises/Exercise-2.md)
95+
- [Exercise 3](./program-analysis/echidna/exercises/Exercise-3.md)
96+
- [Exercise 4](./program-analysis/echidna/exercises/Exercise-4.md)
97+
- [Exercise 5](./program-analysis/echidna/exercises/Exercise-5.md)
98+
- [Exercise 6](./program-analysis/echidna/exercises/Exercise-6.md)
99+
- [Exercise 7](./program-analysis/echidna/exercises/Exercise-7.md)
100+
- [Exercise 8](./program-analysis/echidna/exercises/Exercise-8.md)
100101

101102
- [Manticore](./program-analysis/manticore/README.md)
102103
- [Introduction to symbolic execution](./program-analysis/manticore/symbolic-execution-introduction.md):
@@ -109,6 +110,8 @@
109110
- [Exercise 2](./program-analysis/manticore/exercises/exercise2.md)
110111

111112
- [Slither](./program-analysis/slither/README.md)
113+
- [Static Analysis](./program-analysis/slither/static_analysis.md)
114+
- [API](./program-analysis/slither/api.md)
112115
- [Exercise 1](./program-analysis/slither/exercise1.md)
113116
- [Exercise 2](./program-analysis/slither/exercise2.md)
114117

not-so-smart-contracts/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# (Not So) Smart Contracts
2+
3+
This repository contains examples of common smart contract vulnerabilities, including code from real smart contracts. Use Not So Smart Contracts to learn about vulnerabilities, as a reference when performing security reviews, and as a benchmark for security and analysis tools:
4+
5+
- [Algorand](./algorand/README.md)
6+
- [Cairo](./cairo/README.md)
7+
- [Cosmos](./cosmos/README.md)
8+
- [Solana](./solana/README.md)
9+
- [Substrate](./substrate/README.md)

program-analysis/echidna/README.md

Lines changed: 6 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -6,68 +6,12 @@ Watch our [Fuzzing workshop](https://www.youtube.com/watch?v=QofNQxW_K08&list=PL
66

77
**Table of contents:**
88

9-
- Introduction
10-
- [Installation](#installation)
11-
- [Introduction to fuzzing](./fuzzing-introduction.md): Brief introduction to fuzzing
12-
- [How to test a property](./how-to-test-a-property.md): How to test a property with Echidna
13-
- Basic
14-
- [How to select the most suitable testing mode](./testing-modes.md): How to select the most suitable testing mode
15-
- [How to select the best testing approach](./common-testing-approaches.md): How to select the best testing approach
16-
- [How to filter functions](./filtering-functions.md): How to filters the functions to be fuzzed
17-
- [How to test assertions](./assertion-checking.md): How to test assertions with Echidna
18-
- [How to write good properties step by step](./property-creation.md): How to iteratively improve property testing
19-
- [Frequently Asked Questions](./frequently_asked_questions.md): Answers to common questions about Echidna
20-
- Advanced
21-
- [How to collect a corpus](./collecting-a-corpus.md): How to use Echidna to collect a corpus of transactions
22-
- [How to use optimization mode](./optimization_mode.md): How to use Echidna to optimize a function
23-
- [How to detect high gas consumption](./finding-transactions-with-high-gas-consumption.md): How to find functions with high gas consumption.
24-
- [How to perform smart contract fuzzing at a large scale](./smart-contract-fuzzing-at-scale.md): How to use Echidna to run a long fuzzing campaign for complex smart contracts.
25-
- [How to test a library](https://blog.trailofbits.com/2020/08/17/using-echidna-to-test-a-smart-contract-library/): How Echidna was used to test the library in Set Protocol (blogpost)
26-
- [How to test bytecode-only contracts](./testing-bytecode.md): How to fuzz a contract without bytecode or to perform differential fuzzing between Solidity and Vyper
27-
- [How to use hevm cheats to test permit](./hevm-cheats-to-test-permit.md): How to test code that depends on ecrecover signatures using hevm cheat codes
28-
- [How to seed Echidna with unit tests](./end-to-end-testing.md): How to use existing unit tests to seed Echidna
29-
- [Understanding and using `multi-abi`](./using-multi-abi.md): What is `multi-abi` testing, and how can it be used
30-
- [Fuzzing tips](./fuzzing_tips.md): General fuzzing tips
31-
- Exercises
32-
- [Exercise 1](./Exercise-1.md): Testing token balances
33-
- [Exercise 2](./Exercise-2.md): Testing access control
34-
- [Exercise 3](./Exercise-3.md): Testing with custom initialization
35-
- [Exercise 4](./Exercise-4.md): Testing with `assert`
36-
- [Exercise 5](./Exercise-5.md): Solving Damn Vulnerable DeFi - Naive Receiver
37-
- [Exercise 6](./Exercise-6.md): Solving Damn Vulnerable DeFi - Unstoppable
38-
- [Exercise 7](./Exercise-7.md): Solving Damn Vulnerable DeFi - Side Entrance
39-
- [Exercise 8](./Exercise-8.md): Solving Damn Vulnerable DeFi - The Rewarder
9+
- [Introduction](./introduction/README.md): Introductory material to fuzzing and Echidna
10+
- [Basic](./basic/README.md): Learn the first steps on how to use Echidna
11+
- [Advanced](./advanced/README.md): Learn advanced features of Echidna
12+
- [Fuzzing tips](./fuzzing_tips.md): General fuzzing tips
13+
- [Frequently Asked Questions](./frequently_asked_questions.md): Answers to common questions about Echidna
14+
- [Exercises](./exercises/README.md): Exercises
4015

4116
Join the team on Slack at: https://empireslacking.herokuapp.com/ #ethereum
4217

43-
## Installation
44-
45-
Echidna can be installed through docker or using the pre-compiled binary.
46-
47-
### MacOS
48-
49-
You can install Echidna with `brew install echidna`.
50-
51-
### Echidna through docker
52-
53-
```bash
54-
docker pull trailofbits/eth-security-toolbox
55-
docker run -it -v "$PWD":/home/training trailofbits/eth-security-toolbox
56-
```
57-
58-
*The last command runs eth-security-toolbox in a docker container that has access to your current directory. You can change the files from your host and run the tools on the files through the container*
59-
60-
Inside docker, run :
61-
62-
```bash
63-
solc-select use 0.5.11
64-
cd /home/training
65-
```
66-
67-
### Binary
68-
69-
Check for the lastest released binary here:
70-
71-
[https://github.com/crytic/echidna/releases/latest](https://github.com/crytic/echidna/releases/latest)
72-
73-
The solc version is important to ensure that these exercises work as expected, we tested them using version 0.5.11.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Advanced
2+
3+
- [How to collect a corpus](./collecting-a-corpus.md): How to use Echidna to collect a corpus of transactions
4+
- [How to use optimization mode](./optimization_mode.md): How to use Echidna to optimize a function
5+
- [How to detect high gas consumption](./finding-transactions-with-high-gas-consumption.md): How to find functions with high gas consumption.
6+
- [How to perform smart contract fuzzing at a large scale](./smart-contract-fuzzing-at-scale.md): How to use Echidna to run a long fuzzing campaign for complex smart contracts.
7+
- [How to test a library](https://blog.trailofbits.com/2020/08/17/using-echidna-to-test-a-smart-contract-library/): How Echidna was used to test the library in Set Protocol (blogpost)
8+
- [How to test bytecode-only contracts](./testing-bytecode.md): How to fuzz a contract without bytecode or to perform differential fuzzing between Solidity and Vyper
9+
- [How to use hevm cheats to test permit](./hevm-cheats-to-test-permit.md): How to test code that depends on ecrecover signatures using hevm cheat codes
10+
- [How to seed Echidna with unit tests](./end-to-end-testing.md): How to use existing unit tests to seed Echidna
11+
- [Understanding and using `multi-abi`](./using-multi-abi.md): What is `multi-abi` testing, and how can it be used

program-analysis/echidna/collecting-a-corpus.md renamed to program-analysis/echidna/advanced/collecting-a-corpus.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22

33
**Table of contents:**
44

5-
- [Introduction](#introduction)
6-
- [Collecting a corpus](#collecting-a-corpus)
7-
- [Seeding a corpus](#seeding-a-corpus)
5+
- [Collecting, visualizing and modifying an Echidna corpus](#collecting-visualizing-and-modifying-an-echidna-corpus)
6+
- [Introduction](#introduction)
7+
- [Collecting a corpus](#collecting-a-corpus)
8+
- [Seeding a corpus](#seeding-a-corpus)
89

910
## Introduction
1011

11-
We will see how to collect and use a corpus of transactions with Echidna. The target is the following smart contract (*[example/magic.sol](./example/magic.sol)*):
12+
We will see how to collect and use a corpus of transactions with Echidna. The target is the following smart contract (*[../example/magic.sol](../example/magic.sol)*):
1213

1314
```Solidity
1415
contract C {
File renamed without changes.

program-analysis/echidna/finding-transactions-with-high-gas-consumption.md renamed to program-analysis/echidna/advanced/finding-transactions-with-high-gas-consumption.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22

33
**Table of contents:**
44

5-
- [Introduction](#introduction)
6-
- [Measuring Gas Consumption](#measuring-gas-consumption)
5+
- [Finding transactions with high gas consumption](#finding-transactions-with-high-gas-consumption)
6+
- [Introduction](#introduction)
7+
- [Measuring Gas Consumption](#measuring-gas-consumption)
78
- [Run Echidna](#run-echidna)
89
- [Filtering Out Gas-Reducing Calls](#filtering-out-gas-reducing-calls)
9-
- [Summary: Finding transactions with high gas consumption](#summary-finding-transactions-with-high-gas-consumption)
10+
- [Summary: Finding transactions with high gas consumption](#summary-finding-transactions-with-high-gas-consumption)
1011

1112
## Introduction
1213

13-
We will see how to find the transactions with high gas consumption with Echidna. The target is the following smart contract (*[example/gas.sol](./example/gas.sol)*):
14+
We will see how to find the transactions with high gas consumption with Echidna. The target is the following smart contract (*[../example/gas.sol](../example/gas.sol)*):
1415

1516
```solidity
1617
contract C {
@@ -49,7 +50,7 @@ Seed: 2320549945714142710
4950

5051
## Measuring Gas Consumption
5152

52-
To enable Echidna's gas consumption feature, create a configuration file [`config.yaml`](./example/gas.yaml):
53+
To enable Echidna's gas consumption feature, create a configuration file [`../example/gas.yaml`](../example/gas.yaml):
5354

5455
```yaml
5556
estimateGas: true
@@ -85,10 +86,10 @@ Seed: -325611019680165325
8586
8687
# Filtering Out Gas-Reducing Calls
8788
88-
The tutorial on [filtering functions to call during a fuzzing campaign](./filtering-functions.md) shows how to
89+
The tutorial on [filtering functions to call during a fuzzing campaign](../basic/filtering-functions.md) shows how to
8990
remove some functions during testing.
9091
This can be critical for getting an accurate gas estimate.
91-
Consider the following example (*[example/pushpop.sol](./example/pushpop.sol)*):
92+
Consider the following example (*[example/pushpop.sol](../example/pushpop.sol)*):
9293
9394
```solidity
9495
contract C {
@@ -113,7 +114,7 @@ contract C {
113114
}
114115
}
115116
```
116-
If Echidna uses this [`config.yaml`](./example/pushpop.yaml), it can call all functions and won't easily find transactions with high gas cost:
117+
If Echidna uses this [`config.yaml`](../example/pushpop.yaml), it can call all functions and won't easily find transactions with high gas cost:
117118

118119
```
119120
$ echidna-test pushpop.sol --config config.yaml
@@ -128,7 +129,7 @@ push used a maximum of 40839 gas
128129
```
129130

130131
That's because the cost depends on the size of `addrs` and random calls tend to leave the array almost empty.
131-
Blacklisting `pop` and `clear`, however, gives us much better results (*[example/blacklistpushpop.yaml](./example/blacklistpushpop.yaml)*):
132+
Blacklisting `pop` and `clear`, however, gives us much better results (*[../example/blacklistpushpop.yaml](../example/blacklistpushpop.yaml)*):
132133

133134
```yaml
134135
estimateGas: true

program-analysis/echidna/hevm-cheats-to-test-permit.md renamed to program-analysis/echidna/advanced/hevm-cheats-to-test-permit.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,4 @@ First we will call `permit()` on our Mock ERC20 token with the signature generat
4343

4444
## Code
4545

46-
The full example code can be found [here](example/TestDepositWithPermit.sol).
46+
The full example code can be found [here](../example/TestDepositWithPermit.sol).

program-analysis/echidna/optimization_mode.md renamed to program-analysis/echidna/advanced/optimization_mode.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
**Table of contents:**
44

5-
- [Introduction](#introduction)
6-
- [Optimizing with Echidna](#optimizing-with-echidna)
5+
- [Using optimization mode to find local maximums](#using-optimization-mode-to-find-local-maximums)
6+
- [Introduction](#introduction)
7+
- [Optimizing with Echidna](#optimizing-with-echidna)
78

89
## Introduction
910

@@ -22,7 +23,7 @@ and returns a `int256`. Echidna will try find a sequence of transactions to maxi
2223

2324
## Optimizing with Echidna
2425

25-
In this example, the target is the following smart contract (*[example/opt.sol](./example/opt.sol)*):
26+
In this example, the target is the following smart contract (*[../example/opt.sol](../example/opt.sol)*):
2627

2728
```solidity
2829
contract TestDutchAuctionOptimization {
File renamed without changes.

0 commit comments

Comments
 (0)