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

Raise exception when compiler version is not supported by solc-select #234

Closed

Conversation

0xalpharush
Copy link
Contributor

Currently, when an unsupported version of solc is used for the Etherscan platform an invalid compilation error is raised. It would be helpful to indicate that solc-select does not some solc versions. It does raise an argparse error so it's clear when using from the command line. Since we're calling an internal solc-select API, I figure crytic-compile should do the error handling/ validation.

solc-select install 0.3.5
>>>solc-select install: error: argument INSTALL_VERSIONS: Invalid version - only solc versions above '0.3.6' are available

@0xalpharush 0xalpharush force-pushed the check-solc-select-support branch from 1ca8698 to 4c8bafd Compare December 30, 2021 16:06
@0xalpharush 0xalpharush force-pushed the check-solc-select-support branch from 4c8bafd to bee5969 Compare March 14, 2022 16:43
@0xalpharush 0xalpharush force-pushed the check-solc-select-support branch from bee5969 to 136a0ce Compare March 14, 2022 16:49
if self.version not in solc_select.installed_versions():
if (
self.version not in solc_select.installed_versions()
and self.version in solc_select.get_available_versions()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get_available_versions makes an url query. install_artifacts calls also get_available_versions, so here we end up making two time the same URL query, which is not great.

Maybe we can rather update solc-select to return boolean in install_artifacts to indicate success?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like install_artifacts returns True on success as of this PR to solc-select and, as before, throws on failure. Given the throw on failure, we could try/catch the install_artifacts call instead of using an if statement to save the extra url query.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that was an oversight. We should return false crytic/solc-select#143. I also opened issues to cache these requests crytic/solc-select#145.

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

Successfully merging this pull request may close these issues.

3 participants