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]: Slither fails analysing raw_call to empty(address) #2193

Open
trocher opened this issue Oct 19, 2023 · 1 comment
Open

[Bug]: Slither fails analysing raw_call to empty(address) #2193

trocher opened this issue Oct 19, 2023 · 1 comment
Labels
bug Something isn't working vyper

Comments

@trocher
Copy link

trocher commented Oct 19, 2023

Describe the issue:

Slither crashes when given a Vyper contract containing a raw_call to empty(address)

Code example to reproduce the issue:

@external
def foo():
    raw_call(empty(address),b'')

Version:

0.10.0

Relevant log output:

Traceback (most recent call last):
  File "/home/csdocker/.local/pipx/venvs/slither-analyzer/lib/python3.10/site-packages/slither/core/cfg/node.py", line 918, in _find_read_write_call
    self._high_level_calls.append((ir.destination.type.type, ir.function))
AttributeError: 'NoneType' object has no attribute 'type'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/csdocker/.local/pipx/venvs/slither-analyzer/lib/python3.10/site-packages/slither/__main__.py", line 833, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "/home/csdocker/.local/pipx/venvs/slither-analyzer/lib/python3.10/site-packages/slither/__main__.py", line 107, in process_all
    ) = process_single(compilation, args, detector_classes, printer_classes)
  File "/home/csdocker/.local/pipx/venvs/slither-analyzer/lib/python3.10/site-packages/slither/__main__.py", line 80, in process_single
    slither = Slither(target, ast_format=ast, **vars(args))
  File "/home/csdocker/.local/pipx/venvs/slither-analyzer/lib/python3.10/site-packages/slither/slither.py", line 144, in __init__
    self._init_parsing_and_analyses(kwargs.get("skip_analyze", False))
  File "/home/csdocker/.local/pipx/venvs/slither-analyzer/lib/python3.10/site-packages/slither/slither.py", line 164, in _init_parsing_and_analyses
    raise e
  File "/home/csdocker/.local/pipx/venvs/slither-analyzer/lib/python3.10/site-packages/slither/slither.py", line 160, in _init_parsing_and_analyses
    parser.analyze_contracts()
  File "/home/csdocker/.local/pipx/venvs/slither-analyzer/lib/python3.10/site-packages/slither/vyper_parsing/vyper_compilation_unit.py", line 63, in analyze_contracts
    self._convert_to_slithir()
  File "/home/csdocker/.local/pipx/venvs/slither-analyzer/lib/python3.10/site-packages/slither/vyper_parsing/vyper_compilation_unit.py", line 73, in _convert_to_slithir
    func.generate_slithir_and_analyze()
  File "/home/csdocker/.local/pipx/venvs/slither-analyzer/lib/python3.10/site-packages/slither/core/declarations/function.py", line 1767, in generate_slithir_and_analyze
    node.slithir_generation()
  File "/home/csdocker/.local/pipx/venvs/slither-analyzer/lib/python3.10/site-packages/slither/core/cfg/node.py", line 718, in slithir_generation
    self._find_read_write_call()
  File "/home/csdocker/.local/pipx/venvs/slither-analyzer/lib/python3.10/site-packages/slither/core/cfg/node.py", line 921, in _find_read_write_call
    raise SlitherException(
slither.exceptions.SlitherException: Function not found on IR: TUPLE_0(None) = HIGH_LEVEL_CALL, dest:TMP_0(None), function:raw_call, arguments:['0x']  .
Node: EXPRESSION empty()().raw_call(0x) (code.vy#5-6)
Function: foo
Please try compiling with a recent Solidity version. 'NoneType' object has no attribute 'type'
ERROR:root:Error:
ERROR:root:Function not found on IR: TUPLE_0(None) = HIGH_LEVEL_CALL, dest:TMP_0(None), function:raw_call, arguments:['0x']  .
Node: EXPRESSION empty()().raw_call(0x) (code.vy#5-6)
Function: foo
Please try compiling with a recent Solidity version. 'NoneType' object has no attribute 'type'
ERROR:root:Please report an issue to https://github.com/crytic/slither/issues
@trocher trocher added the bug-candidate Bugs reports that are not yet confirmed label Oct 19, 2023
@0xalpharush
Copy link
Contributor

We aren't currently inferring the return type for empty(...). There's still some work to follow up on the initial implementation #2099. Some of this will follow addressing vyperlang/vyper#3581 so that return types are provided for generic builtins

@0xalpharush 0xalpharush added bug Something isn't working and removed bug-candidate Bugs reports that are not yet confirmed labels Oct 19, 2023
@0xalpharush 0xalpharush changed the title [Bug-Candidate]: Slither fails analysing raw_call to empty(address) [Bug]: Slither fails analysing raw_call to empty(address) Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working vyper
Projects
None yet
Development

No branches or pull requests

2 participants