crytic / crytic/slither

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

Open
#2,193 1 comment 0 reactions 0 assignees View on GitHub
bug vyper
Dominant language
Python
Stars
6.4k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

### Describe the issue:

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

### Code example to reproduce the issue:

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

### Version:

`0.10.0`

### Relevant log output:

```shell
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
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.