What compiler version to use?

Hello Everyone,

First of all, I am new to ethereum token development. Many thanks to OpenZeppelin, I managed get up and running very easily and I am experimenting with non-fungible tokens

I would like to ask a novice question about compiler versions.

Is it a smart idea to always use latest compiler? Looks like myetherscan supports 0.5.8 compiler but all openzeppelin contracts are using 0.5.0

Should I be using 0.5.0? OR 0.5.8?

What are the pros/cons? how do you guys make compiler versioning decisions?

Please help me to understand this.

2 Likes

Hi @Jeff welcome to the community.

OpenZeppelin 2.3.0 RC3 uses 0.5.7. See the forum post for the reasoning:

truffle-config.js specifies 0.5.7.

https://github.com/OpenZeppelin/openzeppelin-solidity/blob/v2.3.0-rc.3/truffle-config.js

const solcStable = {
  version: '0.5.7',
};

Whilst the contracts themselves specify 0.5.0 and above.

https://github.com/OpenZeppelin/openzeppelin-solidity/blob/v2.3.0-rc.3/contracts/examples/SimpleToken.sol
pragma solidity ^0.5.0;


I personally tend to use the latest solc version supported by my toolset. Primarily to include any solc bug fixes.

The solc release notes can be found here:

When you have a moment it would be awesome if you could introduce yourself and/or let us know what you are working on.

2 Likes

Hello @Jeff, thank you for bringing this up! I don’t think there’s been much discussion regarding compiler versions here.

Note that OpenZeppelin’s contracts specify a minimum compiler version, that is, you must use v0.5.0 or newer. Different people may use different versions for their own reasons, and we decided not to be too restrictive about it. You can read more about that decision here.

That said, I’d personally recommend using v0.5.7 at the very least, since it contains known bugfixes for previous releases.

4 Likes

Hi @Jeff, I have marked @nventuro reply as the solution to your question. Let us know if you have more questions.

1 Like