Releases: tronprotocol/solidity
0.8.0_Plato_v4.2
TRON Solidity compiler 0.8.0 is fully compatible with Ethereum Solidity 0.8.0.
Breaking Changes
- Code Generator: All arithmetic is checked by default. These checks can be disabled using
unchecked { ... }
. - Code Generator: Cause a panic if a byte array in storage is accessed whose length is encoded incorrectly.
- Code Generator: Use revert with error signature Panic(uint256) and error codes instead of invalid opcode on failing assertions.
- General: Enable ABI coder v2 by default.
- General: Remove global functions
log0
,log1
,log2
,log3
andlog4
. - Parser: Exponentiation is right associative.
a**b**c
is parsed asa**(b**c)
. - Type Checker: Function call options can only be given once.
- Type System: Declarations with the name
this
,super
and_
are disallowed, with the exception of public functions and events. - Type System: Disallow
msg.data
inreceive()
function. - Type System: Disallow
type(super)
. - Type System: Disallow enums with more than 256 members.
- Type System: Disallow explicit conversions from negative literals and literals larger than
type(uint160).max
toaddress
type. - Type System: Disallow the
byte
type. It was an alias tobytes1
. - Type System: Explicit conversion to
address
type always returns a non-payableaddress
type. In particular,address(u)
,address(b)
,address(c)
andaddress(this)
have the type address instead of address payable (Hereu
,b
, andc
are arbitrary variables of typeuint160
,bytes20
and contract type respectively.) - Type System: Explicit conversions between two types are disallowed if it changes more than one of sign, width or kind at the same time.
- Type System: Explicit conversions from literals to enums are only allowed if the value fits in the enum.
- Type System: Explicit conversions from literals to integer type is as strict as implicit conversions.
Type System: Introduceaddress(...).code
to retrieve the code asbytes memory
. The size can be obtained viaaddress(...).code.length
, but it will currently always include copying the code. - Type System: Introduce
block.chainid
for retrieving the current chain id. - Type System: Support
address(...).codehash
to retrieve the codehash of an account. - Type System: The global variables
tx.origin
andmsg.sender
have type address instead ofaddress payable
. - Type System: Unary negation can only be used on signed integers, not on unsigned integers.
- View Pure Checker: Mark
chainid
as view.
New Features
- Inheritance: Allow overrides to have stricter state mutability:
view
can overridenonpayable
andpure
can overrideview
. - Parser: Deprecate visibility for constructors.
- State mutability: Do not issue recommendation for stricter mutability for virtual functions but do issue it for functions that override.
Language Feature
- Super constructors can now be called using the member notation e.g.
M.C(123)
.
Bugfix
- Type Checker: Perform proper truncating integer arithmetic when using constants in array length expressions.
0.7.6_Plato_v4.2
TRON Solidity compiler 0.7.6 is fully compatible with Ethereum Solidity 0.7.6.
New Features
- Code generator: Support conversion from calldata slices to memory and storage arrays.
- Code generator: Support copying dynamically encoded structs from calldata to memory.
- Code generator: Support copying of nested arrays from calldata to memory.
- The fallback function can now also have a single
calldata
argument (equalingmsg.data
) and returnbytes memory
(which will not be ABI-encoded but returned as-is).
Compiler Features
- Build System: Optionally support dynamic loading of Z3 and use that mechanism for Linux release builds.
- Code Generator: Avoid memory allocation for default value if it is not used.
Bugfixes
- Code generator: Do not pad empty string literals with a single 32-byte zero field in the ABI coder v1.
- Type Checker:
super
is not available in libraries. - Type Checker: Disallow leading zeroes in sized-types (e.g.
bytes000032
), but allow them to be treated as identifiers.
0.7.0_Plato_v4.2
TRON Solidity compiler 0.7.0 is fully compatible with Ethereum Solidity 0.7.0.
Breaking Changes
- Inline Assembly: Disallow
.
in user-defined function and variable names. - Inline Assembly: Slot and offset of storage pointer variable
x
are accessed viax.slot
andx.offset
instead ofx_slot
andx_offset
. - Parser: Disallow dot syntax for
value
andgas
. - Parser: Remove the identifier
now
(replaced byblock.timestamp
). - Reference Resolver:
using A for B
only affects the contract it is mentioned in and not all derived contracts. - Type Checker: Disallow
virtual
for library functions. - Type Checker: Disallow assignments to state variables that contain nested mappings.
- Type checker: Disallow events with same name and parameter types in inheritance hierarchy.
- Type Checker: Disallow shifts by signed types.
- Type Checker: Disallow structs and arrays in memory or calldata if they contain nested mappings.
- Type Checker: Exponentiation and shifts of literals by non-literals will always use
uint256
orint256
as a type.
New Features
- Inheritance: Allow overrides to have stricter state mutability:
view
can overridenonpayable
andpure
can overrideview
. - Parser: Deprecate visibility for constructors.
- State mutability: Do not issue recommendation for stricter mutability for virtual functions but do issue it for functions that override.
Compiler Feature
- Variable declarations using the
var
keyword are not recognized anymore.
Bugfixes
- Inheritance: Disallow public state variables overwriting
pure
functions. - State Mutability: Constant public state variables are considered
pure
functions. - Type Checker: Fixing deduction issues on function types when function call has named arguments.
0.6.12_Plato_v4.2
TRON Solidity compiler 0.6.12 is fully compatible with Ethereum Solidity 0.6.12.
Note the binary size of the solc-js increase because of the Z3 SMT solver built-in.
New Feature
- Permit calldata location for all variables.
Important Bugfix
- Fixed a bug related to internal library functions with calldata parameters called via using for.
Compiler Features
- Build system: Update the soljson.js build to emscripten 1.39.15 and boost 1.73.0 and include Z3 for integrated SMTChecker support without the callback mechanism.
- Build system: Switch the emscripten build from the fastcomp backend to the upstream backend.
Bugfixes
- Type Checker: Disallow constructor parameters with
calldata
data location. - Type Checker: Do not disallow assigning to calldata variables.
- Type Checker: Fix internal error related to
using for
applied to non-libraries. - Type Checker: Fix overload resolution in combination with
{value: ...}
. - Type Checker: Disallow assignments to storage variables of type
mapping
. - Type Checker: Disallow usage of override with non-public state variables.
- Type Checker: Fix wrong compiler error when referencing an overridden function without calling it.
0.6.8_Plato_v4.2
TRON Solidity compiler 0.6.8 is fully compatible with Ethereum Solidity 0.6.8.
New Features
- Implemented
type(T).min
andtype(T).max
for every integer typeT
that returns the smallest and largest value representable by the type. - Allow using abi encoding functions for calldata array slices without explicit casts.
- Add support for TIP 165 interface identifiers with
type(I).interfaceId
. - Allow virtual modifiers inside abstract contracts to have empty body.
- Allow local storage variables to be declared without initialization, as long as they are assigned before they are accessed.
- State variables can be marked
immutable
which causes them to be read-only, but assignable in the constructor. The value will be stored directly in the code. - Deprecated
value(...)
andgas(...)
in favor of{value: ...}
and{gas: ...}
- Inline Assembly: Allow assigning to
_slot
of local storage variable pointers.
Important Bugfixes
- Add missing callvalue check to the creation code of a contract that does not define a constructor but has a base that does define a constructor.
- Disallow array slices of arrays with dynamically encoded base types.
- String literals containing backslash characters can no longer cause incorrect code to be generated when passed directly to function calls or encoding functions when ABIEncoderV2 is active.
- Fix tuple assignments with components occupying multiple stack slots and different stack size on left- and right-hand-side.
- Restrict the length of dynamic memory arrays to 64 bits during creation at runtime fixing a possible overflow.
Bugfix
- Type Checker: Disallow accessing
runtimeCode
for contract types that contain immutable state variables.
0.6.2_Plato_v4.2
TRON Solidity compiler 0.6.2 already supports Ethereum Solidity 0.6.2.
This release supports three new instructions introduced in TIP-157.
Requirements
- Developers can only use these new instructions after proposal TIP-157 has been approved in TRON mainnet.
- Developers can use other feature before proposal TIP-157 has been approved in TRON mainnet.
New Features
- Add
FREEZE
instruction: Smart contract can freeze balance to get resources or delegate resources for others. - Add
UNFREEZE
instruction: Smart contract can unfreeze balance. - Add
FREEZEEXPIRETIME
instruction: Smart contract can get freeze expire time, return in seconds. - Allow accessing external functions via contract and interface names to obtain their selector.
- Allow interfaces to inherit from other interfaces.
- Allow gas and value to be set in external function calls using
c.f{gas: 10000, value: 4 trx}()
. - Allow specifying the
salt
for contract creations and thus thecreate2
opcode usingnew C{salt: 0x1234, value: 1 trx}(arg1, arg2)
. - Inline Assembly: Support literals
true
andfalse
.
Important Bugfixes
- Commandline interface: Only activate yul optimizer if --optimize is given.
- Fixes internal compiler error on explicitly calling unimplemented base functions.
Build System
- Switch to building soljson.js with an embedded base64-encoded wasm binary.
0.5.17_Plato_v4.2
TRON Solidity compiler 0.5.17 already supports Ethereum Solidity 0.5.17, which fixes a bug that a private function can be overridden in a derived contract by a private function of the same name and types.
This release also supports three new instructions introduced in TIP-157. These instructions will be supported in >=0.6.2.
Requirements
- Developers can only use these new instructions after proposal TIP-157 has been approved in TRON mainnet.
- Developers can use other feature before proposal TIP-157 has been approved in TRON mainnet.
New Features
- Add
FREEZE
instruction: Smart contract can freeze balance to get resources or delegate resources for others. - Add
UNFREEZE
instruction: Smart contract can unfreeze balance. - Add
FREEZEEXPIRETIME
instruction: Smart contract can get freeze expire time, return in seconds.
Important Bugfix
- Type Checker: Disallow overriding of private functions.
0.5.16_GreatVoyage_v4.1.2
New Feature
- Update to version 0.5.16 TIP-241.
Important Bugfix
- Yul Optimizer: Fix bug in redundant assignment remover in combination with break and continue statements.
0.6.0_GreatVoyage_v4.1.2
New Features
- Update to version 0.6.0 in TVM TIP-209.
- New reserved keywords:
virtual
,override
andreceive
. - Introduce
virtual
andoverride
keywords andprivate
cannot be used together withvirtual
. - Abstract contracts need to be marked explicitly as abstract by using the
abstract
keyword. - Split unnamed fallback functions into two cases defined using
fallback()
andreceive()
. - Introduce
try
/catch
-statement (revert
andrequire
can be caught now, others will be supported soon). - Introduce
push()
for dynamic storage arrays. It returns a reference to the newly allocated element, if applicable. - Allow explicit conversions from
address
toaddress payable
viapayable(...)
. - Disallow explicit conversions from external function types to
address
and add a member calledaddress
to them as replacement.
Changes
- ABI: Remove the deprecated
constant
andpayable
fields. - ABI: The
type
field is now required and no longer specified to default tofunction
. - Modify
push(element)
for dynamic storage arrays such that it does not return the new length anymore. length
member of arrays is now always read-only, even for storage arrays.- Enable Yul optimizer as part of standard optimization.
Compiler Features:
- Allow revert strings to be stripped from the binary using the
--revert-strings
option or thesettings.debug.revertStrings
setting. - Do not warn about enabled ABIEncoderV2 anymore (the pragma is still needed, though).
0.5.15_GreatVoyage_v4.1
New Feature
- Update to version 0.5.15.
Important Bugfix
- Yul Optimizer: Fix incorrect redundant load optimization crossing user-defined functions that contain for-loops with memory / storage writes.