[Bug-Candidate]: Problems with Slither on projects with several compiler versions
- Dominant language
- Python
- Stars
- 6.4k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
### Describe the issue:
A problem with Slither when running it on projects with several compiler versions specified in config file. Every time I run into issues with python inside slither (issue like this for example: RecursionError: maximum recursion depth exceeded while calling a Python object). Does Slither support several compiler version projects or that is not the case of issues?
### Code example to reproduce the issue:
```
solidity: {
compilers: [
{
version: '0.7.6',
},
{
version: '0.8.2',
},
],
```
### Version:
0.8.2
### Relevant log output:
{
"success": false,
"error": "Traceback (most recent call last):\n File \"/home/nd/.local/lib/python3.8/site-packages/slither/__main__.py\", line 743, in main_impl\n ) = process_all(filename, args, detector_classes, printer_classes)\n File \"/home/nd/.local/lib/python3.8/site-packages/slither/__main__.py\", line 84, in process_all\n ) = process_single(compilation, args, detector_classes, printer_classes)\n File \"/home/nd/.local/lib/python3.8/site-packages/slither/__main__.py\", line 67, in process_single\n slither = Slither(target, ast_format=ast, **vars(args))\n File \"/home/nd/.local/lib/python3.8/site-packages/slither/slither.py\", line 120, in __init__\n parser.parse_contracts()\n File \"/home/nd/.local/lib/python3.8/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py\", line 435, in parse_contracts\n self._analyze_third_part(contracts_to_be_analyzed, libraries)\n File \"/home/nd/.local/lib/python3.8/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py\", line 541, in _analyze_third_part\n self._analyze_variables_modifiers_functions(contract)\n File \"/home/nd/.local/lib/python3.8/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py\", line 614, in _analyze_variables_modifiers_functions\n contract.analyze_content_functions()\n File \"/home/nd/.local/lib/python3.8/site-packages/slither/solc_parsing/declarations/contract.py\", line 378, in analyze_content_functions\n function_parser.analyze_content()\n File \"/home/nd/.local/lib/python3.8/site-packages/slither/solc_parsing/declarations/function.py\", line 282, in analyze_content\n self._parse_cfg(body)\n File \"/home/nd/.local/lib/python3.8/site-packages/slither/solc_parsing/declarations/function.py\", line 1071, in _parse_cfg\n self._remove_incorrect_edges()\n File \"/home/nd/.local/lib/python3.8/site-packages/slither/solc_parsing/declarations/function.py\", line 1275, in _remove_incorrect_edges\n self._fix_try(node)\n File \"/home/nd/.local/lib/python3.8/site-packages/slither/solc_parsing/declarations/function.py\", line 1150, in _fix_try\n self._fix_catch(son, end_node)\n File \"/home/nd/.local/lib/python3.8/site-packages/slither/solc_parsing/declarations/function.py\", line 1158, in _fix_catch\n self._fix_catch(son, end_node)\n File \"/home/nd/.local/lib/python3.8/site-packages/slither/solc_parsing/declarations/function.py\", line 1158, in _fix_catch\n self._fix_catch(son, end_node)\n File \"/home/nd/.local/lib/python3.8/site-packages/slither/solc_parsing/declarations/function.py\", line 1158, in _fix_catch\n self._fix_catch(son, end_node)\n [Previous line repeated 1480 more times]\n File \"/home/nd/.local/lib/python3.8/site-packages/slither/solc_parsing/declarations/function.py\", line 1153, in _fix_catch\n if not node.sons:\n File \"/home/nd/.local/lib/python3.8/site-packages/slither/core/cfg/node.py\", line 667, in sons\n return list(self._sons)\nRecursionError: maximum recursion depth exceeded while calling a Python object\n",
"results": {}
}
Contributor guide
Research direction
Reproduce the failure with the shown multi-version Solidity configuration and trace execution through slither/solc_parsing/declarations/function.py, especially _parse_cfg and _fix_catch. Compare behavior for projects using one compiler version versus several, and use the traceback's recursion path to identify the affected parsing case. Done means the multi-version project is handled without this RecursionError or the limitation is explicitly characterized by a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, solidity
- Domain
- compilers, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100