crytic / crytic/slither

[False-Positive]: Undetected Error Declaration

Open
#2,720 0 comments 0 reactions 0 assignees View on GitHub
false-positive
Dominant language
Python
Stars
6.4k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

### Describe the false alarm that Slither raise and how you know it's inaccurate:

When an `error` is declared outside of the contract scope, Slither is unable to find it, thus creating a false positive. Note that the contract compiles without errors.

### Frequency

Very Frequently

### Code example to reproduce the issue:

```
error MyError();

contract A {
function X() public pure {
require(1 == 1, MyError());
}
}
```

### Version:

0.11.3

### Relevant log output:

```shell
'forge clean' running (wd: /Users/ferit/IdeaProjects/octant-v2-core)
'forge config --json' running
'forge build --build-info --skip */test/** */script/** --force' running (wd: /Users/ferit/IdeaProjects/octant-v2-core)
ERROR:ContractSolcParsing:Missing function Variable not found: NotWhitelisted(IWhitelist,address) (context RegenStaker src/regen/RegenStaker.sol#49-191 (1 - 2))
INFO:Printers:
Compiled with Foundry
Total number of contracts in source files: 79
Number of contracts in dependencies: 63
Source lines of code (SLOC) in source files: 3649
Source lines of code (SLOC) in dependencies: 4488
Number of assembly lines: 0
Number of optimization issues: 9
Number of informational issues: 0
Number of low issues: 0
Number of medium issues: 45
Number of high issues: 5
ERCs: ERC4626, ERC20, ERC165, ERC2612
```

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.