You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running slither <contract id> when we don't have proper solc version installed via solc-select may result in an unambiguous error of Invalid solc compilation which does not describe what shall we do.
Example:
$ slither 0xB8c77482e45F1F44dE1745F52C74426C631bDD52
Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/crytic_compile/platform/solc.py", line 412, in _run_solc
ret = json.loads(stdout)
File "/usr/lib/python3.6/json/__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.6/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/slither/__main__.py", line 721, in main_impl
) = process_all(filename, args, detector_classes, printer_classes)
File "/usr/local/lib/python3.6/dist-packages/slither/__main__.py", line 71, in process_all
compilations = compile_all(target, **vars(args))
File "/usr/local/lib/python3.6/dist-packages/crytic_compile/crytic_compile.py", line 1076, in compile_all
compilations.append(CryticCompile(target, **kwargs))
File "/usr/local/lib/python3.6/dist-packages/crytic_compile/crytic_compile.py", line 137, in __init__
self._compile(**kwargs)
File "/usr/local/lib/python3.6/dist-packages/crytic_compile/crytic_compile.py", line 987, in _compile
self._platform.compile(self, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/crytic_compile/platform/etherscan.py", line 273, in compile
working_dir=working_dir,
File "/usr/local/lib/python3.6/dist-packages/crytic_compile/platform/solc.py", line 417, in _run_solc
raise InvalidCompilation(f"Invalid solc compilation {stderr}")
crytic_compile.platform.exceptions.InvalidCompilation: Invalid solc compilation
ERROR:root:None
ERROR:root:Error in 0xB8c77482e45F1F44dE1745F52C74426C631bDD52
ERROR:root:Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/crytic_compile/platform/solc.py", line 412, in _run_solc
ret = json.loads(stdout)
File "/usr/lib/python3.6/json/__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.6/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/slither/__main__.py", line 721, in main_impl
) = process_all(filename, args, detector_classes, printer_classes)
File "/usr/local/lib/python3.6/dist-packages/slither/__main__.py", line 71, in process_all
compilations = compile_all(target, **vars(args))
File "/usr/local/lib/python3.6/dist-packages/crytic_compile/crytic_compile.py", line 1076, in compile_all
compilations.append(CryticCompile(target, **kwargs))
File "/usr/local/lib/python3.6/dist-packages/crytic_compile/crytic_compile.py", line 137, in __init__
self._compile(**kwargs)
File "/usr/local/lib/python3.6/dist-packages/crytic_compile/crytic_compile.py", line 987, in _compile
self._platform.compile(self, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/crytic_compile/platform/etherscan.py", line 273, in compile
working_dir=working_dir,
File "/usr/local/lib/python3.6/dist-packages/crytic_compile/platform/solc.py", line 417, in _run_solc
raise InvalidCompilation(f"Invalid solc compilation {stderr}")
crytic_compile.platform.exceptions.InvalidCompilation: Invalid solc compilation
I investigated that by adding additional prints of stdout/stderr and process.returncode in
stdout, stderr= (stdout.decode(), stderr.decode()) # convert bytestrings to unicode strings
ifstderrand (notsolc_disable_warnings):
LOGGER.info("Compilation warnings/errors on %s:\n%s", filename, stderr)
try:
ret=json.loads(stdout)
It turns out that the information that solc is not installed is printed out on stdout and so is not passed further to the user:
STDOUT: Version '0.4.12' not installed (set by SOLC_VERSION). Run `solc-select install 0.4.12`.
STDERR:
RETCODE 1
I think we should either make solc-select to print info on stdout, or, make crytic-compile to take such stdout into account, or, make so it respects return code? I didn't check that but shouldn't return code be a good indicator whether the command succeeded?
The text was updated successfully, but these errors were encountered:
Running
slither <contract id>
when we don't have propersolc
version installed viasolc-select
may result in an unambiguous error ofInvalid solc compilation
which does not describe what shall we do.Example:
I investigated that by adding additional prints of stdout/stderr and process.returncode in
crytic-compile/crytic_compile/platform/solc.py
Lines 402 to 409 in d99e5a7
It turns out that the information that solc is not installed is printed out on stdout and so is not passed further to the user:
I think we should either make
solc-select
to print info on stdout, or, make crytic-compile to take such stdout into account, or, make so it respects return code? I didn't check that but shouldn't return code be a good indicator whether the command succeeded?The text was updated successfully, but these errors were encountered: