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

Docker run on file directory using Foundry fails with unclear errors #1797

Open
VoR0220 opened this issue Sep 9, 2023 · 5 comments
Open

Comments

@VoR0220
Copy link

VoR0220 commented Sep 9, 2023

when I run the following command:

docker run -v $(pwd):/tmp mythril/myth a /tmp/src/Kernel.sol --solc-json mythril.config.json

I am yielding this as my output:

mythril.interfaces.cli [ERROR]: Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/solcx/install.py", line 633, in _validate_installation
    installed_version = wrapper._get_solc_version(binary_path)
  File "/usr/local/lib/python3.10/site-packages/solcx/wrapper.py", line 17, in _get_solc_version
    stdout_data = subprocess.check_output([str(solc_binary), "--version"], encoding="utf8")
  File "/usr/local/lib/python3.10/subprocess.py", line 421, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/local/lib/python3.10/subprocess.py", line 526, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/home/mythril/.solcx/solc-v0.8.0', '--version']' returned non-zero exit status 255.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/mythril/interfaces/cli.py", line 966, in parse_args_and_execute
    address = load_code(disassembler, args)
  File "/usr/local/lib/python3.10/site-packages/mythril/interfaces/cli.py", line 717, in load_code
    address, _ = disassembler.load_from_solidity(
  File "/usr/local/lib/python3.10/site-packages/mythril/mythril/mythril_disassembler.py", line 252, in load_from_solidity
    solc_binary = self.solc_binary or util.extract_binary(file)
  File "/usr/local/lib/python3.10/site-packages/mythril/ethereum/util.py", line 240, in extract_binary
    return solc_exists(version)
  File "/usr/local/lib/python3.10/site-packages/mythril/ethereum/util.py", line 140, in solc_exists
    solcx.install_solc("v" + version)
  File "/usr/local/lib/python3.10/site-packages/solcx/install.py", line 466, in install_solc
    raise exc
  File "/usr/local/lib/python3.10/site-packages/solcx/install.py", line 459, in install_solc
    _validate_installation(version, solcx_binary_path)
  File "/usr/local/lib/python3.10/site-packages/solcx/install.py", line 636, in _validate_installation
    raise SolcInstallationError(
solcx.exceptions.SolcInstallationError: Downloaded binary would not execute, or returned unexpected output. If this issue persists, you can try to compile from source code using `solcx.compile_solc('0.8.0')`.

If it helps I basically copied how to use Mythril in foundry from their static analyzers page into a json file and am trying it on:

github.com/zerodevapp/kernel

@norhh
Copy link
Collaborator

norhh commented Sep 10, 2023

Hi @VoR0220, are you running on M1 or x86?

@VoR0220
Copy link
Author

VoR0220 commented Sep 11, 2023

@norhh I am running on M1

Update: I got it running by configuring the platform. Now getting a new error that seems to indicate a compilation error but I can't seem to figure out how to configure solc versions.

@0x3c5ad
Copy link

0x3c5ad commented Sep 13, 2023

I also encountered this error. My mac is the m1 version. Is there any solution?

@0x3c5ad
Copy link

0x3c5ad commented Sep 13, 2023

But if I set the parameter to --solv 0.4.25, this problem will not exist.

@norhh
Copy link
Collaborator

norhh commented Sep 14, 2023

Hi @ShizhuBaishao, Thank you for the insight.
At value of --solv are you encountering this error?
You can try it by creating an empty contract with varying pragma.

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