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]: Impossible to generate IR: 'NoneType' object has no attribute 'type' #1536

Closed
0xPhaze opened this issue Dec 29, 2022 · 3 comments
Closed
Labels
duplicate This issue or pull request already exists

Comments

@0xPhaze
Copy link

0xPhaze commented Dec 29, 2022

Describe the issue:

It seems that slither is unable to work with the import ... as ... syntax.

Code example to reproduce the issue:

Types.sol:

struct SimpleStruct {
    uint256 a;
}

Contract.sol:

import "./Types.sol" as Types;

contract Contract {
    Types.SimpleStruct simple;

    constructor() {
        simple = Types.SimpleStruct(0);
    }
}

Version:

0.9.1

Relevant log output:

Function not found SimpleStruct
Impossible to generate IR for Contract.constructor:
 'NoneType' object has no attribute 'type'
@0xPhaze 0xPhaze added the bug-candidate Bugs reports that are not yet confirmed label Dec 29, 2022
@0xPhaze
Copy link
Author

0xPhaze commented Dec 29, 2022

Related:

Code example to reproduce the issue:

Types.sol:

type Fixed256x18 is int256;

Contract.sol:

import "./Types.sol" as Types;

contract Contract {
    Types.Fixed256x18 value = Types.Fixed256x18.wrap(0);
}

Relevant log output:

Error in .
Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.10/site-packages/slither/__main__.py", line 826, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "/opt/homebrew/lib/python3.10/site-packages/slither/__main__.py", line 97, in process_all
    ) = process_single(compilation, args, detector_classes, printer_classes)
  File "/opt/homebrew/lib/python3.10/site-packages/slither/__main__.py", line 75, in process_single
    slither = Slither(target, ast_format=ast, **vars(args))
  File "/opt/homebrew/lib/python3.10/site-packages/slither/slither.py", line 130, in __init__
    parser.analyze_contracts()
  File "/opt/homebrew/lib/python3.10/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 500, in analyze_contracts
    self._convert_to_slithir()
  File "/opt/homebrew/lib/python3.10/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 685, in _convert_to_slithir
    func.generate_slithir_and_analyze()
  File "/opt/homebrew/lib/python3.10/site-packages/slither/core/declarations/function.py", line 1705, in generate_slithir_and_analyze
    node.slithir_generation()
  File "/opt/homebrew/lib/python3.10/site-packages/slither/core/cfg/node.py", line 719, in slithir_generation
    self._irs = convert_expression(expression, self)
  File "/opt/homebrew/lib/python3.10/site-packages/slither/slithir/convert.py", line 119, in convert_expression
    result = apply_ir_heuristics(result, node)
  File "/opt/homebrew/lib/python3.10/site-packages/slither/slithir/convert.py", line 1792, in apply_ir_heuristics
    find_references_origin(irs)
  File "/opt/homebrew/lib/python3.10/site-packages/slither/slithir/convert.py", line 1594, in find_references_origin
    ir.lvalue.points_to = ir.variable_left
  File "/opt/homebrew/lib/python3.10/site-packages/slither/slithir/variables/reference.py", line 52, in points_to
    assert is_valid_lvalue(points_to) or isinstance(
AssertionError

@0xalpharush
Copy link
Contributor

Related to #1452

@0xalpharush 0xalpharush added bug Something isn't working High Priority and removed bug-candidate Bugs reports that are not yet confirmed labels Dec 29, 2022
@0xalpharush 0xalpharush changed the title [Bug-Candidate]: Impossible to generate IR: 'NoneType' object has no attribute 'type' [Bug]: Impossible to generate IR: 'NoneType' object has no attribute 'type' Dec 29, 2022
@0xalpharush 0xalpharush added the ir label Dec 29, 2022
@0xalpharush 0xalpharush added duplicate This issue or pull request already exists and removed bug Something isn't working High Priority ir labels Jan 12, 2023
@0xalpharush
Copy link
Contributor

Tracking in #1452

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants