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

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

Open
gsalzer opened this issue Mar 29, 2022 · 0 comments
Open

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

gsalzer opened this issue Mar 29, 2022 · 0 comments

Comments

@gsalzer
Copy link

gsalzer commented Mar 29, 2022

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.

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

1 participant