Description
Running Slither on any DeFi project that uses Solady (which is most of them) produces a flood of \incorrect-shift\ and \incorrect-exp\ High-severity findings — all false positives.
Reproduction
Clone 3FLabs/grunt (https://github.com/3FLabs/grunt), run Slither, observe:
- 19x \incorrect-shift\ — all in \lib/solady/src/utils/FixedPointMathLib.sol, \lib/solady/src/utils/LibString.sol, \lib/solady/src/utils/EnumerableSetLib.sol, \lib/solady/src/auth/OwnableRoles.sol\
- 5x \incorrect-exp\ — all in the same library files
Total: 24 High-severity findings, all in the Solady dependency, all false positives.
Root cause
Solady uses bitwise XOR (^) for operations that have nothing to do with exponentiation — it is an intentional assembly-level pattern for efficient bit manipulation. Slither's \incorrect-exp\ detector treats ^\ as the exponentiation operator (Python semantics), which is incorrect in this context.
Similarly, Slither's \incorrect-shift\ fires on Solady's low-level shift operations that use non-obvious operand ordering for gas optimization.
Both detectors are unable to distinguish between:
- Code that naively misused ^\ thinking it was an exponent (the actual bug)
- Code that uses ^\ correctly for XOR or deliberately uses shift ordering (Solady's case)
Impact
Solady is used by hundreds of production DeFi protocols. Every project that includes it as a dependency gets 20+ High-severity false positives. This significantly degrades the signal-to-noise ratio of Slither and makes it harder to spot real vulnerabilities.
Suggested fix
Add a library-exclusion mechanism or at minimum document that --filter-paths lib/\ is necessary when analyzing projects with Solady. A detector-level fix would check whether the contract file has been previously analyzed and accepted into a known-safe registry.
Environment
Description
Running Slither on any DeFi project that uses Solady (which is most of them) produces a flood of \incorrect-shift\ and \incorrect-exp\ High-severity findings — all false positives.
Reproduction
Clone 3FLabs/grunt (https://github.com/3FLabs/grunt), run Slither, observe:
Total: 24 High-severity findings, all in the Solady dependency, all false positives.
Root cause
Solady uses bitwise XOR (^) for operations that have nothing to do with exponentiation — it is an intentional assembly-level pattern for efficient bit manipulation. Slither's \incorrect-exp\ detector treats ^\ as the exponentiation operator (Python semantics), which is incorrect in this context.
Similarly, Slither's \incorrect-shift\ fires on Solady's low-level shift operations that use non-obvious operand ordering for gas optimization.
Both detectors are unable to distinguish between:
Impact
Solady is used by hundreds of production DeFi protocols. Every project that includes it as a dependency gets 20+ High-severity false positives. This significantly degrades the signal-to-noise ratio of Slither and makes it harder to spot real vulnerabilities.
Suggested fix
Add a library-exclusion mechanism or at minimum document that --filter-paths lib/\ is necessary when analyzing projects with Solady. A detector-level fix would check whether the contract file has been previously analyzed and accepted into a known-safe registry.
Environment