solc determines the specified version correctly as 0.6.11. py-solc-x, however, takes the last constraint only and determines 0.7.6 as matching version.
How can it be fixed?
In solcx/install.py, in the function _select_pragma_version, two changes are required:
The last quantifier + in the regex (([<>]?=?|\^)\d+\.\d+\.\d+)+ has to be removed, such that findall will return all constraints.
In the call to SimpleSpec, the constraints have to be joined to a single string, separated by commas.
Environment information
py-solc-x
Version: 1.1.1solc
Version: irrelevantWhat was wrong?
Some contracts out there contain sequences of contraints, like https://etherscan.io/address/0x0a76C7913C94F2AF16958FbDF9b4CF0bBdb159d8#code:
solc
determines the specified version correctly as0.6.11
.py-solc-x
, however, takes the last constraint only and determines0.7.6
as matching version.How can it be fixed?
In
solcx/install.py
, in the function_select_pragma_version
, two changes are required:+
in the regex(([<>]?=?|\^)\d+\.\d+\.\d+)+
has to be removed, such thatfindall
will return all constraints.SimpleSpec
, the constraints have to be joined to a single string, separated by commas.Fixed in PR #148