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]: 'NoneType' object has no attribute 'type' #1140

Closed
amber0515 opened this issue Mar 25, 2022 · 6 comments
Closed

[Bug-Candidate]: 'NoneType' object has no attribute 'type' #1140

amber0515 opened this issue Mar 25, 2022 · 6 comments
Labels
duplicate This issue or pull request already exists

Comments

@amber0515
Copy link

Describe the issue:

I make the contract upgradeable by use "@openzeppelin/contracts-upgradeable": "^4.5.1". when I remove this dependecy everything works fine.

Code example to reproduce the issue:

Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.9/site-packages/slither/__main__.py", line 743, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "/opt/homebrew/lib/python3.9/site-packages/slither/__main__.py", line 84, in process_all
    ) = process_single(compilation, args, detector_classes, printer_classes)
  File "/opt/homebrew/lib/python3.9/site-packages/slither/__main__.py", line 69, in process_single
    return _process(slither, detector_classes, printer_classes)
  File "/opt/homebrew/lib/python3.9/site-packages/slither/__main__.py", line 110, in _process
    detector_results = slither.run_detectors()
  File "/opt/homebrew/lib/python3.9/site-packages/slither/slither.py", line 203, in run_detectors
    results = [d.detect() for d in self._detectors]
  File "/opt/homebrew/lib/python3.9/site-packages/slither/slither.py", line 203, in <listcomp>
    results = [d.detect() for d in self._detectors]
  File "/opt/homebrew/lib/python3.9/site-packages/slither/detectors/abstract_detector.py", line 152, in detect
    for r in [output.data for output in self._detect()]:
  File "/opt/homebrew/lib/python3.9/site-packages/slither/detectors/statements/delegatecall_in_loop.py", line 89, in _detect
    values = detect_delegatecall_in_loop(c)
  File "/opt/homebrew/lib/python3.9/site-packages/slither/detectors/statements/delegatecall_in_loop.py", line 13, in detect_delegatecall_in_loop
    delegatecall_in_loop(f.entry_point, 0, [], results)
  File "/opt/homebrew/lib/python3.9/site-packages/slither/detectors/statements/delegatecall_in_loop.py", line 41, in delegatecall_in_loop
    delegatecall_in_loop(son, in_loop_counter, visited, results)
  File "/opt/homebrew/lib/python3.9/site-packages/slither/detectors/statements/delegatecall_in_loop.py", line 41, in delegatecall_in_loop
    delegatecall_in_loop(son, in_loop_counter, visited, results)
  File "/opt/homebrew/lib/python3.9/site-packages/slither/detectors/statements/delegatecall_in_loop.py", line 38, in delegatecall_in_loop
    delegatecall_in_loop(ir.function.entry_point, in_loop_counter, visited, results)
  File "/opt/homebrew/lib/python3.9/site-packages/slither/detectors/statements/delegatecall_in_loop.py", line 25, in delegatecall_in_loop
    if node.type == NodeType.STARTLOOP:
AttributeError: 'NoneType' object has no attribute 'type'
None
Error in .
Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.9/site-packages/slither/__main__.py", line 743, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "/opt/homebrew/lib/python3.9/site-packages/slither/__main__.py", line 84, in process_all
    ) = process_single(compilation, args, detector_classes, printer_classes)
  File "/opt/homebrew/lib/python3.9/site-packages/slither/__main__.py", line 69, in process_single
    return _process(slither, detector_classes, printer_classes)
  File "/opt/homebrew/lib/python3.9/site-packages/slither/__main__.py", line 110, in _process
    detector_results = slither.run_detectors()
  File "/opt/homebrew/lib/python3.9/site-packages/slither/slither.py", line 203, in run_detectors
    results = [d.detect() for d in self._detectors]
  File "/opt/homebrew/lib/python3.9/site-packages/slither/slither.py", line 203, in <listcomp>
    results = [d.detect() for d in self._detectors]
  File "/opt/homebrew/lib/python3.9/site-packages/slither/detectors/abstract_detector.py", line 152, in detect
    for r in [output.data for output in self._detect()]:
  File "/opt/homebrew/lib/python3.9/site-packages/slither/detectors/statements/delegatecall_in_loop.py", line 89, in _detect
    values = detect_delegatecall_in_loop(c)
  File "/opt/homebrew/lib/python3.9/site-packages/slither/detectors/statements/delegatecall_in_loop.py", line 13, in detect_delegatecall_in_loop
    delegatecall_in_loop(f.entry_point, 0, [], results)
  File "/opt/homebrew/lib/python3.9/site-packages/slither/detectors/statements/delegatecall_in_loop.py", line 41, in delegatecall_in_loop
    delegatecall_in_loop(son, in_loop_counter, visited, results)
  File "/opt/homebrew/lib/python3.9/site-packages/slither/detectors/statements/delegatecall_in_loop.py", line 41, in delegatecall_in_loop
    delegatecall_in_loop(son, in_loop_counter, visited, results)
  File "/opt/homebrew/lib/python3.9/site-packages/slither/detectors/statements/delegatecall_in_loop.py", line 38, in delegatecall_in_loop
    delegatecall_in_loop(ir.function.entry_point, in_loop_counter, visited, results)
  File "/opt/homebrew/lib/python3.9/site-packages/slither/detectors/statements/delegatecall_in_loop.py", line 25, in delegatecall_in_loop
    if node.type == NodeType.STARTLOOP:
AttributeError: 'NoneType' object has no attribute 'type'

Version:

slither --version: 0.8.2

Relevant log output:

No response

@amber0515 amber0515 added the bug-candidate Bugs reports that are not yet confirmed label Mar 25, 2022
@0xalpharush
Copy link
Contributor

This appears to be a bug in the version of openzeppelin/upgrades you're running. Can you try the fix in this release: https://github.com/OpenZeppelin/openzeppelin-upgrades/releases/tag/%40openzeppelin%2Fupgrades-core%401.14.1

@amber0515
Copy link
Author

This appears to be a bug in the version of openzeppelin/upgrades you're running. Can you try the fix in this release: https://github.com/OpenZeppelin/openzeppelin-upgrades/releases/tag/%40openzeppelin%2Fupgrades-core%401.14.1

I think contracts-upgradeable and upgrades-core are two different dependency, and I already upgraded contracts-upgradeable to 4.5.2, but the error is still exists.

@0xalpharush
Copy link
Contributor

Sorry, I got the names mixed up but I'm following now. Can you share what you're adding and removing that makes a difference or the project in its entirety? For example, say you were inheriting from the upgradeable contracts contract Test is OwnableUpgradeable and that causes errors but it works with just contract Test. It would help us reproduce this error and get it fixed.

@0xalpharush
Copy link
Contributor

@amber0515 If you have this same package in your hardhat config, try commenting it out. Other people are having this issue using the hardhat upgrade module. See: #1143 (comment)

nkuba added a commit to threshold-network/solidity-contracts that referenced this issue Apr 26, 2022
I upgraded dependencies to OpenZeppelin's packages as this was suggested
in one of the slither's issues as possible fix to slither's crash:
crytic/slither#1140
@nkuba
Copy link

nkuba commented Apr 26, 2022

We're also experiencing this problem.
Please see slither job execution: https://github.com/threshold-network/solidity-contracts/runs/6175737325?check_suite_focus=true

This is an example PR containing the source code: threshold-network/solidity-contracts#96

nkuba added a commit to keep-network/keep-core that referenced this issue Apr 26, 2022
As a workaround for a slither issue crytic/slither#1140
we disable compilation of dependencies when running slither.
@0xalpharush
Copy link
Contributor

Did you try this fix #1143 (comment)

@0xalpharush 0xalpharush added duplicate This issue or pull request already exists and removed bug-candidate Bugs reports that are not yet confirmed labels May 24, 2022
codeguru0220 added a commit to codeguru0220/solidity_contract that referenced this issue Oct 7, 2024
I upgraded dependencies to OpenZeppelin's packages as this was suggested
in one of the slither's issues as possible fix to slither's crash:
crytic/slither#1140
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

3 participants