tip: 209
title: Adapt to Solidity 0.6.0.
author: neo hong [email protected]
discussions to: https://github.com/tronprotocol/tips/issues/209
status: Final
type: Standards Track
category : VM
created: 2020-12-07
Adapt to Solidity 0.6.0.
Update Java-Tron and Tron solidity compiler adapt to solidity 0.6.0.
Solidity 0.6.0 provides many features which can improve development efficiency and safety. Solidity 0.6.0 is a major breaking release of the Solidity compiler and language. Changes include explicit virtual and override keywords in inheritance, support for try/catch, splitting the fallback function into a receive TRX function and an actual fallback function and limitations on how the length of an array can be changed, among others. From this release on, ABIEncoderV2 is not considered experimental any more, but developers still have to activate it through the pragma. Furthermore, the Yul optimizer is automatically activated together with the regular optimizer, but developers can still disable it through the detailed optimizer settings.
- ABI: Remove the deprecated
constant
andpayable
fields. - ABI: The type field is now required and no longer specified to default to
function
. - General: Disallow explicit conversions from external function types to
address
and add a member calledaddress
to them as replacement. - General: Enable Yul optimizer as part of standard optimization.
- General: New reserved keywords:
override
,receive
, andvirtual
. - General: private cannot be used together with
virtual
. - General: Split unnamed fallback functions into two cases defined using
fallback()
andreceive()
. - Syntax:
push(element)
for dynamic storage arrays do not return the new length anymore. - Syntax: Abstract contracts need to be marked explicitly as abstract by using the
abstract
keyword. - Syntax:
length
member of arrays is now always read-only, even for storage arrays.
- Allow explicit conversions from
address
toaddress payable
viapayable(...)
. - Introduce
push()
for dynamic storage arrays. It returns a reference to the newly allocated element, if applicable. - Introduce
virtual
andoverride
keywords. - Introduce
try
/catch
-statement(revert
andrequire
can be caught now, others will be supported soon). - Modify
push(element)
for dynamic storage arrays such that it does not return the new length anymore.
- Allow revert strings to be stripped from the binary using the
--revert-strings
option or thesettings.debug.revertStrings
setting. - ABIEncoderV2: Do not warn about enabled ABIEncoderV2 anymore (the pragma is still needed, though).