Should I upgrade from Solidity 0.5.X

Hello!

I am creating a protocol and the smart contract currently uses Solidity 0.5.17. I wanted to use stack trace with Truffle and saw that it requires 0.6.0 and then I did some research and saw that it goes all the way up to 0.8.1. I was wondering if It is recommended that I upgrade to 0.6.0 or even all the way up to 0.8.0.

Also, I found these doc with some instructions:
https://docs.soliditylang.org/en/v0.6.0/060-breaking-changes.html#how-to-update-your-code
https://docs.soliditylang.org/en/v0.7.0/070-breaking-changes.html#how-to-update-your-code
<there is an equivalent one for 0.8.0, but It will only let me add 2 links>
Also, I am using Open Zeppelin for Proxy contract upgrades and Uniswap in case that will cause an issue.

My questions are:

  1. How difficult will it be to upgrade to 0.6.0 and will I need to do anything other than what’s in the doc there / Is there anything else I need to be aware of in upgrading?
  2. Would you recommend upgrading all the way to 0.8.X? Are there any additional benefits? Will there be any additional difficulties?
  3. Do I need to do anything about the in-between versions. (eg. 0.6.X)

Thanks in advance for your help!!

1 Like

Hi @brendan,

Are you upgrading an existing contract deployed on mainnet?

If you are upgrading, then there will be limitations on what versions of OpenZeppelin Contracts Upgradeable (previously called OpenZeppelin Contracts Ethereum Package) you can use in your implementation contract.

If you are not upgrading, then you can change to the latest version of Solidity that your dependencies support. OpenZeppelin Contracts 3.4 supports Solidity 0.6 and Solidity 0.7.
OpenZeppelin Contracts 4.0 Beta supports Solidity 0.8 and is currently at release candidate stage.

It really depends what you use in your contract. You can follow the Solidity breaking changes. Appropriate unit testing is advised to check that you don't break anything in your smart contract.

If you can wait for OpenZeppelin Contracts 4 to be released then I would look at using Solidity 0.8.

You can go from Solidity 0.5 to 0.6 to 0.7 to 0.8 or jump straight to 0.8. It depends on the complexity of your code.

Hello! Thank you so much for the reply.

This is a new contract!

The code is fairly complex: ~20 files. I guess my question is whether if there is the benefit to upgrading?

1 Like