Skip to content

Commit 31c6312

Browse files
authored
Merge pull request #239 from 0xPhaze/fix-style
Fix inconsistent styling
2 parents 95964e6 + 7301486 commit 31c6312

File tree

149 files changed

+3667
-2727
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+3667
-2727
lines changed

.github/workflows/check_links.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ on:
88
pull_request:
99
schedule:
1010
# run CI at 09:00, on day 1 of the month even if no PRs/merges occur
11-
- cron: '0 9 1 * *'
11+
- cron: "0 9 1 * *"
1212

1313
jobs:
1414
markdown-link-check:
1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: actions/checkout@master
18-
- uses: gaurav-nelson/github-action-markdown-link-check@v1
19-
with:
20-
use-quiet-mode: 'yes'
17+
- uses: actions/checkout@master
18+
- uses: gaurav-nelson/github-action-markdown-link-check@v1
19+
with:
20+
use-quiet-mode: "yes"

.github/workflows/ci.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
pull_request:
1111
schedule:
1212
# run CI every day even if no PRs/merges occur
13-
- cron: '0 12 * * *'
13+
- cron: "0 12 * * *"
1414

1515
jobs:
1616
tests:
@@ -20,18 +20,18 @@ jobs:
2020
matrix:
2121
type: ["slither", "manticore"]
2222
steps:
23-
- uses: actions/checkout@v3
24-
- name: Set up Python 3.8
25-
uses: actions/setup-python@v4
26-
with:
27-
python-version: 3.8
28-
- name: Install dependencies
29-
run: |
30-
pip install solc-select
31-
solc-select install 0.5.11
32-
solc-select use 0.5.11
33-
- name: Run Tests
34-
env:
35-
TEST_TYPE: ${{ matrix.type }}
36-
run: |
37-
bash program-analysis/${TEST_TYPE}/scripts/gh_action_test.sh
23+
- uses: actions/checkout@v3
24+
- name: Set up Python 3.8
25+
uses: actions/setup-python@v4
26+
with:
27+
python-version: 3.8
28+
- name: Install dependencies
29+
run: |
30+
pip install solc-select
31+
solc-select install 0.5.11
32+
solc-select use 0.5.11
33+
- name: Run Tests
34+
env:
35+
TEST_TYPE: ${{ matrix.type }}
36+
run: |
37+
bash program-analysis/${TEST_TYPE}/scripts/gh_action_test.sh

.github/workflows/deploy.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@ jobs:
1515
CARGO_TERM_COLOR: always
1616

1717
steps:
18-
- uses: actions/checkout@v3
19-
with:
20-
fetch-depth: 0
21-
- name: Install mdbook
22-
run: |
23-
cargo install --git https://github.com/montyly/mdBook.git mdbook || true
24-
- name: Build artifacts
25-
run: mdbook build
26-
- name: Upload artifact
27-
uses: actions/upload-pages-artifact@v1
28-
with:
29-
path: ./book
18+
- uses: actions/checkout@v3
19+
with:
20+
fetch-depth: 0
21+
- name: Install mdbook
22+
run: |
23+
cargo install --git https://github.com/montyly/mdBook.git mdbook || true
24+
- name: Build artifacts
25+
run: mdbook build
26+
- name: Upload artifact
27+
uses: actions/upload-pages-artifact@v1
28+
with:
29+
path: ./book
3030
deploy:
3131
permissions:
3232
pages: write
@@ -39,4 +39,4 @@ jobs:
3939
steps:
4040
- name: Deploy to GitHub Pages
4141
id: deployment
42-
uses: actions/deploy-pages@v1
42+
uses: actions/deploy-pages@v1

.github/workflows/echidna.yml

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212
pull_request:
1313
schedule:
1414
# run CI every day even if no PRs/merges occur
15-
- cron: '0 12 * * *'
15+
- cron: "0 12 * * *"
1616

1717
jobs:
1818
tests:
@@ -45,7 +45,7 @@ jobs:
4545
workdir: program-analysis/echidna/exercises/exercise4/
4646
files: solution.sol
4747
config: config.yaml
48-
contract: Token
48+
contract: TestToken
4949
outcome: failure
5050
expected: 'transfer(address,uint256):\s*failed'
5151
- name: Exercise 5
@@ -83,7 +83,7 @@ jobs:
8383
files: gas.sol
8484
config: gas.yaml
8585
outcome: success
86-
expected: 'f(42,123,'
86+
expected: "f(42,123,"
8787
flaky: true
8888
- name: Multi
8989
workdir: program-analysis/echidna/example/
@@ -131,59 +131,59 @@ jobs:
131131
expected: 'test_flag_is_false():\s*failed'
132132

133133
steps:
134-
- name: Checkout repository
135-
uses: actions/checkout@v3
134+
- name: Checkout repository
135+
uses: actions/checkout@v3
136136

137-
- name: Checkout Damn Vulnerable DeFi solutions
138-
uses: actions/checkout@v3
139-
if: startsWith(matrix.workdir, 'dvdefi')
140-
with:
141-
repository: crytic/damn-vulnerable-defi-echidna
142-
ref: solutions
143-
path: ${{ matrix.workdir }}
137+
- name: Checkout Damn Vulnerable DeFi solutions
138+
uses: actions/checkout@v3
139+
if: startsWith(matrix.workdir, 'dvdefi')
140+
with:
141+
repository: crytic/damn-vulnerable-defi-echidna
142+
ref: solutions
143+
path: ${{ matrix.workdir }}
144144

145-
- name: Set up Nodejs
146-
uses: actions/setup-node@v3
147-
if: startsWith(matrix.workdir, 'dvdefi')
148-
with:
149-
node-version: 16
145+
- name: Set up Nodejs
146+
uses: actions/setup-node@v3
147+
if: startsWith(matrix.workdir, 'dvdefi')
148+
with:
149+
node-version: 16
150150

151-
- name: Install dependencies and compile
152-
if: startsWith(matrix.workdir, 'dvdefi')
153-
run: |
154-
yarn install --frozen-lockfile
155-
npx hardhat compile --force
156-
working-directory: ${{ matrix.workdir }}
151+
- name: Install dependencies and compile
152+
if: startsWith(matrix.workdir, 'dvdefi')
153+
run: |
154+
yarn install --frozen-lockfile
155+
npx hardhat compile --force
156+
working-directory: ${{ matrix.workdir }}
157157

158-
- name: Run Echidna
159-
uses: crytic/echidna-action@v2
160-
id: echidna
161-
continue-on-error: true
162-
with:
163-
files: ${{ matrix.files }}
164-
contract: ${{ matrix.contract }}
165-
config: ${{ matrix.config }}
166-
output-file: ${{ matrix.files }}.out
167-
solc-version: ${{ matrix.solc-version || '0.5.11' }}
168-
echidna-workdir: ${{ matrix.workdir }}
169-
echidna-version: edge
170-
crytic-args: ${{ matrix.crytic-args || '' }}
158+
- name: Run Echidna
159+
uses: crytic/echidna-action@v2
160+
id: echidna
161+
continue-on-error: true
162+
with:
163+
files: ${{ matrix.files }}
164+
contract: ${{ matrix.contract }}
165+
config: ${{ matrix.config }}
166+
output-file: ${{ matrix.files }}.out
167+
solc-version: ${{ matrix.solc-version || '0.5.11' }}
168+
echidna-workdir: ${{ matrix.workdir }}
169+
echidna-version: edge
170+
crytic-args: ${{ matrix.crytic-args || '' }}
171171

172-
- name: Verify that the exit code is correct
173-
run: |
174-
if [[ ${{ steps.echidna.outcome }} = ${{ matrix.outcome }} ]]; then
175-
echo "Outcome matches"
176-
else
177-
echo "Outcome mismatch. Expected ${{ matrix.outcome }} but got ${{ steps.echidna.outcome }}"
178-
exit 1
179-
fi
172+
- name: Verify that the exit code is correct
173+
run: |
174+
if [[ ${{ steps.echidna.outcome }} = ${{ matrix.outcome }} ]]; then
175+
echo "Outcome matches"
176+
else
177+
echo "Outcome mismatch. Expected ${{ matrix.outcome }} but got ${{ steps.echidna.outcome }}"
178+
exit 1
179+
fi
180180
181-
- name: Verify that the output is correct
182-
run: |
183-
if grep -q "${{ matrix.expected }}" "${{ steps.echidna.outputs.output-file }}"; then
184-
echo "Output matches"
185-
else
186-
echo "Output mismatch. Expected something matching '${{ matrix.expected }}'. Got the following:"
187-
cat "${{ steps.echidna.outputs.output-file }}"
188-
exit 1
189-
fi
181+
- name: Verify that the output is correct
182+
run: |
183+
if grep -q "${{ matrix.expected }}" "${{ steps.echidna.outputs.output-file }}"; then
184+
echo "Output matches"
185+
else
186+
echo "Output mismatch. Expected something matching '${{ matrix.expected }}'. Got the following:"
187+
cat "${{ steps.echidna.outputs.output-file }}"
188+
exit 1
189+
fi

.prettierrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"tabWidth": 2,
3+
"printWidth": 80,
4+
"embeddedLanguageFormatting": "off",
5+
"plugins": ["prettier-plugin-solidity"],
6+
"overrides":
7+
[
8+
{ "files": "*.sol", "options": { "tabWidth": 4, "printWidth": 120 } },
9+
{ "files": ["*.json", ".prettierrc"], "options": { "tabWidth": 2, "printWidth": 120, "trailingComma": "none" } }
10+
]
11+
}

CONTRIBUTING.md

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
# Contributing to Building-secure-contracts
2+
23
First, thanks for your interest in contributing to Building-secure-contracts! We welcome and appreciate all contributions, including bug reports, feature suggestions, tutorials/blog posts, and code improvements.
34

45
If you're unsure where to start, we recommend our [`good first issue`](https://github.com/crytic/building-secure-contracts/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) and [`help wanted`](https://github.com/crytic/building-secure-contracts/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) issue labels.
56

67
## Bug reports and feature suggestions
8+
79
Bug reports and feature suggestions can be submitted to our issue tracker. For bug reports, attaching the contract that caused the bug will help us in debugging and resolving the issue quickly. If you find a security vulnerability, do not open an issue; email opensource@trailofbits.com instead.
810

911
## Questions
12+
1013
Questions can be submitted to the issue tracker, but you may get a faster response if you ask in our [chat room](https://empireslacking.herokuapp.com/) (in the #ethereum channel).
1114

1215
## Code
16+
1317
building-secure-contracts uses the pull request contribution model. Please make an account on Github, fork this repo, and submit code contributions via pull request. For more documentation, look [here](https://guides.github.com/activities/forking/).
1418

1519
Some pull request guidelines:
@@ -22,6 +26,7 @@ Some pull request guidelines:
2226
## Directory Structure
2327

2428
Below is a rough outline of building-secure-contracts's structure:
29+
2530
```text
2631
.
2732
├── development-guidelnes # High-level best-practices for all smart contracts
@@ -32,30 +37,35 @@ Below is a rough outline of building-secure-contracts's structure:
3237
└── ...
3338
```
3439

35-
## Linters
40+
## Linting and formatting
3641

37-
We run [markdown-link-check](https://github.com/tcort/markdown-link-check) to ensure all the markdown links are correct.
42+
To install the formatters and linters, run:
3843

39-
To install `markdown-link-check`:
4044
```bash
41-
$ npm install -g markdown-link-check
45+
npm install
4246
```
4347

44-
To run `markdown-link-check`:
48+
The formatter is run with:
4549

4650
```bash
47-
$ find . -name \*.md -print0 | xargs -0 -n1 markdown-link-check
51+
npm run format
52+
```
53+
54+
The linter is run with:
55+
56+
```bash
57+
npm run lint
4858
```
4959

5060
## Create the book
5161

5262
We use `mdbook` to generate [secure-contracts.com](https://secure-contracts.com/).
5363

5464
To run it locally:
65+
5566
```
56-
$ cargo install --git https://github.com/montyly/mdBook.git mdbook
57-
$ mdbook build
67+
cargo install --git https://github.com/montyly/mdBook.git mdbook
68+
mdbook build
5869
```
5970

60-
6171
Note: we use https://github.com/montyly/mdBook.git, which contains https://github.com/rust-lang/mdBook/pull/1584.

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ We welcome contributions, and you can contribute by following our [contributing
1818
- [Transaction Tracing](./learn_evm/tracing.md): Helper scripts and guidance for generating and navigating transaction traces
1919
- [Yellow Paper Guidance](./learn_evm/yellow-paper.md): Symbol reference for more easily reading the Ethereum yellow paper
2020
- [Forks <> EIPs](./learn_evm/eips_forks.md): Summarize the EIPs included in each Ethereum fork
21-
- [Forks <> CIPs](./learn_evm/cips_forks.md): Summarize the CIPs and EIPs included in each Celo fork *(EVM-compatible chain)*
22-
- [Upgrades <> TIPs](./learn_evm/tips_upgrades.md): Summarize the TIPs included in each TRON upgrade *(EVM-compatible chain)*
23-
- [Forks <> BEPs](./learn_evm/beps_forks.md): Summarize the BEPs included in each BSC fork *(EVM-compatible chain)*
21+
- [Forks <> CIPs](./learn_evm/cips_forks.md): Summarize the CIPs and EIPs included in each Celo fork _(EVM-compatible chain)_
22+
- [Upgrades <> TIPs](./learn_evm/tips_upgrades.md): Summarize the TIPs included in each TRON upgrade _(EVM-compatible chain)_
23+
- [Forks <> BEPs](./learn_evm/beps_forks.md): Summarize the BEPs included in each BSC fork _(EVM-compatible chain)_
2424
- [Not so smart contracts](./not-so-smart-contracts): Examples of smart contract common issues. Each issue contains a description, an example and recommendations
25-
- [Algorand](./not-so-smart-contracts/algorand)
26-
- [Cairo](./not-so-smart-contracts/cairo)
27-
- [Cosmos](./not-so-smart-contracts/cosmos)
28-
- [Substrate](./not-so-smart-contracts/substrate)
29-
- [Solana](./not-so-smart-contracts/solana)
25+
- [Algorand](./not-so-smart-contracts/algorand)
26+
- [Cairo](./not-so-smart-contracts/cairo)
27+
- [Cosmos](./not-so-smart-contracts/cosmos)
28+
- [Substrate](./not-so-smart-contracts/substrate)
29+
- [Solana](./not-so-smart-contracts/solana)
3030
- [Program analysis](./program-analysis): How to use automated tools to secure contracts
3131
- [Echidna](./program-analysis/echidna): a fuzzer that will check your contract's properties.
3232
- [Slither](./program-analysis/slither): a static analyzer available through a CLI and scriptable interface.
@@ -35,8 +35,8 @@ We welcome contributions, and you can contribute by following our [contributing
3535
- a theoretical introduction, a walkthrough of its API, and a set of exercises.
3636
- exercises expected to require ~two hours to practically learn its operation.
3737
- [Resources](./resources): Various online resources
38-
- [Trail of Bits blogposts](./resources/tob_blogposts.md): List of blockchain related blogposts made by Trail of Bits
39-
38+
- [Trail of Bits blogposts](./resources/tob_blogposts.md): List of blockchain related blogposts made by Trail of Bits
4039

4140
# License
42-
secure-contracts and building-secure-contracts are licensed and distributed under the [AGPLv3 license](https://github.com/crytic/building-secure-contracts/blob/master/LICENSE). Contact us if you're looking for an exception to the terms.
41+
42+
secure-contracts and building-secure-contracts are licensed and distributed under the [AGPLv3 license](https://github.com/crytic/building-secure-contracts/blob/master/LICENSE). Contact us if you're looking for an exception to the terms.

0 commit comments

Comments
 (0)