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.35k stars 970 forks source link

[Bug]: ERROR:ContractSolcParsing:Missing inheritance #2088

Open avniculae opened 1 year ago

avniculae commented 1 year ago

Describe the issue:

Hey! I am getting this Slither error when trying to run Echidna on a minimal fuzzing harness

Slither Error ``` ERROR:ContractSolcParsing:Missing inheritance ERC721URIStorage (8f9ec1f5c5841d1dfa53980de0971b66) Missing inheritance ID: 81571 Inheritance found: - ERC721 (ID 30473) - IERC4906 (ID 29440) ERROR:ContractSolcParsing:Missing inheritance AccessPassNFT (8f9ec1f5c5841d1dfa53980de0971b66) Missing inheritance ID: 81571 Inheritance found: - ERC721URIStorage (ID 1785) - Ownable (ID 112) ERROR:ContractSolcParsing:Missing inheritance ERC20Mock (8f9ec1f5c5841d1dfa53980de0971b66) Missing inheritance ID: 81571 Inheritance found: - ERC20 (ID 702) Traceback (most recent call last): File "/opt/homebrew/Cellar/slither-analyzer/0.9.6/libexec/lib/python3.11/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 725, in _analyze_content_top_level_function func_parser.analyze_content() File "/opt/homebrew/Cellar/slither-analyzer/0.9.6/libexec/lib/python3.11/site-packages/slither/solc_parsing/declarations/function.py", line 309, in analyze_content node_parser.analyze_expressions(self) File "/opt/homebrew/Cellar/slither-analyzer/0.9.6/libexec/lib/python3.11/site-packages/slither/solc_parsing/cfg/node.py", line 37, in analyze_expressions expression = parse_expression(self._unparsed_expression, caller_context) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/slither-analyzer/0.9.6/libexec/lib/python3.11/site-packages/slither/solc_parsing/expressions/expression_parsing.py", line 344, in parse_expression return parse_call(expression, caller_context) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/slither-analyzer/0.9.6/libexec/lib/python3.11/site-packages/slither/solc_parsing/expressions/expression_parsing.py", line 172, in parse_call arguments = [parse_expression(a, caller_context) for a in expression["arguments"]] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/slither-analyzer/0.9.6/libexec/lib/python3.11/site-packages/slither/solc_parsing/expressions/expression_parsing.py", line 172, in arguments = [parse_expression(a, caller_context) for a in expression["arguments"]] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/slither-analyzer/0.9.6/libexec/lib/python3.11/site-packages/slither/solc_parsing/expressions/expression_parsing.py", line 344, in parse_expression return parse_call(expression, caller_context) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/slither-analyzer/0.9.6/libexec/lib/python3.11/site-packages/slither/solc_parsing/expressions/expression_parsing.py", line 154, in parse_call called = parse_expression(expression["expression"], caller_context) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/slither-analyzer/0.9.6/libexec/lib/python3.11/site-packages/slither/solc_parsing/expressions/expression_parsing.py", line 508, in parse_expression var, was_created = find_variable(value, caller_context, referenced_declaration) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/slither-analyzer/0.9.6/libexec/lib/python3.11/site-packages/slither/solc_parsing/expressions/find_variable.py", line 449, in find_variable raise VariableNotFound(f"Variable not found: {var_name} (context {contract})") slither.solc_parsing.exceptions.VariableNotFound: Variable not found: mulUD60x18(UD60x18,UD60x18) (context None) The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/opt/homebrew/Cellar/slither-analyzer/0.9.6/libexec/lib/python3.11/site-packages/slither/__main__.py", line 814, in main_impl ) = process_all(filename, args, detector_classes, printer_classes) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/slither-analyzer/0.9.6/libexec/lib/python3.11/site-packages/slither/__main__.py", line 102, in process_all ) = process_single(compilation, args, detector_classes, printer_classes) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/slither-analyzer/0.9.6/libexec/lib/python3.11/site-packages/slither/__main__.py", line 80, in process_single slither = Slither(target, ast_format=ast, **vars(args)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/slither-analyzer/0.9.6/libexec/lib/python3.11/site-packages/slither/slither.py", line 135, in __init__ self._init_parsing_and_analyses(kwargs.get("skip_analyze", False)) File "/opt/homebrew/Cellar/slither-analyzer/0.9.6/libexec/lib/python3.11/site-packages/slither/slither.py", line 145, in _init_parsing_and_analyses raise e File "/opt/homebrew/Cellar/slither-analyzer/0.9.6/libexec/lib/python3.11/site-packages/slither/slither.py", line 141, in _init_parsing_and_analyses parser.parse_contracts() File "/opt/homebrew/Cellar/slither-analyzer/0.9.6/libexec/lib/python3.11/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 531, in parse_contracts self._analyze_third_part(contracts_to_be_analyzed, libraries) File "/opt/homebrew/Cellar/slither-analyzer/0.9.6/libexec/lib/python3.11/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 625, in _analyze_third_part self._analyze_variables_modifiers_functions(lib) File "/opt/homebrew/Cellar/slither-analyzer/0.9.6/libexec/lib/python3.11/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 741, in _analyze_variables_modifiers_functions self._analyze_content_top_level_function() File "/opt/homebrew/Cellar/slither-analyzer/0.9.6/libexec/lib/python3.11/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 727, in _analyze_content_top_level_function raise SlitherException(f"Missing {e} during top level function analyze") from e slither.exceptions.SlitherException: Missing Variable not found: mulUD60x18(UD60x18,UD60x18) (context None) during top level function analyze ERROR:root:Error: ERROR:root:Missing Variable not found: mulUD60x18(UD60x18,UD60x18) (context None) during top level function analyze ERROR:root:Please report an issue to https://github.com/crytic/slither/issues ```

Code example to reproduce the issue:

I have pushed the harness on this branch. To reproduce the issue, please first follow the instructions in the README to compile the contracts. Then, run the following commands:

- cd integration
- echidna . --contract Harness --config test/fuzzing/Harness.config.yaml
- slither . --print echidna

Version:

0.9.6

Relevant log output:

No response

0xalpharush commented 1 year ago

Thanks for reporting this and providing the branch! Until this is fixed, you may be able to work around this by creating a slither.config.json in integration/ and adding { "no_fail": true } to the config file.

avniculae commented 1 year ago

Hey @0xalpharush ! Thanks for your reply, this indeed makes echidna run. However, what are the consequences of this config? Will coverage-guided fuzzing still work?

0xalpharush commented 1 year ago

Slither gives Echidna a few special values it extracts from the source code, but this is probably not going to impact the effectiveness of fuzzing for your contracts, so it's fine to ignore slither failing. Echidna will still use coverage guided fuzzing, yes.