ApeWorX / py-solc-x

Python wrapper and version management tool for the solc Solidity compiler.
https://solcx.readthedocs.io/
MIT License
138 stars 48 forks source link

py-solc-x handles sequences of version constraints incorrectly #147

Closed gsalzer closed 10 months ago

gsalzer commented 2 years ago

Environment information

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:

Fixed in PR #148