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]: Type Not Found #1874

Closed
0xAurelou opened this issue Apr 28, 2023 · 3 comments
Closed

[Bug]: Type Not Found #1874

0xAurelou opened this issue Apr 28, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@0xAurelou
Copy link

Describe the issue:

I wanted to run slither a static analysis tools in order to check if there was not "classical" vulnerabilities in mangrove-core
However When I run the command to check if there is some vulnerabilities I have some issues.
Personally thinks that it's an AST error

Code example to reproduce the issue:

To Reproduce
Steps to reproduce the behavior:

1- Go to root of the repository (I assume that you did forge install before)
2- run slither . --filter-paths "lib|test" --exclude naming-convention --fail-medium
3- See error

Version:

0.9.3

Relevant log output:

Compiling 224 files with 0.8.19
Solc 0.8.19 finished in 20.76s
Compiler run successful

ERROR:ContractSolcParsing:Missing function Type not found MgvStructs.OfferPacked
ERROR:ContractSolcParsing:Missing function Type not found MgvStructs.OfferPacked
ERROR:ContractSolcParsing:Missing function Type not found MgvStructs.OfferPacked
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/slither-analyzer/0.9.3/libexec/lib/python3.11/site-packages/slither/__main__.py", line 837, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/slither-analyzer/0.9.3/libexec/lib/python3.11/site-packages/slither/__main__.py", line 101, in process_all
    ) = process_single(compilation, args, detector_classes, printer_classes)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/slither-analyzer/0.9.3/libexec/lib/python3.11/site-packages/slither/__main__.py", line 79, in process_single
    slither = Slither(target, ast_format=ast, **vars(args))
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/slither-analyzer/0.9.3/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.3/libexec/lib/python3.11/site-packages/slither/slither.py", line 155, in _init_parsing_and_analyses
    raise e
  File "/opt/homebrew/Cellar/slither-analyzer/0.9.3/libexec/lib/python3.11/site-packages/slither/slither.py", line 151, in _init_parsing_and_analyses
    parser.analyze_contracts()
  File "/opt/homebrew/Cellar/slither-analyzer/0.9.3/libexec/lib/python3.11/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 528, in analyze_contracts
    self._convert_to_slithir()
  File "/opt/homebrew/Cellar/slither-analyzer/0.9.3/libexec/lib/python3.11/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 739, in _convert_to_slithir
    func.generate_slithir_and_analyze()
  File "/opt/homebrew/Cellar/slither-analyzer/0.9.3/libexec/lib/python3.11/site-packages/slither/core/declarations/function.py", line 1761, in generate_slithir_and_analyze
    node.slithir_generation()
  File "/opt/homebrew/Cellar/slither-analyzer/0.9.3/libexec/lib/python3.11/site-packages/slither/core/cfg/node.py", line 679, in slithir_generation
    self._irs = convert_expression(expression, self)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/slither-analyzer/0.9.3/libexec/lib/python3.11/site-packages/slither/slithir/convert.py", line 140, in convert_expression
    result = apply_ir_heuristics(result, node)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/slither-analyzer/0.9.3/libexec/lib/python3.11/site-packages/slither/slithir/convert.py", line 1928, in apply_ir_heuristics
    find_references_origin(irs)
  File "/opt/homebrew/Cellar/slither-analyzer/0.9.3/libexec/lib/python3.11/site-packages/slither/slithir/convert.py", line 1730, in find_references_origin
    ir.lvalue.points_to = ir.variable_left
    ^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/slither-analyzer/0.9.3/libexec/lib/python3.11/site-packages/slither/slithir/variables/reference.py", line 45, in points_to
    assert is_valid_lvalue(points_to) or isinstance(
AssertionError
ERROR:root:Error in .
ERROR:root:Traceback (most recent call last):
  File "/opt/homebrew/Cellar/slither-analyzer/0.9.3/libexec/lib/python3.11/site-packages/slither/__main__.py", line 837, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/slither-analyzer/0.9.3/libexec/lib/python3.11/site-packages/slither/__main__.py", line 101, in process_all
    ) = process_single(compilation, args, detector_classes, printer_classes)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/slither-analyzer/0.9.3/libexec/lib/python3.11/site-packages/slither/__main__.py", line 79, in process_single
    slither = Slither(target, ast_format=ast, **vars(args))
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/slither-analyzer/0.9.3/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.3/libexec/lib/python3.11/site-packages/slither/slither.py", line 155, in _init_parsing_and_analyses
    raise e
  File "/opt/homebrew/Cellar/slither-analyzer/0.9.3/libexec/lib/python3.11/site-packages/slither/slither.py", line 151, in _init_parsing_and_analyses
    parser.analyze_contracts()
  File "/opt/homebrew/Cellar/slither-analyzer/0.9.3/libexec/lib/python3.11/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 528, in analyze_contracts
    self._convert_to_slithir()
  File "/opt/homebrew/Cellar/slither-analyzer/0.9.3/libexec/lib/python3.11/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 739, in _convert_to_slithir
    func.generate_slithir_and_analyze()
  File "/opt/homebrew/Cellar/slither-analyzer/0.9.3/libexec/lib/python3.11/site-packages/slither/core/declarations/function.py", line 1761, in generate_slithir_and_analyze
    node.slithir_generation()
  File "/opt/homebrew/Cellar/slither-analyzer/0.9.3/libexec/lib/python3.11/site-packages/slither/core/cfg/node.py", line 679, in slithir_generation
    self._irs = convert_expression(expression, self)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/slither-analyzer/0.9.3/libexec/lib/python3.11/site-packages/slither/slithir/convert.py", line 140, in convert_expression
    result = apply_ir_heuristics(result, node)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/slither-analyzer/0.9.3/libexec/lib/python3.11/site-packages/slither/slithir/convert.py", line 1928, in apply_ir_heuristics
    find_references_origin(irs)
  File "/opt/homebrew/Cellar/slither-analyzer/0.9.3/libexec/lib/python3.11/site-packages/slither/slithir/convert.py", line 1730, in find_references_origin
    ir.lvalue.points_to = ir.variable_left
    ^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/slither-analyzer/0.9.3/libexec/lib/python3.11/site-packages/slither/slithir/variables/reference.py", line 45, in points_to
    assert is_valid_lvalue(points_to) or isinstance(
AssertionError
@0xAurelou 0xAurelou added the bug-candidate Bugs reports that are not yet confirmed label Apr 28, 2023
@duelinggalois
Copy link
Contributor

looks like the same stack trace as #1853

@0xalpharush
Copy link
Contributor

I would imagine this is due to the use of aliases here https://github.com/mangrovedao/mangrove-core/blob/fbb3415d3b038b55ab668aafe89f811bb7b67f8e/src/MgvLib.sol#L19. There is a tracking issue here for improving support for this style import #1452

@0xalpharush 0xalpharush added bug Something isn't working and removed bug-candidate Bugs reports that are not yet confirmed labels May 2, 2023
@0xalpharush 0xalpharush changed the title [Bug-Candidate]: Type Not Found [Bug]: Type Not Found May 2, 2023
@0xalpharush
Copy link
Contributor

closed by #2403

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants