First, thanks for your interest in contributing to Slither! We welcome and appreciate all contributions, including bug reports, feature suggestions, tutorials/blog posts, and code improvements.
If you're unsure where to start, we recommend our good first issue and help wanted issue labels.
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 [email protected] instead.
Questions can be submitted to the "Discussions" page, and you may also join our chat room (in the #ethereum channel).
Submit contributions via pull request.
- Minimize irrelevant changes (formatting, whitespace). Save style fixes for separate PRs.
- Split large changes into smaller focused PRs.
- PR description: summarize changes. For bug fixes, explain root cause.
- PR title: describe what it's changing (not just "Fixes #123").
- Commit messages: ≤72 char subject, prefix with
fix:,feat:,docs:,test:,refactor:.
See the Architecture section in CLAUDE.md for directory layout. A code walkthrough is available here.
Instructions for installing a development version of Slither can be found in our wiki.
For development setup, we use uv:
# Install uv if you haven't already
curl -LsSf https://astral.sh/uv/install.sh | sh
# Setup development environment
make dev # Installs dependencies and pre-commit hooksRun make test for all tests, or make test TESTS=$name for specific tests. List test names with pytest tests --collect-only.
Run make lint to check and make reformat to auto-fix. We use ruff for Python and yamllint for YAML.
We use prek, a fast Rust-based pre-commit runner:
prek install # One-time setup
prek run --all-files # Run manually
prek auto-update --cooldown-days 7 # Update hook versionsSlither's test suite has three categories:
- End-to-end (
tests/e2e): Invoke Slither and check output (printers, detectors). - Unit (
tests/unit): Test individual objects and functions. - Tools (
tests/tools): Tests forslither/tools.
For each new detector, at least one regression tests must be present.
- Create a folder in
tests/e2e/detectors/test_datawith the detector's argument name. - Create a test contract in
tests/e2e/detectors/test_data/<detector_name>/. - Update
ALL_TESTSintests/e2e/detectors/test_detectors.py. - Run
python tests/e2e/detectors/test_detectors.py --compileto create a ZIP file of the compilation artifacts. pytest tests/e2e/detectors/test_detectors.py --insta update-new. This will generate a snapshot of the detector output intests/e2e/detectors/snapshots/. If updating an existing detector, runpytest tests/e2e/detectors/test_detectors.py --insta reviewand accept or reject the updates.- Run
pytest tests/e2e/detectors/test_detectors.pyto ensure everything worked. Then, add and commit the files to git.
Tip: Filter with
-k ReentrancyReadBeforeWritten(class) or-k 0.7.6(version). Add--cov=slither/detectors --cov-report=htmlfor coverage.
- Create a test in
tests/e2e/solc_parsing/ - Update
ALL_TESTSintests/e2e/solc_parsing/test_ast_parsing.py. - Run
python tests/e2e/solc_parsing/test_ast_parsing.py --compile. This will compile the artifact intests/e2e/solc_parsing/compile. Add the compiled artifact to git. - Run
python tests/e2e/solc_parsing/test_ast_parsing.py --generate. This will generate the json artifacts intests/e2e/solc_parsing/expected_json. Add the generated files to git. - Run
pytest tests/e2e/solc_parsing/test_ast_parsing.pyand check that everything worked.
Tip: Filter with
-k user_defined_value_type(filename),-k 0.8.12(version), or-k legacy(format). Add--cov=slither/solc_parsing --cov-report=htmlfor coverage.
Slither depends on crytic-compile for compilation. When making changes that require updates to both repos:
- Create a branch in crytic-compile with your changes
- Update slither's
pyproject.tomlto point to that branch:"crytic-compile @ git+https://github.com/crytic/crytic-compile.git@your-branch" - Create a PR in slither and verify CI passes
- After crytic-compile merges, update slither to use the released version