Skip to content

Commit 79c4fc8

Browse files
authored
Use Slither for Solidity contracts static analysis (#48)
[Slither](https://github.com/crytic/slither) is static analysis framework for Solidity contracts.
2 parents 93796bc + 2ebb443 commit 79c4fc8

File tree

3 files changed

+56
-0
lines changed

3 files changed

+56
-0
lines changed

.github/workflows/core.yaml

+34
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,40 @@ jobs:
5858
core/typechain/
5959
if-no-files-found: error
6060

61+
core-slither:
62+
needs: [core-build]
63+
runs-on: ubuntu-latest
64+
steps:
65+
- uses: actions/checkout@v4
66+
67+
- name: Set up Node
68+
uses: actions/setup-node@v4
69+
with:
70+
node-version-file: "core/.nvmrc"
71+
cache: "yarn"
72+
cache-dependency-path: "core/yarn.lock"
73+
74+
- name: Install Dependencies
75+
run: yarn install --prefer-offline --frozen-lockfile
76+
77+
- uses: actions/setup-python@v4
78+
with:
79+
python-version: 3.11
80+
81+
- name: Install Slither
82+
env:
83+
SLITHER_VERSION: 0.9.6
84+
run: pip3 install slither-analyzer==$SLITHER_VERSION
85+
86+
- name: Download Build Artifacts
87+
uses: actions/download-artifact@v3
88+
with:
89+
name: core-build
90+
path: core/
91+
92+
- name: Run Slither
93+
run: slither --hardhat-ignore-compile .
94+
6195
core-test:
6296
needs: [core-build]
6397
runs-on: ubuntu-latest

README.md

+21
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,24 @@ pre-commit run --all-files
3434
# Execute hooks for specific files (e.g. Acre.sol):
3535
pre-commit run --files ./core/contracts/Acre.sol
3636
```
37+
38+
### Slither
39+
40+
[Slither](https://github.com/crytic/slither) is a static analysis framework used
41+
for Solidity contracts verification.
42+
43+
#### Install
44+
45+
To install Slither execute:
46+
47+
```sh
48+
pip3 install slither-analyzer
49+
```
50+
51+
#### Usage
52+
53+
To run Slither execute:
54+
55+
```sh
56+
slither .
57+
```

core/slither.config.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"detectors_to_exclude": "assembly,naming-convention,timestamp,pragma,solc-version",
23
"hardhat_artifacts_directory": "build",
34
"filter_paths": "node_modules/.*"
45
}

0 commit comments

Comments
 (0)