crytic / slither

Static Analyzer for Solidity and Vyper
https://blog.trailofbits.com/2018/10/19/slither-a-solidity-static-analysis-framework/
GNU Affero General Public License v3.0
5.37k stars 974 forks source link

[Bug-Candidate]: custom errors in require statements trigger error when used inside a modifier #2594

Open Sergei-Liakh opened 1 month ago

Sergei-Liakh commented 1 month ago

Describe the issue:

Custom errors within require statements work correctly when used inside functions, but they trigger an error when placed inside a modifier.

Code example to reproduce the issue:

pragma solidity 0.8.27;

error SomeError();

contract Test {
    modifier onlySomething() {
        require(false, SomeError());
        _;
    }
}

Version:

0.10.4

Relevant log output:

ERROR:ContractSolcParsing:Missing modifier Variable not found: require(bool,error) (context Test src/Test.sol#5-11 (1 - 0))
smonicas commented 1 month ago

Support for custom errors in a require statement has been added in https://github.com/crytic/slither/pull/2550. It's merged in the dev branch and will be in the next slither release. If you need it right now please use slither from the dev branch.