populus icon indicating copy to clipboard operation
populus copied to clipboard

What is the highest solidity version I can use with Populus?

Open avatar-lavventura opened this issue 7 years ago • 11 comments

  • Populus Version: 2.2.0
  • OS: osx
$ pip freeze | grep populus
populus==2.2.0

$ solc --version
solc, the solidity compiler commandline interface
Version: 0.4.17+commit.bdeb9e52.Darwin.appleclang

Please see: ( https://github.com/ethereum/populus/issues/422#issuecomment-354467917 )

Current fix for this is to use solc<0.4.18 and downgrade populus<2.2.0


As suggested here ( https://github.com/ethereum/populus/issues/454#issuecomment-378752982 ) for some specific keywords such as emit, I need to upgrade solc version to v0.4.21.

=> Overall, what is the highest solidity version I can use with Populus? Could I use Populus with solidity version v0.4.21 ?

avatar-lavventura avatar Nov 15 '18 09:11 avatar-lavventura

@avatar-lavventura populus on master supoorts solidity =<v0.4.24. Install populus from master if you want support for latest solidity.

voith avatar Nov 15 '18 09:11 voith

I am already on the current version v2.2.0. I have done: pip install populus.

avatar-lavventura avatar Nov 15 '18 09:11 avatar-lavventura

@avatar-lavventura v2.2.0 doesn't have support for the latest solidity version, github master does. To install from master do: pip install -e git+https://github.com/voith/populus.git@new-populus-ico#egg=populus

voith avatar Nov 15 '18 09:11 voith

Thank, I have successfully installed populus; but I cannot run it with populus keyword like I used to.

$ pip freeze | grep populus
-e git+https://github.com/voith/populus.git@68331c3f613463a0295d32c43d04771d14bb58d6#egg=populus

avatar-lavventura avatar Nov 15 '18 09:11 avatar-lavventura

oops. I made you install from my fork. the command should be: pip install -e git+https://github.com/ethereum/populus.git#egg=populus.

But doesn't explain the command populus not working. Can you please post the exact error that you're getting.

voith avatar Nov 15 '18 10:11 voith

@voith I do not get any error, just installed populus is not find so I cannot start running populus. What should I do to fix this issue?

$ pip install -e git+https://github.com/ethereum/populus.git#egg=populus --user
...
Successfully installed populus

$ populus
command not found: populus

avatar-lavventura avatar Nov 15 '18 11:11 avatar-lavventura

  • Populus Version: 2.2.0
  • OS: osx
$ pip freeze | grep populus
populus==2.2.0

$ solc --version
solc, the solidity compiler commandline interface
Version: 0.4.17+commit.bdeb9e52.Darwin.appleclang

Please see: ( #422 (comment) )

Current fix for this is to use solc<0.4.18 and downgrade populus<2.2.0

As suggested here ( #454 (comment) ) for some specific keywords such as emit, I need to upgrade solc version to v0.4.21.

=> Overall, what is the highest solidity version I can use with Populus? Could I use Populus with solidity version v0.4.21 ?

Populus Dependencies:

  1. brew install pkg-config libffi autoconf automake libtool openssl
  2. pip3 install populus == 2.2.0
  3. pip3 install eth-utils==0.7.4 web3==3.16.5

Use below solc version with populus 2.2.0 solc --version Version: 0.5.2-develop.2019.1.2+commit.1df8f40c.Darwin.appleclang

arpi9211 avatar Mar 25 '19 06:03 arpi9211

What is proper way to install solc version: 0.5.2-develop.2019.1.2+commit.1df8f40c.Darwin.appleclang on mac? brew automatically installs its latest versin . @arpi9211

Please note that exact contract works on solc v0.4.18.

For the solc version 0.5.7 I am getting following error:

==================================== ERRORS ====================================
________________________ ERROR at setup of test_receipt ________________________

request = <SubRequest 'project' for <Function 'test_receipt'>>
pytestconfig = <_pytest.config.Config object at 0x102509c10>

    @pytest.fixture()
    def project(request, pytestconfig):
        project_dir = get_populus_option(
            cmdline_option="--populus-project",
            ini_option="populus_project",
            environ_var="PYTEST_POPULUS_PROJECT",
            pytestconfig=pytestconfig,
            default=os.getcwd(),
        )

        if not os.path.exists(get_json_config_file_path(project_dir)):
            raise FileNotFoundError(
                "No populus project found for testing in {project_dir}".format(
                    project_dir=project_dir
                )
            )

        contracts = request.config.cache.get(CACHE_KEY_CONTRACTS, None)
        mtime = request.config.cache.get(CACHE_KEY_MTIME, None)

        project = Project(project_dir, create_config_file=True)

        project.fill_contracts_cache(contracts, mtime)
        request.config.cache.set(
            CACHE_KEY_CONTRACTS,
>           normalize_object_for_json(project.compiled_contract_data),
        )

/Library/Python/2.7/site-packages/populus/plugin.py:72:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/Library/Python/2.7/site-packages/populus/project.py:286: in compiled_contract_data
    source_file_paths, compiled_contracts = compile_project_contracts(self)
/Library/Python/2.7/site-packages/populus/compilation/__init__.py:54: in compile_project_contracts
    compiled_contracts = post_process_compiled_contracts(base_compiled_contracts)
/Library/Python/2.7/site-packages/populus/utils/compile.py:135: in post_process_compiled_contracts
    add_full_dependencies_to_compiled_contracts,
cytoolz/functoolz.pyx:589: in cytoolz.functoolz.pipe
    ???
cytoolz/functoolz.pyx:565: in cytoolz.functoolz.c_pipe
    ???
/Library/Python/2.7/site-packages/eth_utils/functional.py:22: in inner
    return callback(fn(*args, **kwargs))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

compiled_contracts = ({'name': 'eBlocBrokerInterface', 'source_path': 'contracts/eBlocBrokerInterface.sol'}, {'name': 'eBlocBroker', 'source_path': 'contracts/eBlocBroker.sol'}, {'name': 'Lib', 'source_path': 'contracts/Lib.sol'})

    @to_tuple
    def add_direct_dependencies_to_compiled_contracts(compiled_contracts):
        for contract_data in compiled_contracts:
            direct_dependencies = set(
                ref['name']
                for ref
>               in itertools.chain(contract_data['linkrefs'], contract_data['linkrefs_runtime'])
            )
E           KeyError: 'linkrefs'

/Library/Python/2.7/site-packages/populus/utils/compile.py:102: KeyError
===================== 1 warnings, 1 error in 0.31 seconds ======================

avatar-lavventura avatar Apr 25 '19 13:04 avatar-lavventura

What is proper way to install solc version: 0.5.2-develop.2019.1.2+commit.1df8f40c.Darwin.appleclang on mac? brew automatically installs its latest versin . @arpi9211

Please note that exact contract works on solc v0.4.18.

For the solc version 0.5.7 I am getting following error:

==================================== ERRORS ====================================
________________________ ERROR at setup of test_receipt ________________________

request = <SubRequest 'project' for <Function 'test_receipt'>>
pytestconfig = <_pytest.config.Config object at 0x102509c10>

    @pytest.fixture()
    def project(request, pytestconfig):
        project_dir = get_populus_option(
            cmdline_option="--populus-project",
            ini_option="populus_project",
            environ_var="PYTEST_POPULUS_PROJECT",
            pytestconfig=pytestconfig,
            default=os.getcwd(),
        )

        if not os.path.exists(get_json_config_file_path(project_dir)):
            raise FileNotFoundError(
                "No populus project found for testing in {project_dir}".format(
                    project_dir=project_dir
                )
            )

        contracts = request.config.cache.get(CACHE_KEY_CONTRACTS, None)
        mtime = request.config.cache.get(CACHE_KEY_MTIME, None)

        project = Project(project_dir, create_config_file=True)

        project.fill_contracts_cache(contracts, mtime)
        request.config.cache.set(
            CACHE_KEY_CONTRACTS,
>           normalize_object_for_json(project.compiled_contract_data),
        )

/Library/Python/2.7/site-packages/populus/plugin.py:72:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/Library/Python/2.7/site-packages/populus/project.py:286: in compiled_contract_data
    source_file_paths, compiled_contracts = compile_project_contracts(self)
/Library/Python/2.7/site-packages/populus/compilation/__init__.py:54: in compile_project_contracts
    compiled_contracts = post_process_compiled_contracts(base_compiled_contracts)
/Library/Python/2.7/site-packages/populus/utils/compile.py:135: in post_process_compiled_contracts
    add_full_dependencies_to_compiled_contracts,
cytoolz/functoolz.pyx:589: in cytoolz.functoolz.pipe
    ???
cytoolz/functoolz.pyx:565: in cytoolz.functoolz.c_pipe
    ???
/Library/Python/2.7/site-packages/eth_utils/functional.py:22: in inner
    return callback(fn(*args, **kwargs))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

compiled_contracts = ({'name': 'eBlocBrokerInterface', 'source_path': 'contracts/eBlocBrokerInterface.sol'}, {'name': 'eBlocBroker', 'source_path': 'contracts/eBlocBroker.sol'}, {'name': 'Lib', 'source_path': 'contracts/Lib.sol'})

    @to_tuple
    def add_direct_dependencies_to_compiled_contracts(compiled_contracts):
        for contract_data in compiled_contracts:
            direct_dependencies = set(
                ref['name']
                for ref
>               in itertools.chain(contract_data['linkrefs'], contract_data['linkrefs_runtime'])
            )
E           KeyError: 'linkrefs'

/Library/Python/2.7/site-packages/populus/utils/compile.py:102: KeyError
===================== 1 warnings, 1 error in 0.31 seconds ======================

Steps for installing solc 0.5.2-develop.2019.1.2+commit.1df8f40c.Darwin.appleclang Prerequisites - macOS: Make sure latest version of Xcode installed 1. git clone --recursive https://github.com/ethereum/solidity.git 2. cd solidity 3. git checkout v0.5.2 4. ./scripts/install_deps.sh —> helper script 5. mkdir build 6. cd build 7. cmake .. && make

arpi9211 avatar Apr 26 '19 08:04 arpi9211

I have tried with solc v0.5.2 but I am having following error:

=========================================================================== ERRORS ===========================================================================
_______________________________________________________________ ERROR at setup of test_greeter _______________________________________________________________

request = <SubRequest 'project' for <Function 'test_greeter'>>, pytestconfig = <_pytest.config.Config object at 0x10b26ac10>

    @pytest.fixture()
    def project(request, pytestconfig):
        project_dir = get_populus_option(
            cmdline_option="--populus-project",
            ini_option="populus_project",
            environ_var="PYTEST_POPULUS_PROJECT",
            pytestconfig=pytestconfig,
            default=os.getcwd(),
        )

        if not os.path.exists(get_json_config_file_path(project_dir)):
            raise FileNotFoundError(
                "No populus project found for testing in {project_dir}".format(
                    project_dir=project_dir
                )
            )

        contracts = request.config.cache.get(CACHE_KEY_CONTRACTS, None)
        mtime = request.config.cache.get(CACHE_KEY_MTIME, None)

        project = Project(project_dir, create_config_file=True)

        project.fill_contracts_cache(contracts, mtime)
        request.config.cache.set(
            CACHE_KEY_CONTRACTS,
>           normalize_object_for_json(project.compiled_contract_data),
        )

/Library/Python/2.7/site-packages/populus/plugin.py:72:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/Library/Python/2.7/site-packages/populus/project.py:286: in compiled_contract_data
    source_file_paths, compiled_contracts = compile_project_contracts(self)
/Library/Python/2.7/site-packages/populus/compilation/__init__.py:52: in compile_project_contracts
    import_remappings=project.config.get('compilation.import_remappings'),
/Library/Python/2.7/site-packages/populus/compilation/backends/solc_auto.py:55: in get_compiled_contracts
    return self.proxy_backend.get_compiled_contracts(*args, **kwargs)
/Library/Python/2.7/site-packages/populus/compilation/backends/solc_standard_json.py:138: in get_compiled_contracts
    compiled_contracts = normalize_compilation_result(compilation_result)
/Library/Python/2.7/site-packages/eth_utils/functional.py:22: in inner
    return callback(fn(*args, **kwargs))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

compilation_result = {'errors': [{'component': 'general', 'formattedMessage': 'Warning: This is a pre-release compiler version, please do n...n, please do not use it in production.', 'severity': 'warning', ...}], 'sources': {'contracts/Greeter.sol': {'id': 0}}}

    @to_tuple
    def normalize_compilation_result(compilation_result):
        """
        Take the result from the --standard-json compilation and flatten it into an
        interable of contract data dictionaries.
        """
>       for source_path, file_contracts in compilation_result['contracts'].items():
E       KeyError: 'contracts'

/Library/Python/2.7/site-packages/populus/compilation/backends/solc_standard_json.py:81: KeyError
___________________________________________________________ ERROR at setup of test_custom_greeting ___________________________________________________________

request = <SubRequest 'project' for <Function 'test_custom_greeting'>>, pytestconfig = <_pytest.config.Config object at 0x10b26ac10>

    @pytest.fixture()
    def project(request, pytestconfig):
        project_dir = get_populus_option(
            cmdline_option="--populus-project",
            ini_option="populus_project",
            environ_var="PYTEST_POPULUS_PROJECT",
            pytestconfig=pytestconfig,
            default=os.getcwd(),
        )

        if not os.path.exists(get_json_config_file_path(project_dir)):
            raise FileNotFoundError(
                "No populus project found for testing in {project_dir}".format(
                    project_dir=project_dir
                )
            )

        contracts = request.config.cache.get(CACHE_KEY_CONTRACTS, None)
        mtime = request.config.cache.get(CACHE_KEY_MTIME, None)

        project = Project(project_dir, create_config_file=True)

        project.fill_contracts_cache(contracts, mtime)
        request.config.cache.set(
            CACHE_KEY_CONTRACTS,
>           normalize_object_for_json(project.compiled_contract_data),
        )

/Library/Python/2.7/site-packages/populus/plugin.py:72:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/Library/Python/2.7/site-packages/populus/project.py:286: in compiled_contract_data
    source_file_paths, compiled_contracts = compile_project_contracts(self)
/Library/Python/2.7/site-packages/populus/compilation/__init__.py:52: in compile_project_contracts
    import_remappings=project.config.get('compilation.import_remappings'),
/Library/Python/2.7/site-packages/populus/compilation/backends/solc_auto.py:55: in get_compiled_contracts
    return self.proxy_backend.get_compiled_contracts(*args, **kwargs)
/Library/Python/2.7/site-packages/populus/compilation/backends/solc_standard_json.py:138: in get_compiled_contracts
    compiled_contracts = normalize_compilation_result(compilation_result)
/Library/Python/2.7/site-packages/eth_utils/functional.py:22: in inner
    return callback(fn(*args, **kwargs))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

compilation_result = {'errors': [{'component': 'general', 'formattedMessage': 'Warning: This is a pre-release compiler version, please do n...n, please do not use it in production.', 'severity': 'warning', ...}], 'sources': {'contracts/Greeter.sol': {'id': 0}}}

    @to_tuple
    def normalize_compilation_result(compilation_result):
        """
        Take the result from the --standard-json compilation and flatten it into an
        interable of contract data dictionaries.
        """
>       for source_path, file_contracts in compilation_result['contracts'].items():
E       KeyError: 'contracts'

/Library/Python/2.7/site-packages/populus/compilation/backends/solc_standard_json.py:81: KeyError

avatar-lavventura avatar Apr 26 '19 09:04 avatar-lavventura

I have tried with solc v0.5.2 but I am having following error:

=========================================================================== ERRORS ===========================================================================
_______________________________________________________________ ERROR at setup of test_greeter _______________________________________________________________

request = <SubRequest 'project' for <Function 'test_greeter'>>, pytestconfig = <_pytest.config.Config object at 0x10b26ac10>

    @pytest.fixture()
    def project(request, pytestconfig):
        project_dir = get_populus_option(
            cmdline_option="--populus-project",
            ini_option="populus_project",
            environ_var="PYTEST_POPULUS_PROJECT",
            pytestconfig=pytestconfig,
            default=os.getcwd(),
        )

        if not os.path.exists(get_json_config_file_path(project_dir)):
            raise FileNotFoundError(
                "No populus project found for testing in {project_dir}".format(
                    project_dir=project_dir
                )
            )

        contracts = request.config.cache.get(CACHE_KEY_CONTRACTS, None)
        mtime = request.config.cache.get(CACHE_KEY_MTIME, None)

        project = Project(project_dir, create_config_file=True)

        project.fill_contracts_cache(contracts, mtime)
        request.config.cache.set(
            CACHE_KEY_CONTRACTS,
>           normalize_object_for_json(project.compiled_contract_data),
        )

/Library/Python/2.7/site-packages/populus/plugin.py:72:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/Library/Python/2.7/site-packages/populus/project.py:286: in compiled_contract_data
    source_file_paths, compiled_contracts = compile_project_contracts(self)
/Library/Python/2.7/site-packages/populus/compilation/__init__.py:52: in compile_project_contracts
    import_remappings=project.config.get('compilation.import_remappings'),
/Library/Python/2.7/site-packages/populus/compilation/backends/solc_auto.py:55: in get_compiled_contracts
    return self.proxy_backend.get_compiled_contracts(*args, **kwargs)
/Library/Python/2.7/site-packages/populus/compilation/backends/solc_standard_json.py:138: in get_compiled_contracts
    compiled_contracts = normalize_compilation_result(compilation_result)
/Library/Python/2.7/site-packages/eth_utils/functional.py:22: in inner
    return callback(fn(*args, **kwargs))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

compilation_result = {'errors': [{'component': 'general', 'formattedMessage': 'Warning: This is a pre-release compiler version, please do n...n, please do not use it in production.', 'severity': 'warning', ...}], 'sources': {'contracts/Greeter.sol': {'id': 0}}}

    @to_tuple
    def normalize_compilation_result(compilation_result):
        """
        Take the result from the --standard-json compilation and flatten it into an
        interable of contract data dictionaries.
        """
>       for source_path, file_contracts in compilation_result['contracts'].items():
E       KeyError: 'contracts'

/Library/Python/2.7/site-packages/populus/compilation/backends/solc_standard_json.py:81: KeyError
___________________________________________________________ ERROR at setup of test_custom_greeting ___________________________________________________________

request = <SubRequest 'project' for <Function 'test_custom_greeting'>>, pytestconfig = <_pytest.config.Config object at 0x10b26ac10>

    @pytest.fixture()
    def project(request, pytestconfig):
        project_dir = get_populus_option(
            cmdline_option="--populus-project",
            ini_option="populus_project",
            environ_var="PYTEST_POPULUS_PROJECT",
            pytestconfig=pytestconfig,
            default=os.getcwd(),
        )

        if not os.path.exists(get_json_config_file_path(project_dir)):
            raise FileNotFoundError(
                "No populus project found for testing in {project_dir}".format(
                    project_dir=project_dir
                )
            )

        contracts = request.config.cache.get(CACHE_KEY_CONTRACTS, None)
        mtime = request.config.cache.get(CACHE_KEY_MTIME, None)

        project = Project(project_dir, create_config_file=True)

        project.fill_contracts_cache(contracts, mtime)
        request.config.cache.set(
            CACHE_KEY_CONTRACTS,
>           normalize_object_for_json(project.compiled_contract_data),
        )

/Library/Python/2.7/site-packages/populus/plugin.py:72:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/Library/Python/2.7/site-packages/populus/project.py:286: in compiled_contract_data
    source_file_paths, compiled_contracts = compile_project_contracts(self)
/Library/Python/2.7/site-packages/populus/compilation/__init__.py:52: in compile_project_contracts
    import_remappings=project.config.get('compilation.import_remappings'),
/Library/Python/2.7/site-packages/populus/compilation/backends/solc_auto.py:55: in get_compiled_contracts
    return self.proxy_backend.get_compiled_contracts(*args, **kwargs)
/Library/Python/2.7/site-packages/populus/compilation/backends/solc_standard_json.py:138: in get_compiled_contracts
    compiled_contracts = normalize_compilation_result(compilation_result)
/Library/Python/2.7/site-packages/eth_utils/functional.py:22: in inner
    return callback(fn(*args, **kwargs))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

compilation_result = {'errors': [{'component': 'general', 'formattedMessage': 'Warning: This is a pre-release compiler version, please do n...n, please do not use it in production.', 'severity': 'warning', ...}], 'sources': {'contracts/Greeter.sol': {'id': 0}}}

    @to_tuple
    def normalize_compilation_result(compilation_result):
        """
        Take the result from the --standard-json compilation and flatten it into an
        interable of contract data dictionaries.
        """
>       for source_path, file_contracts in compilation_result['contracts'].items():
E       KeyError: 'contracts'

/Library/Python/2.7/site-packages/populus/compilation/backends/solc_standard_json.py:81: KeyError

Can you please provide your smart contract to understand your error?

arpi9211 avatar Apr 29 '19 06:04 arpi9211