crytic / crytic/slither

[False-Positive]: incorrect-equality

Open
#2,759 1 comment 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:

I find it very common that the `incorrect-equality` detector is not accurate for "magic numbers" such as 0, `type(uint256).max`, etc.

Having to add `// slither-disable-next-line incorrect-equality` to lines that simply compare against the null value does not make sense. I believe these values should be excluded from the detector.

### Frequency

Very Frequently

### Code example to reproduce the issue:

```solidity
// slither-disable-next-line incorrect-equality
if (performanceFeePercentBefore == 0 && performanceFeePercent_ > 0 && highWaterMark == 0) {
_setHighWaterMark(_pps());
}
```

### Version:

0.11.3

### Relevant log output:

```shell

```

Contributor guide

Open the contributing guide

Research direction

Start by locating Slither's incorrect-equality detector and reproduce the provided Solidity example. Trace how comparisons against 0 and type(uint256).max are classified, then verify that these intended null-value comparisons are no longer reported while other incorrect equality cases remain detectable.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, solidity
Domain
devtools, security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.