Releases: tronprotocol/solidity
0.8.22_Anaximander_v4.7.6
TRON Solidity compiler 0.8.22 is fully compatible with Ethereum Solidity 0.8.22.
Major changelog from Ethereum
IMPORTANT NOTE:
This release deprecates support for EVM versions older than Constantinople for the reason of ruling out the need to maintain multiple complex code paths or workarounds for ancient EVM versions. In case you rely on the support for such EVM versions, please reach out to us.
Notable Features:
- Unchecked loop increments
- Adding support for importing EVM Assembly JSON (experimental)
- Adjusting Yul optimizer to rematerialize zero literals
Changelog
Language Features:
- Allow defining events at file level.
Compiler Features:
- Code Generator: Remove redundant overflow checks of certain
for
loops when the counter variable cannot overflow. - Commandline Interface: Add
--no-import-callback
option that prevents the compiler from loading source files not given explicitly on the CLI or in Standard JSON input. - Commandline Interface: Add an experimental
--import-asm-json
option that can import EVM assembly in the format used by--asm-json
. - Commandline Interface: Use proper severity and coloring also for error messages produced outside of the compilation pipeline.
- EVM: Deprecate support for "homestead", "tangerineWhistle", "spuriousDragon" and "byzantium" EVM versions.
- Parser: Remove the experimental error recovery mode (
--error-recovery
/settings.parserErrorRecovery
). - SMTChecker: Support user-defined operators.
- Yul Optimizer: If
PUSH0
is supported, favor zero literals over storing zero values in variables. - Yul Optimizer: Run the
Rematerializer
andUnusedPruner
steps at the end of the default clean-up sequence.
Bugfixes:
- Code Generator: Fix output from via-IR code generator being dependent on which files were discovered by import callback. In some cases, a different AST ID assignment would alter the order of functions in internal dispatch, resulting in superficially different but semantically equivalent bytecode.
- NatSpec: Fix internal error when requesting
userdoc
ordevdoc
for a contract that emits an event defined in a foreign contract or interface. - SMTChecker: Fix encoding error that causes loops to unroll after completion.
- SMTChecker: Fix inconsistency on constant condition checks when
while
orfor
loops are unrolled before the condition check. - Yul Optimizer: Fix replacement decisions during CSE being affected by Yul variable names generated by the compiler, resulting in different (but equivalent) bytecode in some situations.
AST Changes:
- AST: Fix wrong initial ID for Yul nodes in the AST.
0.8.21_Anaximander_v4.7.6
TRON Solidity compiler 0.8.21 is fully compatible with Ethereum Solidity 0.8.21.
Major changelog from Ethereum
Important Bugfixes:
- Code Generator: Always generate code for the expression in
<expression>.selector
in the legacy code generation pipeline. - Yul Optimizer: Fix
FullInliner
step (i
) not preserving the evaluation order of arguments passed into inlined functions in code that is not in expression-split form (i.e. when using a custom optimizer sequence in which the step not preceded byExpressionSplitter
(x
)).
Language Features:
- Allow qualified access to events from other contracts.
- Relax restrictions on initialization of immutable variables. Reads and writes may now happen at any point at construction time outside of functions and modifiers. Explicit initialization is no longer mandatory.
Compiler Features:
- Commandline Interface: Add
--ast-compact-json
output in assembler mode. - Commandline Interface: Add
--ir-ast-json
and--ir-optimized-ast-json
outputs for Solidity input, providing AST in compact JSON format for IR and optimized IR. - Commandline Interface: Respect
--optimize-yul
and--no-optimize-yul
in compiler mode and accept them in assembler mode as well.--optimize --no-optimize-yul
combination now allows enabling EVM assembly optimizer without enabling Yul optimizer. - EWasm: Remove EWasm backend.
- Parser: Introduce
pragma experimental solidity
, which will enable an experimental language mode that, in particular, has no stability guarantees between non-breaking releases and is not suited for production use. - SMTChecker: Add
--model-checker-print-query
CLI option andsettings.modelChecker.printQuery
JSON option to output the SMTChecker queries in the SMTLIB2 format. This requires usingsmtlib2
solver only. - Standard JSON Interface: Add
ast
file-level output for Yul input. - Standard JSON Interface: Add
irAst
andirOptimizedAst
contract-level outputs for Solidity input, providing AST in compact JSON format for IR and optimized IR. - Yul Optimizer: Remove experimental
ReasoningBasedSimplifier
optimization step. - Yul Optimizer: Stack-to-memory mover is now enabled by default whenever possible for via IR code generation and pure Yul compilation.
Bugfixes:
- Code Generator: Disallow complex expressions whose results are types, built-ins, modules or some unassignable functions. The legacy code generation pipeline would not actually evaluate them, discarding any side effects they might have.
- Code Generator: Fix not entirely deterministic order of functions in unoptimized Yul output. The choice of C++ compiler in some cases would result in different (but equivalent) bytecode (especially from native binaries vs emscripten binaries).
- Commandline Interface: Fix internal error when using
--stop-after parsing
and requesting some of the outputs that require full analysis or compilation. - Commandline Interface: It is no longer possible to specify both
--optimize-yul
and--no-optimize-yul
at the same time. - SMTChecker: Fix encoding of side-effects inside
if
andternary conditional
statements in the BMC engine. - SMTChecker: Fix false negative when a verification target can be violated only by a trusted external call from another public function.
- SMTChecker: Fix generation of invalid SMT-LIB2 scripts in BMC engine with trusted mode for external calls when CHC engine times out.
- SMTChecker: Fix internal error caused by incorrectly classifying external function call using function pointer as a public getter.
- SMTChecker: Fix internal error caused by using external identifier to encode member access to functions that take an internal function as a parameter.
- Standard JSON Interface: Fix an incomplete AST being returned when analysis is interrupted by certain kinds of fatal errors.
- Type Checker: Disallow using certain unassignable function types in complex expressions.
- Type Checker: Function declaration types referring to different declarations are no longer convertible to each other.
- Yul Optimizer: Ensure that the assignment of memory slots for variables moved to memory does not depend on AST IDs that may depend on whether additional files are included during compilation.
- Yul Optimizer: Fix
FullInliner
step not ignoring code that is not in expression-split form. - Yul Optimizer: Fix optimized IR being unnecessarily passed through the Yul optimizer again before bytecode generation.
AST Changes:
- AST: Add the
experimentalSolidity
field to theSourceUnit
nodes, which indicates whether the experimental parsing mode has been enabled viapragma experimental solidity
.
0.8.20_Periander_v4.7.2
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 fieldsettings.modelChecker.extCalls: "trusted"
. - Assembler: Use
push0
for placing0
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 optionsettings.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 optionsettings.modelChecker.showProvedSafe
can be enabled to show the full list of safe properties. - Yul EVM Code Transform: If available, use
push0
instead ofcodesize
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:
- PUB: 1254 F859 D2B1 BD9F 66E7 107D F859 BCB4 4A28 290B
- UID: build@tron.network
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
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 includechain.totalNetLimit
,chain.totalNetWeight
,chain.totalEnergyCurrentLimit
,chain.totalEnergyWeight
andchain.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
forabi.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 andM
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 typeT
has been defined, resulting in the effect of the statement being available everywhereT
is available. - Add
E.selector
for a non-anonymous eventE
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 disallowdifficulty()
in inline assembly for EVM versions >= paris. The change is due to the renaming introduced by EIP-4399. - EVM: Introduce
block.prevrandao
in Solidity andprevrandao()
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
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 getsolc
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
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
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 offrom address
votes forto 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 usingextcodesize
directly. - Allowing conversion from
bytes
andbytes
slices tobytes1
...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
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 offrom address
votes forto 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
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 offrom address
votes forto 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
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 offrom address
votes forto 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.