Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug-Candidate]: slither.solc_parsing.exceptions.ParsingError: Type not found contract MockERC20 #2519

Closed
rappie opened this issue Jul 29, 2024 · 2 comments

Comments

@rappie
Copy link

rappie commented Jul 29, 2024

Describe the issue:

Crash when running slither . --print echidna

Code example to reproduce the issue:

Private 😞

Version:

0.10.3

Relevant log output:

$ slither . --print echidna
'forge clean' running (wd: <REDACTED>)
'forge config --json' running
'forge build --build-info --skip */test/** */script/** --force' running (wd: <REDACTED>)
ERROR:SlitherSolcParsing:crytic-compile returned an empty AST. If you are trying to analyze a contract from etherscan or similar make sure it has source code available.
ERROR:SlitherSolcParsing:crytic-compile returned an empty AST. If you are trying to analyze a contract from etherscan or similar make sure it has source code available.
ERROR:SlitherSolcParsing:crytic-compile returned an empty AST. If you are trying to analyze a contract from etherscan or similar make sure it has source code available.
ERROR:Slither:Failed to resolved name for reference id 25999 in <REDACTED>
ERROR:Slither:Failed to resolved name for reference id 26032 in <REDACTED>
ERROR:Slither:Failed to resolved name for reference id 26079 in <REDACTED>
ERROR:Slither:Failed to resolved name for reference id 25999 in <REDACTED>
ERROR:Slither:Failed to resolved name for reference id 26032 in <REDACTED>
ERROR:Slither:Failed to resolved name for reference id 26079 in <REDACTED>
ERROR:Slither:Failed to resolved name for reference id 25999 in <REDACTED>
ERROR:Slither:Failed to resolved name for reference id 26032 in <REDACTED>
ERROR:Slither:Failed to resolved name for reference id 26079 in <REDACTED>
ERROR:Slither:Failed to resolved name for reference id 25999 in <REDACTED>
ERROR:Slither:Failed to resolved name for reference id 26032 in <REDACTED>
ERROR:Slither:Failed to resolved name for reference id 26079 in <REDACTED>
ERROR:Slither:Failed to resolved name for reference id 25999 in <REDACTED>
ERROR:Slither:Failed to resolved name for reference id 26032 in <REDACTED>
ERROR:Slither:Failed to resolved name for reference id 26079 in <REDACTED>
ERROR:Slither:Failed to resolved name for reference id 25999 in <REDACTED>
ERROR:Slither:Failed to resolved name for reference id 26032 in <REDACTED>
ERROR:Slither:Failed to resolved name for reference id 26079 in <REDACTED>
ERROR:Slither:Failed to resolved name for reference id 25999 in <REDACTED>
ERROR:Slither:Failed to resolved name for reference id 26032 in <REDACTED>
ERROR:Slither:Failed to resolved name for reference id 26079 in <REDACTED>
Traceback (most recent call last):
  File "/home/rappie/.local/lib/python3.12/site-packages/slither/__main__.py", line 888, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rappie/.local/lib/python3.12/site-packages/slither/__main__.py", line 113, in process_all
    ) = process_single(compilation, args, detector_classes, printer_classes)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rappie/.local/lib/python3.12/site-packages/slither/__main__.py", line 80, in process_single
    slither = Slither(target, ast_format=ast, **vars(args))
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rappie/.local/lib/python3.12/site-packages/slither/slither.py", line 202, in __init__
    self._init_parsing_and_analyses(kwargs.get("skip_analyze", False))
  File "/home/rappie/.local/lib/python3.12/site-packages/slither/slither.py", line 211, in _init_parsing_and_analyses
    raise e
  File "/home/rappie/.local/lib/python3.12/site-packages/slither/slither.py", line 207, in _init_parsing_and_analyses
    parser.parse_contracts()
  File "/home/rappie/.local/lib/python3.12/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 583, in parse_contracts
    self._analyze_third_part(contracts_to_be_analyzed, libraries)
  File "/home/rappie/.local/lib/python3.12/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 694, in _analyze_third_part
    self._analyze_variables_modifiers_functions(contract)
  File "/home/rappie/.local/lib/python3.12/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 797, in _analyze_variables_modifiers_functions
    contract.analyze_state_variables()
  File "/home/rappie/.local/lib/python3.12/site-packages/slither/solc_parsing/declarations/contract.py", line 605, in analyze_state_variables
    var_parser.analyze(self)
  File "/home/rappie/.local/lib/python3.12/site-packages/slither/solc_parsing/variables/variable_declaration.py", line 212, in analyze
    self._variable.type = parse_type(self._elem_to_parse, caller_context)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rappie/.local/lib/python3.12/site-packages/slither/solc_parsing/solidity_types/type_parsing.py", line 380, in parse_type
    type_found = _find_from_type_name(
                 ^^^^^^^^^^^^^^^^^^^^^
  File "/home/rappie/.local/lib/python3.12/site-packages/slither/solc_parsing/solidity_types/type_parsing.py", line 194, in _find_from_type_name
    raise ParsingError("Type not found " + str(name))
slither.solc_parsing.exceptions.ParsingError: Type not found contract MockERC20
ERROR:root:Error:
ERROR:root:Type not found contract MockERC20
ERROR:root:Please report an issue to https://github.com/crytic/slither/issues
@rappie rappie added the bug-candidate Bugs reports that are not yet confirmed label Jul 29, 2024
@rappie
Copy link
Author

rappie commented Jul 29, 2024

Found it! 😄

MockERC20 is in the foundry test folder. I have to use --foundry-compile-all with Slither and --crytic-args="--foundry-compile-all" with Echidna.

@0xalpharush 0xalpharush removed the bug-candidate Bugs reports that are not yet confirmed label Aug 7, 2024
@0xalpharush
Copy link
Contributor

This is related to crytic/crytic-compile#563

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants