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 support for custom compiler version #265

Closed
chevdor opened this issue Sep 20, 2016 · 11 comments

Comments

Projects
None yet
9 participants
@chevdor
Copy link

commented Sep 20, 2016

Currently, the version ^0.3.5 of solc is used.
The solidity compiler does not produce the same results depending on the on the version used.
Dapp developpers may want to control which version is used.

The ability to provide a custom version in the config/as option would be great.
Then use this version while invoking the solidity compiler as:
var solcV011 = solc.useVersion('v0.1.1-2015-08-04-6ff4cd6');

@rfikki

This comment has been minimized.

Copy link

commented Sep 26, 2016

+1

@tcoulter

This comment has been minimized.

Copy link
Contributor

commented Sep 26, 2016

In general I see this as a good feature. However, I'd guess you want this feature so you can bump the version up to solidity 0.4.x, right? If so, this solution will likely cause more problems than it solves.

The main reason Truffle hasn't been bumped up to version 0.4.x already is because of the introduction of breaking changes: Specifically the pragma statement. This is an issue because Truffle uses a library called solidity-parser in order to perform some preprocessing, and solidity-parser needs to be upgraded to support the pragma statement before you can use 0.4.x with Truffle. If you were to use the proposed feature to upgrade the version to 0.4.x, Truffle will error before compilation ever occurs.

Where this feature could be very useful is downgrading the compiler version, or setting a specific compiler version for testing purposes (aka, testing the compiler) or locking your project into a specific version. But it won't be able to go forward past the latest version Truffle supports (0.3.5 in this case). If we implement this feature, we need to ensure we don't allow users to go higher than the latest version supported as that will cause unexpected errors.

To better understand your use case, why do you want to specify the version?

@chevdor

This comment has been minimized.

Copy link
Author

commented Sep 26, 2016

Actually, the main reason is not only 0.4.x but exactly what you mentioned about the downgrading.

Compilers do not behave the same, so while it is advised using the latest, sometimes, people prefer to use a given (older) version.

The 0.4.x example you mention is a good one, we should use 0.4.x, but for now we don´t (whatever the reasons are).

I think it would be fair to have such feature, and as you suggest, lock it down, at least for now, to a given set of versions (ie everything < 0.4.x)

To avoid any extra issue reports, I would specifically point to this ticket since you now nicely explained why 0.4.x cannot yet be working :)

@area

This comment has been minimized.

Copy link
Contributor

commented Jan 27, 2017

Now that the main branch is on 0.4.x, can this be revisited? Solidity 0.4.8 breaks contracts generated by Solcover, so it would have been nice to have this feature to force people to use 0.4.7 until 0.4.9 comes out (which won't have this problem).

@vongohren

This comment has been minimized.

Copy link

commented May 7, 2017

Any progress on this? Im trying to use 0.4.10, but my truffle is stuck on 0.4.8. Even if my solc --version is 0.4.10

@tcoulter

This comment has been minimized.

Copy link
Contributor

commented May 7, 2017

A new version of Truffle with Solidity 0.4.11 will be released tomorrow (Monday). However, Truffle can't yet support custom compiler versions because of Solidity releasing breaking API changes on minor versions (generally considered a no no). For instance, in the last three versions (0.4.9 to 0.4.11), the API has changed twice; in order to keep Truffle from automatically breaking and preventing users from compiling at all, we have to lock down the compiler to a specific version.

We're unlikely to implement custom compiler version support until Solidity adopts better release practices, which will likely come as Solidity matures.

@tcoulter

This comment has been minimized.

Copy link
Contributor

commented May 7, 2017

I'm going to close this issue as I don't see this feature being possible in the short term. Additionally, the desire for "custom compiler versions" generally translates to a desire for the latest version, which we try to stay on top of as much as possible. We didn't upgrade to 0.4.9 or 0.4.10 because of a breaking change to the compiler output that prevented Truffle from linking library contracts. Other tools were affected as well.

@benjaminmbrown

This comment has been minimized.

Copy link

commented Jun 22, 2018

I have a use case wherein I have a requirement to test a client's smart contracts written in previous compiler versions. Currently remix allows specification for any compiler version. Just thought I'd bring up this case where latest version is not always the desire.

@cgewecke

This comment has been minimized.

Copy link
Contributor

commented Jun 22, 2018

@benjaminmbrown We've just started publishing an experimental build - truffle@byoc - which automatically pulls down any compiler you'd like from solc-bin. You just have to set a key in the truffle.js config specifying the version.

Usage docs

Install

npm install -g truffle@byoc

It's current with 4.1.12 - please report its bugs :)

@cgewecke cgewecke reopened this Jun 22, 2018

@aleybovich

This comment has been minimized.

Copy link

commented Oct 17, 2018

@cgewecke Is this feature in the latest 5.0.1 beta? I just realized I need to compile abi's for multiple solc versions at the same time and looking for ways to do that.

@gnidan

This comment has been minimized.

Copy link
Member

commented Oct 24, 2018

@aleybovich This is in the beta, but not what you're asking for. Truffle v5 supports specifying a single solc version to use, but does not support multiple simultaneous versions of solc natively.

Please feel free to open an issue for the "multiple versions" enhancement if you would like. In the meantime, closing this issue for maintenance. Thanks!

@gnidan gnidan closed this Oct 24, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.