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 local truffle compile alternative #105

Closed
mattaereal opened this issue Dec 11, 2018 · 2 comments
Closed

Add local truffle compile alternative #105

mattaereal opened this issue Dec 11, 2018 · 2 comments

Comments

@mattaereal
Copy link
Contributor

Currently slither does runs truffle compile before running.
If there is no system or global truffle installed, it fails:

matt@delleite:audit/ (master*) $ slither . 
INFO:Slither:truffle compile running...
ERROR:root:Error in .
ERROR:root:Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/slither_analyzer-0.3.1-py3.7.egg/slither/__main__.py", line 229, in main_impl                                                          
    (results, number_contracts) = process_truffle(filename, args, detector_classes, printer_classes)                                                                            
  File "/usr/lib/python3.7/site-packages/slither_analyzer-0.3.1-py3.7.egg/slither/__main__.py", line 64, in process_truffle                                                     
    process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  File "/usr/lib/python3.7/subprocess.py", line 769, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.7/subprocess.py", line 1516, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'truffle': 'truffle'

Add the option to run npx truffle compile instead of just truffle compile.

@montyly
Copy link
Member

montyly commented Dec 13, 2018

Thanks for you contribution @mattaereal

I slightly changed the format of your PR, the flag is named --truffle-version and takes an argument.

The goal is to also allow any version of truffle to be run.

For example you can run
slither --truffle-version truffle@beta .
To run with Truffle v5 (which uses Solidity 0.5)

Or
slither --truffle-version truffle@4.1.14 .
If you want to use truffle v4 (which uses Solidity 0.4.25)

Note that slither --truffle-version truffle . will also work.

@mattaereal
Copy link
Contributor Author

Excellent. The main idea behind the "local" run, was to use current project's truffle version, but there may be projects that aren't configured correctly or you may opt to use one in top of another.

Thanks for merging :)

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

2 participants