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]: Vyper interfaces with default argument crash Slither #2375

Open
trocher opened this issue Mar 25, 2024 · 0 comments
Open

[Bug-Candidate]: Vyper interfaces with default argument crash Slither #2375

trocher opened this issue Mar 25, 2024 · 0 comments
Labels
bug-candidate Bugs reports that are not yet confirmed

Comments

@trocher
Copy link

trocher commented Mar 25, 2024

Describe the issue:

When having a contract that does an external call to some function of another contract, if the interface defines this function with some default arguments, only if all arguments are supplied Slither does not crash.

Code example to reproduce the issue:

# @version 0.3.7


interface Pool:
    def price_oracle(i: uint256 = 0) -> uint256: view

@external
@view
def price(a:address):
    p: uint256 = Pool(a).price_oracle()

Version:

0.10.1

Relevant log output:

Traceback (most recent call last):
  File "/Users/trocher/.pyenv/versions/slither_prod/bin/slither", line 8, in <module>
    sys.exit(main())
  File "/Users/trocher/.pyenv/versions/slither_prod/lib/python3.8/site-packages/slither/__main__.py", line 746, in main
    main_impl(all_detector_classes=detectors, all_printer_classes=printers)
  File "/Users/trocher/.pyenv/versions/slither_prod/lib/python3.8/site-packages/slither/__main__.py", line 852, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "/Users/trocher/.pyenv/versions/slither_prod/lib/python3.8/site-packages/slither/__main__.py", line 107, in process_all
    ) = process_single(compilation, args, detector_classes, printer_classes)
  File "/Users/trocher/.pyenv/versions/slither_prod/lib/python3.8/site-packages/slither/__main__.py", line 80, in process_single
    slither = Slither(target, ast_format=ast, **vars(args))
  File "/Users/trocher/.pyenv/versions/slither_prod/lib/python3.8/site-packages/slither/slither.py", line 150, in __init__
    self._init_parsing_and_analyses(kwargs.get("skip_analyze", False))
  File "/Users/trocher/.pyenv/versions/slither_prod/lib/python3.8/site-packages/slither/slither.py", line 170, in _init_parsing_and_analyses
    raise e
  File "/Users/trocher/.pyenv/versions/slither_prod/lib/python3.8/site-packages/slither/slither.py", line 166, in _init_parsing_and_analyses
    parser.analyze_contracts()
  File "/Users/trocher/.pyenv/versions/slither_prod/lib/python3.8/site-packages/slither/vyper_parsing/vyper_compilation_unit.py", line 63, in analyze_contracts
    self._convert_to_slithir()
  File "/Users/trocher/.pyenv/versions/slither_prod/lib/python3.8/site-packages/slither/vyper_parsing/vyper_compilation_unit.py", line 73, in _convert_to_slithir
    func.generate_slithir_and_analyze()
  File "/Users/trocher/.pyenv/versions/slither_prod/lib/python3.8/site-packages/slither/core/declarations/function.py", line 1772, in generate_slithir_and_analyze
    node.slithir_generation()
  File "/Users/trocher/.pyenv/versions/slither_prod/lib/python3.8/site-packages/slither/core/cfg/node.py", line 717, in slithir_generation
    self._irs = convert_expression(expression, self)  # type:ignore
  File "/Users/trocher/.pyenv/versions/slither_prod/lib/python3.8/site-packages/slither/slithir/convert.py", line 118, in convert_expression
    result = apply_ir_heuristics(result, node, is_solidity)
  File "/Users/trocher/.pyenv/versions/slither_prod/lib/python3.8/site-packages/slither/slithir/convert.py", line 2033, in apply_ir_heuristics
    irs = propagate_type_and_convert_call(irs, node)
  File "/Users/trocher/.pyenv/versions/slither_prod/lib/python3.8/site-packages/slither/slithir/convert.py", line 529, in propagate_type_and_convert_call
    new_ins = propagate_types(ins, node)
  File "/Users/trocher/.pyenv/versions/slither_prod/lib/python3.8/site-packages/slither/slithir/convert.py", line 649, in propagate_types
    return convert_type_of_high_and_internal_level_call(ir, t_type)
  File "/Users/trocher/.pyenv/versions/slither_prod/lib/python3.8/site-packages/slither/slithir/convert.py", line 1793, in convert_type_of_high_and_internal_level_call
    if isinstance(func.type, (MappingType, ArrayType)):
AttributeError: 'NoneType' object has no attribute 'type'
@trocher trocher added the bug-candidate Bugs reports that are not yet confirmed label Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-candidate Bugs reports that are not yet confirmed
Projects
None yet
Development

No branches or pull requests

1 participant