crytic / crytic/crytic-compile

[Bug-Candidate]: Running Slither with `--compile-force-framework hardhat` flag doesn't works while contract compiles with Hardhat

Open
#570 5 comments 0 reactions 0 assignees View on GitHub
bug-candidate
Dominant language
Python
Stars
197
Forks
97
PR merge metrics
No merged PRs in 30d

Description

### Describe the issue:

Repo: [Steadefi](https://github.com/Cyfrin/2023-10-SteadeFi)
- The repository includes two framework files: Hardhat and Foundry.
- **Goal**: My goal is to always compile such repositories using Hardhat and provide the artifacts to Slither, making it **mandatory for slither to use Hardhat artifacts** exclusively.
- **Where I need Help?**: When running slither with `--compile-force-framework hardhat` slither runs into error, but with default Foundry (no flag provided) works flawlessly. I need to run it using HH artifacts.
- The project compiles with hardhat: `npx hardhat compile --force`. | `forge build` also works.
![image](https://github.com/user-attachments/assets/2a4b6daf-cf73-487d-9e18-30deac5efe7d)

- Used tool: Slither

- command try 1: `slither . --ignore-compile --filter-paths \.t\.sol$,\.s\.sol$ --compile-force-framework hardhat` | fails with error: `ERROR:Slither:Unable to compile all targets.`
- command try 2: `slither . --filter-paths \.t\.sol$,\.s\.sol$ --compile-force-framework hardhat` | fails with error: `ERROR:Slither:Unable to compile all targets.`
- command try 3: `slither . --filter-paths \.t\.sol$,\.s\.sol$` | **works** with foundry as default.
![image](https://github.com/user-attachments/assets/39a605ac-46c9-4868-8b84-fdad5878d766)
- command try 4: `slither . --filter-paths \.t\.sol$,\.s\.sol$ --compile-force-framework hardhat --exclude-dependencies` | fails with error: ` ERROR:Slither:Unable to compile all targets.`
![image](https://github.com/user-attachments/assets/3c3bd4b3-d753-4a0d-811a-c39cc6cb9afa)
- command try 5: `slither . --filter-paths \.t\.sol$,\.s\.sol$ --hardhat-artifacts-directory ./artifacts --exclude-dependencies --ignore-compile` | fails with error: ` ERROR:Slither:Unable to compile all targets.`

### Code example to reproduce the issue:

Repo: [Steadefi](https://github.com/Cyfrin/2023-10-SteadeFi)

### Version:

python --version
node --version
npm --version
yarn --version
npx hardhat --version
forge --version
slither --version
```
Python 3.11.7
v20.15.1
10.7.0
1.22.22
2.18.2
forge 0.2.0 (fe2acca 2024-07-22T00:20:15.468269927Z)
0.10.3
```

### Relevant log output:

```shell
ERROR:Slither:Unable to compile all targets.
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.