Skip to content

Releases: tronprotocol/solidity

0.8.20_Periander_v4.7.2

02 Aug 06:30
5f1834b
Compare
Choose a tag to compare

TRON Solidity compiler 0.8.20 is fully compatible with Ethereum Solidity 0.8.20.

IMPORTANT NOTE: This compiler switches the default target VM version to Shanghai, which means that the generated bytecode will include PUSH0 opcodes. Be sure to select the appropriate VM version in case you intend to deploy on mainnet or testnet that may not yet support PUSH0, otherwise deployment of your contracts will fail. You can verify that the network supports the PUSH0 by checking that the 76th network parameter allowTvmShanghai is on.

Major changelog from Ethereum

Language Features:

  • Allow defining custom operators for user-defined value types via using {f as +} for T global syntax.

Compiler Features:

  • SMTChecker: New trusted mode that assumes that any compile-time available code is the actual used code, even in external calls. This can be used via the CLI option --model-checker-ext-calls trusted or the JSON field settings.modelChecker.extCalls: "trusted".
  • Assembler: Use push0 for placing 0 on the stack for EVM versions starting from "Shanghai". This decreases the deployment and runtime costs.
  • EVM: Set default EVM version to "Shanghai".
  • EVM: Support for the EVM Version "Shanghai".
  • SMTChecker: Group all messages about unsupported language features in a single warning. The CLI option --model-checker-show-unsupported and the JSON option settings.modelChecker.showUnsupported can be enabled to show the full list.
  • SMTChecker: Properties that are proved safe are now reported explicitly at the end of analysis. By default, only the number of safe properties is shown. The CLI option --model-checker-show-proved-safe and the JSON option settings.modelChecker.showProvedSafe can be enabled to show the full list of safe properties.
  • Yul EVM Code Transform: If available, use push0 instead of codesize to produce an arbitrary value on stack in order to create equal stack heights between branches.

Bugfixes:

  • Assembler: Avoid duplicating subassembly bytecode where possible.
  • Code Generator: Avoid including references to the deployed label of referenced functions if they are called right away.
  • ContractLevelChecker: Properly distinguish the case of missing base constructor arguments from having an unimplemented base function.
  • SMTChecker: Fix internal error caused by unhandled z3 expressions that come from the solver when bitwise operators are used.
  • SMTChecker: Fix internal error when using the custom NatSpec annotation to abstract free functions.
  • TypeChecker: Also allow external library functions in using for.
  • ABI: Include events in the ABI that are emitted by a contract but defined outside of it.
  • Immutables: Disallow initialization of immutables in try/catch statements.
  • SMTChecker: Fix false positives in ternary operators that contain verification targets in its branches, directly or indirectly.

Integrity Check

All binaries in this release are signed via this GPG key:

From the download listings below you should see links to the downloadable binaries as well as sig signature files. To verify the authenticity of any binary, grab the binary and sig files with the same prefix name and then execute the verification process: GPG signature verification

0.8.18_Sartre_4.7.1

01 Mar 09:36
f18bedf
Compare
Choose a tag to compare

TRON Compiler Solidity v0.8.18 is fully compatible with Ethereum Solidity Compiler v0.8.18.
In addition, this release supports new instructions and precompile contracts introduced in TIP-467.
Please see the Solidity example to use.

Requirement

  • Developers can only use these new instructions and precompile contracts after the related proposal has been approved on TRON mainnet.

New Features from TRON:

  • TVM: Introduce freezebalancev2(uint256,uint256) in Solidity.
  • TVM: Introduce unfreezebalancev2(uint256,uint256) in Solidity.
  • TVM: Introduce cancelallunfreezev2() in Solidity.
  • TVM: Introduce withdrawexpireunfreeze() in Solidity.
  • TVM: Introduce <address payable>.delegateResource(uint256,uint256) in Solidity.
  • TVM: Introduce <address payable>.unDelegateResource(uint256,uint256) in Solidity.
  • TVM: Introduce new magic type chain in Solidity and the parameters that can be queried include chain.totalNetLimit, chain.totalNetWeight, chain.totalEnergyCurrentLimit, chain.totalEnergyWeight and chain.unfreezeDelayDays.
  • TVM: Introduce <address>.availableUnfreezeV2Size() in Solidity.
  • TVM: Introduce <address>.unfreezableBalanceV2(uint256) in Solidity.
  • TVM: Introduce <address>.expireUnfreezeBalanceV2(uint256) in Solidity.
  • TVM: Introduce <address>.delegatableResource(uint256) in Solidity.
  • TVM: Introduce <address>.resourceV2(address,uint256) in Solidity.
  • TVM: Introduce <address>.checkUnDelegateResource(address,uint256) in Solidity.
  • TVM: Introduce <address>.resourceUsage(uint256) in Solidity.
  • TVM: Introduce <address>.totalResource(uint256) in Solidity.
  • TVM: Introduce <address>.totalDelegatedResource(uint256) in Solidity.
  • TVM: Introduce <address>.totalAcquiredResource(uint256) in Solidity.

Important Bugfixes:

  • Code Generator: Correctly encode literals used in abi.encodeCall in place of fixed bytes arguments.
  • ABI Encoder: When ABI-encoding values from calldata that contain nested arrays, correctly validate the nested array length against calldatasize() in all cases.
  • Override Checker: Allow changing data location for parameters only when overriding external functions.
  • Code Generation: Avoid writing dirty bytes to storage when copying bytes arrays.
  • Yul Optimizer: Keep all memory side-effects of inline assembly blocks.
  • Code Generation: Fix data corruption that affected ABI-encoding of calldata values represented by tuples: structs at any nesting level; argument lists of external functions, events and errors; return value lists of external functions. The 32 leading bytes of the first dynamically-encoded value in the tuple would get zeroed when the last component contained a statically-encoded array.
  • Yul Optimizer: Prevent the incorrect removal of storage writes before calls to Yul functions that conditionally terminate the external EVM call.

Language Features:

  • General: Add equality-comparison operators for external function types.
  • General: Support ContractName.functionName for abi.encodeCall, in addition to external function pointers.
  • General: Allow annotating inline assembly as memory-safe to allow optimizations and stack limit evasion that rely on respecting Solidity's memory model.
  • General: using M for Type; is allowed at file level and M can now also be a brace-enclosed list of free functions or library functions.
  • General: using ... for T global; is allowed at file level where the user-defined type T has been defined, resulting in the effect of the statement being available everywhere T is available.
  • Add E.selector for a non-anonymous event E to access the 32-byte selector topic.
  • Support using library constants in initializers of other constants.
  • Allow named parameters in mapping types.

Compiler Features:

  • EVM: Deprecate block.difficulty and disallow difficulty() in inline assembly for EVM versions >= paris. The change is due to the renaming introduced by EIP-4399.
  • EVM: Introduce block.prevrandao in Solidity and prevrandao() in inline assembly for EVM versions >= paris.
  • EVM: Set the default EVM version to "Paris".
  • EVM: Support for the EVM version "Paris".
  • TypeChecker: Warn when using deprecated builtin selfdestruct.

Build System:

  • Emscripten builds store the embedded WebAssembly binary in LZ4 compressed format and transparently decompress on loading.
  • Allow disabling pedantic warnings and do not treat warnings as errors during compiler build when -DPEDANTIC=OFF flag is passed to CMake.
  • Update emscripten to version 3.1.19.

0.8.11_Rousseau_v4.4

20 Apr 06:48
Compare
Choose a tag to compare

TRON Solidity compiler 0.8.11 is fully compatible with Ethereum Solidity 0.8.11.

Language Features:

  • General: New builtin function abi.encodeCall(functionPointer, (arg1, arg2, ...)) that type-checks the arguments and returns the ABI-encoded function call data.

Compiler Features:

  • Commandline Interface: Add --lsp option to get solc to act as a Language Server (LSP) communicating over stdio.

Bugfixes:

  • Code Generator: Fix a crash when using @use-src and compiling from Yul to ewasm.
  • Fix internal error when a function has a calldata struct argument with an internal type inside.
  • IR Generator: Fix IR syntax error when copying storage arrays of functions.

0.8.7_Rousseau_v4.4

07 Apr 11:02
Compare
Choose a tag to compare

TRON Solidity compiler 0.8.7 is fully compatible with Ethereum Solidity 0.8.7.

Language Features:

  • Introduce global block.basefee for retrieving the base fee of the current block.
  • Yul: Introduce builtin basefee() for retrieving the base fee of the current block.

Compiler Features:

  • AssemblyStack: Also run opcode-based optimizer when compiling Yul code.
  • Commandline Interface: option --pretty-json works also with --standard--json.
  • EVM: Set the default EVM version to "London".

Bugfixes:

  • Code Generator: Fix crash when passing an empty string literal to bytes.concat().
  • Code Generator: Fix internal compiler error when calling functions bound to calldata structs and arrays.
  • Code Generator: Fix internal compiler error when passing a 32-byte hex literal or a zero literal to bytes.concat() by disallowing such literals.
  • Commandline Interface: Apply --optimizer-runs option in assembly / yul mode.

0.8.6_Bacon_v4.3

10 Aug 08:17
Compare
Choose a tag to compare

TRON Solidity_v0.8.6 is fully compatible with Ethereum Solidity_v0.8.6.
In addition, this release supports two new instructions and six precompile contracts introduced in TIP-271.
Please see the usage-example to use.

Requirement

  • Developers can only use these new instructions and precompile contracts after proposal TIP-271 has been approved in TRON mainnet.

New Features from TRON

  • Add VOTEWITNESS instruction: Smart contract can vote for witness and get reward from the system.
  • Add WITHDRAWREWARD instruction: Smart contract can withdraw allowance and reward to it's balance.
  • Add RewardBalance precompile contract: Smart contract can query it's own allowance and reward.
  • Add IsSrCandidate precompile contract: Smart contract can judge whether the address is a candidate address.
  • Add VoteCount precompile contract: Smart contract can query the vote count of from address votes for to address.
  • Add UsedVoteCount precompile contract: Smart contract can query account's used vote count.
  • Add ReceivedVoteCount precompile contract: Smart contract can query account's recevied vote count.
  • Add TotalVoteCount precompile contract: Smart contract can query account's total vote count.

New Features from Ethereum Solidity 0.8.6

  • Possibility to use catch Panic(uint code) to catch a panic failure from an external call.
  • Code Generator: Reduce the cost of <address>.code.length by using extcodesize directly.
  • Allowing conversion from bytes and bytes slices to bytes1...bytes32.

Important Bugfixes

  • Optimizer: Fix bug on incorrect caching of Keccak-256 hashes.
  • ABI Decoder V2: For two-dimensional arrays and specially crafted data in memory, the result of abi.decode can depend on data elsewhere in memory. Calldata decoding is not affected.

Build System

  • Update the soljson.js build to emscripten 2.0.12 and boost 1.75.0.

0.7.7_Bacon_v4.3

02 Aug 04:22
Compare
Choose a tag to compare

TRON Solidity compiler 0.7.7 is fully compatible with Ethereum Solidity 0.7.6.
This release supports two new instructions and six precompile contracts introduced in TIP-271.
Please see the usage-example to use.

Requirement

  • Developers can only use these new instructions and precompile contracts after proposal TIP-271 has been approved in TRON mainnet.

New Features

  • Add VOTEWITNESS instruction: Smart contract can vote for witness and get reward from the system.
  • Add WITHDRAWREWARD instruction: Smart contract can withdraw allowance and reward to it's balance.
  • Add RewardBalance precompile contract: Smart contract can query it's own allowance and reward.
  • Add IsSrCandidate precompile contract: Smart contract can judge whether the address is a candidate address.
  • Add VoteCount precompile contract: Smart contract can query the vote count of from address votes for to address.
  • Add UsedVoteCount precompile contract: Smart contract can query account's used vote count.
  • Add ReceivedVoteCount precompile contract: Smart contract can query account's recevied vote count.
  • Add TotalVoteCount precompile contract: Smart contract can query account's total vote count.

0.6.13_Bacon_v4.3

02 Aug 04:22
Compare
Choose a tag to compare

TRON Solidity compiler 0.6.13 is fully compatible with Ethereum Solidity 0.6.12.
This release supports two new instructions and six precompile contracts introduced in TIP-271.
Please see the usage-example to use.

Requirement

  • Developers can only use these new instructions and precompile contracts after proposal TIP-271 has been approved in TRON mainnet.

New Features

  • Add VOTEWITNESS instruction: Smart contract can vote for witness and get reward from the system.
  • Add WITHDRAWREWARD instruction: Smart contract can withdraw allowance and reward to it's balance.
  • Add RewardBalance precompile contract: Smart contract can query it's own allowance and reward.
  • Add IsSrCandidate precompile contract: Smart contract can judge whether the address is a candidate address.
  • Add VoteCount precompile contract: Smart contract can query the vote count of from address votes for to address.
  • Add UsedVoteCount precompile contract: Smart contract can query account's used vote count.
  • Add ReceivedVoteCount precompile contract: Smart contract can query account's recevied vote count.
  • Add TotalVoteCount precompile contract: Smart contract can query account's total vote count.

0.5.18_Bacon_v4.3

02 Aug 04:21
Compare
Choose a tag to compare

TRON Solidity compiler 0.5.18 is fully compatible with Ethereum Solidity 0.5.17.
This release supports new instructions and precompile contracts introduced in TIP-271.
Please see the usage-example to use.

Requirement

  • Developers can only use these new instructions and precompile contracts after proposal TIP-271 has been approved in TRON mainnet.

New Features

  • Add VOTEWITNESS instruction: Smart contract can vote for witness and get reward from the system.
  • Add WITHDRAWREWARD instruction: Smart contract can withdraw allowance and reward to it's balance.
  • Add RewardBalance precompile contract: Smart contract can query it's own allowance and reward.
  • Add IsSrCandidate precompile contract: Smart contract can judge whether the address is a candidate address.
  • Add VoteCount precompile contract: Smart contract can query the vote count of from address votes for to address.
  • Add UsedVoteCount precompile contract: Smart contract can query account's used vote count.
  • Add ReceivedVoteCount precompile contract: Smart contract can query account's recevied vote count.
  • Add TotalVoteCount precompile contract: Smart contract can query account's total vote count.

0.8.0_Plato_v4.2

02 Jul 10:43
Compare
Choose a tag to compare

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 and log4.
  • Parser: Exponentiation is right associative. a**b**c is parsed as a**(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 in receive() 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 to address type.
  • Type System: Disallow the byte type. It was an alias to bytes1.
  • Type System: Explicit conversion to address type always returns a non-payable address type. In particular, address(u), address(b), address(c) and address(this) have the type address instead of address payable (Here u, b, and c are arbitrary variables of type uint160, 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: Introduce address(...).code to retrieve the code as bytes memory. The size can be obtained via address(...).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 and msg.sender have type address instead of address 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 override nonpayable and pure can override view.
  • 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

25 Jun 06:43
Compare
Choose a tag to compare

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 (equaling msg.data) and return bytes 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.