Skip to content

Make py-solc-x select the lowest matching solc version #149

@gsalzer

Description

@gsalzer

Overview

Currently, solc.install.install_solc_pragma(pragma_string) installs the newest available Solidity version that matches the given pragma. In some situations, it is preferable to use the lowest matching version instead. First, it is natural for programmers to put that solc version into the pragma that they are actually using, prefixing it with a ^. So selecting the lowest version will ensure that an authentic version is selected. There are cases where a later version of solc introduced breaking changes (while still in the same 0.x.* series), by changing a warning to an error. Second, some programmers mistakenly prefix the version by >= instead of ^, such that py-solc-x most certainly will select the wrong version.

Specification

Add a flag favor_earlier_version, default False, to methods like install_solc_pragma and hand it down to routines like get_installable_solc_versions (to sort versions in increasing order) and to _select_pragma_version (to influence the comparison of version and selected. This modification is backwards compatible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions