Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Slither for Solidity contracts static analysis #48

Merged
merged 3 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,40 @@ jobs:
core/typechain/
if-no-files-found: error

core-slither:
needs: [core-build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Node
uses: actions/setup-node@v4
with:
node-version-file: "core/.nvmrc"
cache: "yarn"
cache-dependency-path: "core/yarn.lock"

- name: Install Dependencies
run: yarn install --prefer-offline --frozen-lockfile

- uses: actions/setup-python@v4
with:
python-version: 3.11

- name: Install Slither
env:
SLITHER_VERSION: 0.9.6
run: pip3 install slither-analyzer==$SLITHER_VERSION

- name: Download Build Artifacts
uses: actions/download-artifact@v3
with:
name: core-build
path: core/

- name: Run Slither
run: slither --hardhat-ignore-compile .

core-test:
needs: [core-build]
runs-on: ubuntu-latest
Expand Down
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,24 @@ pre-commit run --all-files
# Execute hooks for specific files (e.g. Acre.sol):
pre-commit run --files ./core/contracts/Acre.sol
```

### Slither

[Slither](https://github.com/crytic/slither) is a static analysis framework used
for Solidity contracts verification.

#### Install

To install Slither execute:

```sh
pip3 install slither-analyzer
```

#### Usage

To run Slither execute:

```sh
slither .
```
1 change: 1 addition & 0 deletions core/slither.config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"detectors_to_exclude": "assembly,naming-convention,timestamp,pragma,solc-version",
"hardhat_artifacts_directory": "build",
"filter_paths": "node_modules/.*"
}
Loading