Openzeppelin-contracts: Support for Solidity 0.6.0

Created on 18 Dec 2019  路  11Comments  路  Source: OpenZeppelin/openzeppelin-contracts

馃 Motivation

OpenZeppelin Contracts support for Solidity 0.6 has been requested in the forum: https://forum.openzeppelin.com/t/when-solidity-0-6-0-support-for-oz-contracts-library/1948

馃摑 Details

Create a version of OpenZeppelin Contracts with support for Solidity 0.6.


breaking change contracts

Most helpful comment

@thecircleoflifefree This will definitely happen before Q2, and most likely during January. We are analyzing this and will post as soon as we have any estimates.

All 11 comments

0.6 includes many things that will probably result in a new major release of the OpenZeppelin Contracts.

Some snippets from the release notes that I think will be relevant for us:

Language features

  • Allow explicit conversions from address to address payable via payable(...).

We'll want to remove Address.toPayable.

  • Allow global enums and structs.

We should review the structs that we have and see if they should be made global.

  • Introduce virtual and override keywords.

This is probably the biggest one, as we will have to decide what functions should be overrideable. The sentiment in the team is that we should be tolerant of extension, because users already expect this, and so a lot of things will have to be overrideable.

  • Introduce try/catch-statement

We have some instances where we use .call only because we need to catch any potential reverts. This feature will be very useful, and likely remove all manual .calls or .staticalls.

Compiler Features:

  • Allow revert strings to be stripped from the binary using the --revert-strings option or the settings.debug.revertStrings setting.

We might want to use this flag when compiling the artifacts that are included in the package.

There's a very useful "how to update your code" guide in the Solidity docs. We should also include this in our release notes when we update to 0.6.

https://solidity.readthedocs.io/en/v0.6.0/060-breaking-changes.html#how-to-update-your-code

Is there an estimate ETA for the official support? Will it set before or after Q2?

Hi @thecircleoflifefree,

There isn't an estimate yet. I will update here when I know an ETA for supporting Solidity 0.6.

@thecircleoflifefree This will definitely happen before Q2, and most likely during January. We are analyzing this and will post as soon as we have any estimates.

@frangio

With regards to try catch and the @openzeppelin/contracts library I noticed the following for the SafeERC20 library:
image

Ergo 0.5 internal methods are not compatible with the 0.6 try/catch syntax.

One more thing that might also be relevant to you ( I found it to be relevant for buidler) is the solidity-parser-antlr package current incompatibility with solc 0.6
I opened an issue regarding the solc 0.6 array slicing syntax in their repo: https://github.com/federicobond/solidity-parser-antlr/issues/96

Very interesting @gitpusha, thanks for sharing! The bit about SafeERC20 is particularly interesting.

@gitpusha @thecircleoflifefree and everyone following this issue, I suggest joining the discussion in the forum on adoption of virtual functions:
https://forum.openzeppelin.com/t/how-we-plan-to-adopt-solidity-0-6-virtual-functions/2063

Hey guys!

Just dropping here a message about the parser. We at ConsenSys Diligence have just taken up its maintenance. Find an updated 0.6.0 version here: https://github.com/consensys/solidity-parser-antlr

Hi @gitpusha, @thecircleoflifefree and anyone following this Issue:

OpenZeppelin Contracts were migrated to Solidity 0.6 in OpenZeppelin Contracts v3.0 Beta

Would appreciate if you can give the Beta a try and let us know what you think in the Community Forum!

Was this page helpful?
0 / 5 - 0 ratings