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

update slither instructions #1043

Merged
merged 1 commit into from
Nov 17, 2023
Merged
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
25 changes: 7 additions & 18 deletions src/config/static-analyzers.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,23 @@ To test your project using [slither](https://github.com/crytic/slither), here is
}
```

To run Slither on the entire project, you can use this command:
To run Slither on the entire project, use this command in the root of the project:

```sh
slither .
```

You do not need to provide remappings via the `solc_remaps` option as Slither will automatically detect remappings in a Foundry project. Slither will invoke `forge` to perform the build.
By default (as of version 0.10.0), this will skip tests and scripts. To force inclusion of the tests and scripts, add the `--foundry-compile-all` flag.

However, if you want to analyze a specific `.sol` file, then you do need to provide remappings:
To run Slither on a single file, use this command:

```json
{
"solc_remaps": [
"ds-test/=lib/ds-test/src/",
"forge-std/=lib/forge-std/src/"
]
}
```sh
slither src/Contract.sol
```

And you also need to update the `solc` compiler used by Slither to the same version used by Forge with `solc-select`:
Note, this requires configuring the [solc version in the foundry config file](https://book.getfoundry.sh/reference/config/solidity-compiler#solc_version).

```sh
pip3 install slither-analyzer
pip3 install solc-select
solc-select install 0.8.13
solc-select use 0.8.13
slither .
```
You do not need to provide remappings via the `solc_remaps` option as Slither will automatically detect remappings in a Foundry project. Slither will invoke `forge` to perform the build.

See the [Slither wiki](https://github.com/crytic/slither/wiki/Usage) for more information.

Expand Down