py-solc-x
py-solc-x copied to clipboard
py-solc-x handles sequences of version constraints incorrectly
Environment information
py-solc-xVersion: 1.1.1solcVersion: irrelevant- Python Version: 3.8.0
- OS: linux
What was wrong?
Some contracts out there contain sequences of contraints, like https://etherscan.io/address/0x0a76C7913C94F2AF16958FbDF9b4CF0bBdb159d8#code:
pragma solidity =0.6.11 >=0.6.0 <0.8.0 >=0.6.2 <0.8.0;
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 thatfindallwill return all constraints. - In the call to
SimpleSpec, the constraints have to be joined to a single string, separated by commas.
Fixed in PR #148