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

Add ability to configure the Solidity compiler #245

Open
samajammin opened this issue Jun 2, 2020 · 0 comments
Open

Add ability to configure the Solidity compiler #245

samajammin opened this issue Jun 2, 2020 · 0 comments

Comments

@samajammin
Copy link
Collaborator

samajammin commented Jun 2, 2020

Summary

Solidity versions get updated regularly yet currently we have a static version hardcoded in the application (0.5.10) & all templates use that version. Attempting to change the version in a project (e.g. 0.6.8) throws an error in the IDE's console:

Using Solidity compiler version 0.5.10
/contracts/Coin.sol:3:1: ParserError: Source file requires different compiler version (current compiler is 0.5.10+commit.5a6ea5b1.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version
pragma solidity 0.6.8;
^--------------------^
[ERROR] Ate bad code and died, compilation aborted.

Motivation

  • Multiple users have requested a way to actually change the selected compiler versions to match their needs
  • Users may want to demo the code of live projects, which often use outdated Solidity versions

Describe alternatives you've considered

Additional context

Outstanding questions

  • What is the best way to add this feature?
    • Sam: I think the simplest way (from the user's perspective) would be to parse the user's smart contract & to update the compiler version accordingly. e.g. in the user's contract, if they save their contract with pragma solidity 0.6.8;, the compiler should update to that version. Perhaps we also add the ability to manually set in the preferences modal for the when the contract does not explicitly set the specific version (e.g. pragma solidity >=0.5.0 <0.7.0;).
  • How to handle multiple contracts?
    • Sam: This is worth considering but I think as a v1, we don't need to solve for this use case. I suspect (can analytics confirm?) that the vast majority of projects only have 1 smart contract. May be worth solving but might be gnarly. I know Truffle & Buidler both struggle with this issue (projects with multiple smart contracts with different versions of Solidity)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants