Skip to content

Commit 4bd470b

Browse files
committed
Use 0.8.0 for echidna exercises
1 parent 4ae8bd9 commit 4bd470b

File tree

18 files changed

+43
-37
lines changed

18 files changed

+43
-37
lines changed

.github/workflows/echidna.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ jobs:
167167
contract: ${{ matrix.contract }}
168168
config: ${{ matrix.config }}
169169
output-file: ${{ matrix.files }}.out
170-
solc-version: ${{ matrix.solc-version || '0.5.11' }}
170+
solc-version: ${{ matrix.solc-version || '0.8.0' }}
171171
echidna-workdir: ${{ matrix.workdir }}
172172
echidna-version: edge
173173
crytic-args: ${{ matrix.crytic-args || '' }}

program-analysis/echidna/exercises/Exercise-1.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Join the team on Slack at: https://empireslacking.herokuapp.com/ #ethereum
1515
We will test the following contract _[token.sol](https://github.com/crytic/building-secure-contracts/tree/master/program-analysis/echidna/exercises/exercise1/token.sol)_:
1616

1717
```solidity
18-
pragma solidity ^0.5.0;
18+
pragma solidity ^0.8.0;
1919
2020
contract Ownable {
2121
address public owner = msg.sender;
@@ -67,13 +67,13 @@ contract Token is Ownable, Pausable {
6767
The skeleton for this exercise is (_[template.sol](https://github.com/crytic/building-secure-contracts/tree/master/program-analysis/echidna/exercises/exercise1/template.sol)_):
6868

6969
````solidity
70-
pragma solidity ^0.5.0;
70+
pragma solidity ^0.8.0;
7171
7272
import "./token.sol";
7373
7474
/// @dev Run the template with
7575
/// ```
76-
/// solc-select use 0.5.0
76+
/// solc-select use 0.8.0
7777
/// echidna program-analysis/echidna/exercises/exercise1/template.sol
7878
/// ```
7979
contract TestToken is Token {

program-analysis/echidna/exercises/Exercise-2.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Join the team on Slack at: https://empireslacking.herokuapp.com/ #ethereum
1717
We will test the following contract _[token.sol](https://github.com/crytic/building-secure-contracts/tree/master/program-analysis/echidna/exercises/exercise2/token.sol)_:
1818

1919
```solidity
20-
pragma solidity ^0.5.0;
20+
pragma solidity ^0.8.0;
2121
2222
contract Ownable {
2323
address public owner = msg.sender;
@@ -74,7 +74,7 @@ contract Token is Ownable, Pausable {
7474
The skeleton for this exercise is (_[template.sol](https://github.com/crytic/building-secure-contracts/tree/master/program-analysis/echidna/exercises/exercise2/template.sol)_):
7575

7676
````solidity
77-
pragma solidity ^0.5.0;
77+
pragma solidity ^0.8.0;
7878
7979
import "./token.sol";
8080

program-analysis/echidna/exercises/Exercise-3.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Join the team on Slack at: https://empireslacking.herokuapp.com/ #ethereum
1717
We will test the following contract _[token.sol](https://github.com/crytic/building-secure-contracts/tree/master/program-analysis/echidna/exercises/exercise3/token.sol)_:
1818

1919
```solidity
20-
pragma solidity ^0.5.0;
20+
pragma solidity ^0.8.0;
2121
2222
/// @notice The issues from exercise 1 and 2 are fixed.
2323
@@ -66,7 +66,7 @@ contract Token is Ownable, Pausable {
6666
Consider the following extension of the token (_[mintable.sol](https://github.com/crytic/building-secure-contracts/tree/master/program-analysis/echidna/exercises/exercise3/mintable.sol)_):
6767

6868
```solidity
69-
pragma solidity ^0.5.0;
69+
pragma solidity ^0.8.0;
7070
7171
import "./token.sol";
7272
@@ -98,7 +98,7 @@ The [version of token.sol](https://github.com/crytic/building-secure-contracts/t
9898
The skeleton for this exercise is (_[template.sol](https://github.com/crytic/building-secure-contracts/tree/master/program-analysis/echidna/exercises/exercise3/template.sol)_):
9999

100100
````solidity
101-
pragma solidity ^0.5.0;
101+
pragma solidity ^0.8.0;
102102
103103
import "./mintable.sol";
104104

program-analysis/echidna/exercises/Exercise-4.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Join the team on Slack at: https://empireslacking.herokuapp.com/ #ethereum
1717
We will test the following contract _[token.sol](https://github.com/crytic/building-secure-contracts/tree/master/program-analysis/echidna/exercises/exercise4/token.sol)_:
1818

1919
```solidity
20-
pragma solidity ^0.5.0;
20+
pragma solidity ^0.8.0;
2121
2222
contract Ownable {
2323
address public owner = msg.sender;
@@ -79,13 +79,13 @@ This exercise is similar to the [first one](Exercise-1.md), but using assertions
7979
The skeleton for this exercise is (_[template.sol](https://github.com/crytic/building-secure-contracts/tree/master/program-analysis/echidna/exercises/exercise4/template.sol)_):
8080

8181
````solidity
82-
pragma solidity ^0.5.0;
82+
pragma solidity ^0.8.0;
8383
8484
import "./token.sol";
8585
8686
/// @dev Run the template with
8787
/// ```
88-
/// solc-select use 0.5.0
88+
/// solc-select use 0.8.0
8989
/// echidna program-analysis/echidna/exercises/exercise4/template.sol --contract TestToken --test-mode assertion
9090
/// ```
9191
contract TestToken is Token {

program-analysis/echidna/exercises/exercise1/solution.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// SPDX-License-Identifier: AGPL-3.0
2-
pragma solidity ^0.5.0;
2+
pragma solidity ^0.8.0;
33

44
import "./token.sol";
55

66
/// @dev Run the solution with
77
/// ```
8-
/// solc-select use 0.5.0
8+
/// solc-select use 0.8.0
99
/// echidna program-analysis/echidna/exercises/exercise1/solution.sol
1010
/// ```
1111
contract TestToken is Token {

program-analysis/echidna/exercises/exercise1/template.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// SPDX-License-Identifier: AGPL-3.0
2-
pragma solidity ^0.5.0;
2+
pragma solidity ^0.8.0;
33

44
import "./token.sol";
55

66
/// @dev Run the template with
77
/// ```
8-
/// solc-select use 0.5.0
8+
/// solc-select use 0.8.0
99
/// echidna program-analysis/echidna/exercises/exercise1/template.sol
1010
/// ```
1111
contract TestToken is Token {

program-analysis/echidna/exercises/exercise1/token.sol

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: AGPL-3.0
2-
pragma solidity ^0.5.0;
2+
pragma solidity ^0.8.0;
33

44
contract Ownable {
55
address public owner = msg.sender;
@@ -35,7 +35,10 @@ contract Token is Ownable, Pausable {
3535
mapping(address => uint256) public balances;
3636

3737
function transfer(address to, uint256 value) public whenNotPaused {
38-
balances[msg.sender] -= value;
39-
balances[to] += value;
38+
// unchecked to save gas
39+
unchecked{
40+
balances[msg.sender] -= value;
41+
balances[to] += value;
42+
}
4043
}
4144
}

program-analysis/echidna/exercises/exercise2/solution.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// SPDX-License-Identifier: AGPL-3.0
2-
pragma solidity ^0.5.0;
2+
pragma solidity ^0.8.0;
33

44
import "./token.sol";
55

66
/// @dev Run the solution with
77
/// ```
8-
/// solc-select use 0.5.0
8+
/// solc-select use 0.8.0
99
/// echidna program-analysis/echidna/exercises/exercise1/solution.sol
1010
/// ```
1111
contract TestToken is Token {

program-analysis/echidna/exercises/exercise2/template.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// SPDX-License-Identifier: AGPL-3.0
2-
pragma solidity ^0.5.0;
2+
pragma solidity ^0.8.0;
33

44
import "./token.sol";
55

66
/// @dev Run the template with
77
/// ```
8-
/// solc-select use 0.5.0
8+
/// solc-select use 0.8.0
99
/// echidna program-analysis/echidna/exercises/exercise2/template.sol
1010
/// ```
1111
contract TestToken is Token {

0 commit comments

Comments
 (0)