Skip to content

Commit 39228fc

Browse files
committed
Merge branch 'master' into guide-to-arithmetic-checks
2 parents 838d9f4 + 21031b5 commit 39228fc

37 files changed

+122
-78
lines changed

.github/workflows/deploy.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ on:
33
push:
44
branches:
55
- master
6+
ignore-paths:
7+
- "**.rs"
8+
- "**.py"
9+
- "**.sol"
610
workflow_dispatch:
711

812
jobs:

.github/workflows/echidna.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1-
name: Echidna
1+
name: Run Echidna tests
22

33
on:
44
push:
5-
paths-ignore:
6-
- "**.md"
7-
- "**.rs"
8-
- "**.py"
5+
paths:
6+
- ".github/workflows/echidna.yml"
7+
- "program-analysis/echidna/**/*.sol"
8+
- "program-analysis/echidna/**/*.yml"
99
branches:
1010
- master
11-
- dev
1211
pull_request:
12+
paths:
13+
- ".github/workflows/echidna.yml"
14+
- "program-analysis/echidna/**/*.sol"
15+
- "program-analysis/echidna/**/*.yml"
1316
schedule:
1417
# run CI every day even if no PRs/merges occur
1518
- cron: "0 12 * * *"

.github/workflows/lint_links.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@ on:
44
push:
55
branches:
66
- master
7+
paths:
8+
- ".github/workflows/lint_links.yml"
9+
- "**.md"
710
pull_request:
11+
paths:
12+
- ".github/workflows/lint_links.yml"
13+
- "**.md"
814
schedule:
915
# run CI at 09:00, on day 1 of the month even if no PRs/merges occur
1016
- cron: "0 9 1 * *"

.github/workflows/manticore.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Run Manticore tests
2+
3+
on:
4+
push:
5+
paths:
6+
- ".github/workflows/manticore.yml"
7+
- "program-analysis/manticore/**/*.py"
8+
branches:
9+
- master
10+
pull_request:
11+
paths:
12+
- ".github/workflows/manticore.yml"
13+
- "program-analysis/manticore/**/*.py"
14+
schedule:
15+
# run CI every day even if no PRs/merges occur
16+
- cron: "0 12 * * *"
17+
18+
jobs:
19+
tests:
20+
runs-on: ubuntu-22.04
21+
strategy:
22+
fail-fast: false
23+
steps:
24+
- uses: actions/checkout@v3
25+
- name: Set up Python 3.8
26+
uses: actions/setup-python@v4
27+
with:
28+
python-version: 3.8
29+
- name: Install dependencies
30+
run: |
31+
pip install solc-select
32+
solc-select install 0.5.11
33+
solc-select use 0.5.11
34+
- name: Run Tests
35+
run: |
36+
bash program-analysis/manticore/scripts/gh_action_test.sh
Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
name: CI
1+
name: Run Slither tests
22

33
on:
44
push:
5-
paths-ignore:
6-
- "**.md"
5+
paths:
6+
- ".github/workflows/slither.yml"
7+
- "program-analysis/slither/**/*.py"
78
branches:
89
- master
9-
- dev
1010
pull_request:
11+
paths:
12+
- ".github/workflows/slither.yml"
13+
- "program-analysis/slither/**/*.py"
1114
schedule:
1215
# run CI every day even if no PRs/merges occur
1316
- cron: "0 12 * * *"
@@ -17,8 +20,6 @@ jobs:
1720
runs-on: ubuntu-22.04
1821
strategy:
1922
fail-fast: false
20-
matrix:
21-
type: ["slither", "manticore"]
2223
steps:
2324
- uses: actions/checkout@v3
2425
- name: Set up Python 3.8
@@ -31,7 +32,5 @@ jobs:
3132
solc-select install 0.5.11
3233
solc-select use 0.5.11
3334
- name: Run Tests
34-
env:
35-
TEST_TYPE: ${{ matrix.type }}
3635
run: |
37-
bash program-analysis/${TEST_TYPE}/scripts/gh_action_test.sh
36+
bash program-analysis/slither/scripts/gh_action_test.sh

book

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit 37c09c38519ae5ed1835632926fffb00ef05c830
1+
Subproject commit 150b745c2d1263673a8c74aa6c6e7ec8dde8f2c8

not-so-smart-contracts/substrate/arithmetic_overflow/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Arithmetic overflow in Substrate occurs when arithmetic operations are performed
44

55
# Example
66

7-
In the [`pallet-overflow`](./pallet-overflow.rs) pallet, notice that the `transfer` function sets `update_sender` and `update_to` using primitive arithmetic operations.
7+
In the [`pallet-overflow`](https://github.com/crytic/building-secure-contracts/blob/master/not-so-smart-contracts/substrate/arithmetic_overflow/pallet-overflow.rs) pallet, notice that the `transfer` function sets `update_sender` and `update_to` using primitive arithmetic operations.
88

99
```rust
1010
/// Allow minting account to transfer a given balance to another account.

not-so-smart-contracts/substrate/dont_panic/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Panics occur when the node enters a state that it cannot handle and stops the pr
44

55
# Example
66

7-
In the [`pallet-dont-panic`](./pallet-dont-panic.rs) pallet, the `find_important_value` dispatchable checks to see if `useful_amounts[0]` is greater than `1_000`. If so, it sets the `ImportantVal` `StorageValue` to the value held in `useful_amounts[0]`.
7+
In the [`pallet-dont-panic`](https://github.com/crytic/building-secure-contracts/blob/master/not-so-smart-contracts/substrate/dont_panic/pallet-dont-panic.rs) pallet, the `find_important_value` dispatchable checks to see if `useful_amounts[0]` is greater than `1_000`. If so, it sets the `ImportantVal` `StorageValue` to the value held in `useful_amounts[0]`.
88

99
```rust
1010
/// Do some work

not-so-smart-contracts/substrate/origins/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Using privileged origins, like `RawOrigin::Root` or custom origins, can lead to
1818

1919
# Example
2020

21-
In the [`pallet-bad-origin`](./pallet-bad-origin.rs) pallet, there is a `set_important_val` function that should be only callable by the `ForceOrigin` _custom_ origin type. This custom origin allows the pallet to specify that only a specific account can call `set_important_val`.
21+
In the [`pallet-bad-origin`](https://github.com/crytic/building-secure-contracts/blob/master/not-so-smart-contracts/substrate/origins/pallet-bad-origin.rs) pallet, there is a `set_important_val` function that should be only callable by the `ForceOrigin` _custom_ origin type. This custom origin allows the pallet to specify that only a specific account can call `set_important_val`.
2222

2323
```rust
2424
#[pallet::call]
@@ -58,6 +58,6 @@ let sender = ensure_signed(origin)?;
5858
# References
5959

6060
- https://docs.substrate.io/main-docs/build/origins/
61-
- https://docs.substrate.io/tutorials/work-with-pallets/specify-the-origin-for-a-call/
61+
- https://docs.substrate.io/tutorials/build-application-logic/specify-the-origin-for-a-call/
6262
- https://paritytech.github.io/substrate/master/pallet_sudo/index.html#
6363
- https://paritytech.github.io/substrate/master/pallet_democracy/index.html

not-so-smart-contracts/substrate/randomness/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ A bad source of randomness can lead to a variety of exploits such as the theft o
1111

1212
# Example
1313

14-
The [`pallet-bad-lottery`](./pallet-bad-lottery.rs) pallet is a simplified "lottery" system that requires one to guess the next random number. If they guess correctly, they are the winner of the lottery.
14+
The [`pallet-bad-lottery`](https://github.com/crytic/building-secure-contracts/blob/master/not-so-smart-contracts/substrate/randomness/pallet-bad-lottery.rs) pallet is a simplified "lottery" system that requires one to guess the next random number. If they guess correctly, they are the winner of the lottery.
1515

1616
```rust
1717
#[pallet::call]

0 commit comments

Comments
 (0)