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

Add Support for Brownie #638

Closed
fubuloubu opened this issue Sep 18, 2020 · 8 comments
Closed

Add Support for Brownie #638

fubuloubu opened this issue Sep 18, 2020 · 8 comments

Comments

@fubuloubu
Copy link

Getting some weird issues when I install slither in a Brownie project, probably because Brownie uses py-solcx to manage solidity installations (and vvm for Vyper)

Yearn/contracts$ slither contracts/                                                                                                                                           [160/473]
Traceback (most recent call last):                                                                                                                                                                          
  File "/home/bryant/.pyenv/versions/3.8.5/envs/brownie/lib/python3.8/site-packages/crytic_compile/platform/solc.py", line 243, in get_version                                                              
    process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)                                                                                                                         
  File "/home/bryant/.pyenv/versions/3.8.5/lib/python3.8/subprocess.py", line 854, in __init__                                                                                                              
    self._execute_child(args, executable, preexec_fn, close_fds,                                                                                                                                            
  File "/home/bryant/.pyenv/versions/3.8.5/lib/python3.8/subprocess.py", line 1702, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)                                     
FileNotFoundError: [Errno 2] No such file or directory: 'solc'       
...
@montyly
Copy link
Member

montyly commented Sep 21, 2020

Hi @fubuloubu, thanks for reporting this.

Can you try slither .? The target must be the top directory of the project. As long as you have a file named brownie-config.json or brownie-config.yaml, slither should work with Brownie

@fubuloubu
Copy link
Author

Sorry about that, I meant to do slither . originally:

$ slither .
Brownie v1.11.4 - Python development framework for Ethereum

Compiling contracts...
  Solc version: 0.5.17
  Optimizer: Enabled  Runs: 200
  EVM Version: Istanbul
Generating build data...
...

Generating interface ABIs...
Project has been compiled. Build artifacts saved at Yearn/contracts/build/contracts

ERROR:ContractSolcParsing:Missing inheritance <slither.solc_parsing.declarations.contract.ContractSolc object at 0x7fb00642e190>
ERROR:ContractSolcParsing:Missing inheritance <slither.solc_parsing.declarations.contract.ContractSolc object at 0x7fb006413490>
ERROR:ContractSolcParsing:Missing inheritance <slither.solc_parsing.declarations.contract.ContractSolc object at 0x7fb006413a00>
Traceback (most recent call last):
  File "python3.8/site-packages/slither/__main__.py", line 692, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "python3.8/site-packages/slither/__main__.py", line 79, in process_all
    ) = process_single(compilation, args, detector_classes, printer_classes)
  File "python3.8/site-packages/slither/__main__.py", line 62, in process_single
    slither = Slither(target, ast_format=ast, **vars(args))
  File "python3.8/site-packages/slither/slither.py", line 100, in __init__
    self._parser.analyze_contracts()
  File "python3.8/site-packages/slither/solc_parsing/slitherSolc.py", line 326, in analyze_contracts
    self._analyze_all_enums(contracts_to_be_analyzed)
  File "python3.8/site-packages/slither/solc_parsing/slitherSolc.py", line 363, in _analyze_all_enums
    all_father_analyzed = all(
  File "python3.8/site-packages/slither/solc_parsing/slitherSolc.py", line 364, in <genexpr>
    self._underlying_contract_to_parser[father].is_analyzed
KeyError: None
ERROR:root:None
ERROR:root:Error in .
ERROR:root:Traceback (most recent call last):
  File "python3.8/site-packages/slither/__main__.py", line 692, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "python3.8/site-packages/slither/__main__.py", line 79, in process_all
    ) = process_single(compilation, args, detector_classes, printer_classes)
  File "python3.8/site-packages/slither/__main__.py", line 62, in process_single
    slither = Slither(target, ast_format=ast, **vars(args))
  File "python3.8/site-packages/slither/slither.py", line 100, in __init__
    self._parser.analyze_contracts()
  File "python3.8/site-packages/slither/solc_parsing/slitherSolc.py", line 326, in analyze_contracts
    self._analyze_all_enums(contracts_to_be_analyzed)
  File "python3.8/site-packages/slither/solc_parsing/slitherSolc.py", line 363, in _analyze_all_enums
    all_father_analyzed = all(
  File "python3.8/site-packages/slither/solc_parsing/slitherSolc.py", line 364, in <genexpr>
    self._underlying_contract_to_parser[father].is_analyzed
KeyError: None

@montyly
Copy link
Member

montyly commented Sep 24, 2020

After a discussion with @fubuloubu, we found that the issue was coming from brownie (eth-brownie/brownie#772)

I am closing this issue, I will keep track of the brownie issue to see how to better integrate brownie's projects with dependencies

@fubuloubu
Copy link
Author

still seeing issues:

Project has been compiled. Build artifacts saved at ~/Yearn/vaults/build/contracts

Traceback (most recent call last):
  File "~/.pyenv/versions/3.8.6/envs/yearn/lib/python3.8/site-packages/slither/__main__.py", line 712, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "~/.pyenv/versions/3.8.6/envs/yearn/lib/python3.8/site-packages/slither/__main__.py", line 71, in process_all
    compilations = compile_all(target, **vars(args))
  File "~/.pyenv/versions/3.8.6/envs/yearn/lib/python3.8/site-packages/crytic_compile/crytic_compile.py", line 1076, in compile_all
    compilations.append(CryticCompile(target, **kwargs))
  File "~/.pyenv/versions/3.8.6/envs/yearn/lib/python3.8/site-packages/crytic_compile/crytic_compile.py", line 137, in __init__
    self._compile(**kwargs)
  File "~/.pyenv/versions/3.8.6/envs/yearn/lib/python3.8/site-packages/crytic_compile/crytic_compile.py", line 987, in _compile
    self._platform.compile(self, **kwargs)
  File "~/.pyenv/versions/3.8.6/envs/yearn/lib/python3.8/site-packages/crytic_compile/platform/brownie.py", line 77, in compile
    _iterate_over_files(crytic_compile, self._target, filenames)
  File "~/.pyenv/versions/3.8.6/envs/yearn/lib/python3.8/site-packages/crytic_compile/platform/brownie.py", line 141, in _iterate_over_files
    filename_txt = target_loaded["ast"]["absolutePath"]
KeyError: 'absolutePath'
ERROR:root:None
ERROR:root:Error in .
ERROR:root:Traceback (most recent call last):
  File "~/.pyenv/versions/3.8.6/envs/yearn/lib/python3.8/site-packages/slither/__main__.py", line 712, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "~/.pyenv/versions/3.8.6/envs/yearn/lib/python3.8/site-packages/slither/__main__.py", line 71, in process_all
    compilations = compile_all(target, **vars(args))
  File "~/.pyenv/versions/3.8.6/envs/yearn/lib/python3.8/site-packages/crytic_compile/crytic_compile.py", line 1076, in compile_all
    compilations.append(CryticCompile(target, **kwargs))
  File "~/.pyenv/versions/3.8.6/envs/yearn/lib/python3.8/site-packages/crytic_compile/crytic_compile.py", line 137, in __init__
    self._compile(**kwargs)
  File "~/.pyenv/versions/3.8.6/envs/yearn/lib/python3.8/site-packages/crytic_compile/crytic_compile.py", line 987, in _compile
    self._platform.compile(self, **kwargs)
  File "~/.pyenv/versions/3.8.6/envs/yearn/lib/python3.8/site-packages/crytic_compile/platform/brownie.py", line 77, in compile
    _iterate_over_files(crytic_compile, self._target, filenames)
  File "~/.pyenv/versions/3.8.6/envs/yearn/lib/python3.8/site-packages/crytic_compile/platform/brownie.py", line 141, in _iterate_over_files
    filename_txt = target_loaded["ast"]["absolutePath"]
KeyError: 'absolutePath'

@montyly
Copy link
Member

montyly commented Mar 24, 2021

Hi @fubuloubu, can you share the codebase where this happens?

Note that we have currently a partial support of brownie due to eth-brownie/brownie#941

@fubuloubu
Copy link
Author

fubuloubu commented Mar 24, 2021

@princearoragithub
Copy link

Hey,

Seeing the same issue as @fubuloubu .

Any updates on this ?

@montyly
Copy link
Member

montyly commented Apr 1, 2021

Hi @princearoragithub ,

We will see how to fix this issue next week. You can follow the progress here: crytic/crytic-compile#165

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants