Skip to content

Latest commit

 

History

History
47 lines (37 loc) · 2.71 KB

tip-209.md

File metadata and controls

47 lines (37 loc) · 2.71 KB
tip: 209
title: Adapt to Solidity 0.6.0.
author: neo hong neo.hong@tron.network
discussions to: https://github.com/tronprotocol/tips/issues/209
status: Final
type: Standards Track
category : VM
created: 2020-12-07

Simple Summary

Adapt to Solidity 0.6.0.

Abstract

Update Java-Tron and Tron solidity compiler adapt to solidity 0.6.0.

Motivation

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.

Specification

Breaking changes

  • ABI: Remove the deprecated constant and payable 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 called address to them as replacement.
  • General: Enable Yul optimizer as part of standard optimization.
  • General: New reserved keywords: override, receive, and virtual.
  • General: private cannot be used together with virtual.
  • General: Split unnamed fallback functions into two cases defined using fallback() and receive().
  • 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.

Language Features:

  • Allow explicit conversions from address to address payable via payable(...).
  • Introduce push() for dynamic storage arrays. It returns a reference to the newly allocated element, if applicable.
  • Introduce virtual and override keywords.
  • Introduce try/catch-statement(revert and require 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.

Compiler Features:

  • Allow revert strings to be stripped from the binary using the --revert-strings option or the settings.debug.revertStrings setting.
  • ABIEncoderV2: Do not warn about enabled ABIEncoderV2 anymore (the pragma is still needed, though).