ApeWorX / py-solc-x

Python wrapper and version management tool for the solc Solidity compiler.

Home Page:https://solcx.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

_download_solc throws TypeError for v0.4.26

jonathanmalo opened this issue · comments

Environment information

from eth-brownie/brownie#512

  • brownie Version: 1.8.4
  • ganache-cli Version: 6.9.1
  • solc Version: solc installed with py-solc-x
  • Python Version: 3.7.6
  • OS: Fedora 31

What was wrong?

Using the following brownie-config.yaml:

compiler:
    solc:
        version: 0.4.26

and test.sol in contracts directory:

pragma solidity 0.4.26;

contract test {}

get following error from running brownie compile

Brownie v1.8.4 - Python development framework for Ethereum

Downloading solc v0.4.26 from https://github.com/ethereum/solidity/releases/download/v0.4.26/solc-static-linux
  0%|                                                                                                | 0.00/40.0 [00:00<?, ?iB/s]  File "brownie/_cli/__main__.py", line 58, in main
    importlib.import_module(f"brownie._cli.{cmd}").main()
  File "brownie/_cli/compile.py", line 32, in main
    project.load(project_path)
  File "brownie/project/main.py", line 543, in load
    return Project(name, project_path)
  File "brownie/project/main.py", line 154, in __init__
    self.load()
  File "brownie/project/main.py", line 204, in load
    self._compile(changed, self._compiler_config, False)
  File "brownie/project/main.py", line 93, in _compile
    optimizer=compiler_config["solc"].get("optimizer", None),
  File "brownie/project/compiler/__init__.py", line 112, in compile_and_format
    set_solc_version(version)
  File "brownie/project/compiler/solidity.py", line 82, in set_solc_version
    install_solc(version)
  File "brownie/project/compiler/solidity.py", line 90, in install_solc
    solcx.install_solc(str(version), show_progress=True)
  File "solcx/install.py", line 227, in install_solc
    _install_solc_linux(version, show_progress, solcx_binary_path)
  File "solcx/install.py", line 310, in _install_solc_linux
    content = _download_solc(download, show_progress)
  File "solcx/install.py", line 293, in _download_solc
    content += data
TypeError: can't concat str to bytes

I think the issue is that a 0.4.26 binary isn't available for linux. But definitely this error message needs to be improved, and probably an option should be given to compile from source.