We are excited to announce the latest release of the Solidity Compiler, Solidity v0.8.20. This latest version includes a range of improvements in the via-IR pipeline and improves the list of events exposed in the contract ABI, and, most importantly, support for the Shanghai hard fork!
This compiler switches the default target EVM version to Shanghai, which means that the generated bytecode will include PUSH0 opcodes. Be sure to select the appropriate EVM version in case you intend to deploy on a chain other than mainnet like L2 chains that may not yet support PUSH0, otherwise, deployment of your contracts will fail.
Experimental AST import via Standard JSON
An interesting new feature for tooling developers is the ability to import JSON ASTs via the Standard JSON interface using SolidityAST as input language. We have released this as an experimental feature so far, mainly due to the lack of proper error reporting on malformed ASTs and the fact that for now we generally don't guarantee sound behavior on invalid input ASTs.
So while we strongly advise against using the AST import in any production pipeline, and especially against relying on the bytecode generated from imported ASTs for production use, we hope that this new feature will enable the easier development of tools in the ecosystem, and we encourage giving it a try and getting back to us with any feedback.
Also, note that the compiler will perform type-checking and analysis on the imported AST again - to make sure that the compiler honors the transformation you may perform on the AST, you can re-export the imported AST and check the result.
- 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".
- NatSpec: Add support for NatSpec documentation in enum definitions.
- NatSpec: Add support for NatSpec documentation in struct definitions.
- NatSpec: Include NatSpec from events that are emitted by a contract but defined outside of it in userdoc and devdoc output.
- Optimizer: Re-implement simplified version of UnusedAssignEliminator and UnusedStoreEliminator. It can correctly remove some unused assignments in deeply nested loops that were ignored by the old version.
- Parser: Unary plus is no longer recognized as a unary operator in the AST and triggers an error at the parsing stage (rather than later during the analysis).
- 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.
- Standard JSON Interface: Add experimental support for importing ASTs via Standard JSON.
- 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.
- 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.
- AST: Add the internalFunctionIDs field to the AST nodes of contracts containing IDs of functions that may be called via the internal dispatch. The field is a map from function AST IDs to internal dispatch function IDs. These IDs are always generated, but they are only used in via-IR code generation.
- AST: Add the usedEvents field to ContractDefinition which contains the AST IDs of all events emitted by the contract as well as all events defined and inherited by the contract.
As always, a big thank you to all contributors who helped make this release possible!
How to install/upgrade
To upgrade to the latest version of the Solidity Compiler, simply follow the installation instructions available in our documentation. Our team has made sure to provide detailed and straightforward steps to make the upgrade process as seamless as possible. If you have any questions or run into any issues during the upgrade process, don't hesitate to reach out to our community Matrix channel.
You can download the new version of Solidity here: v0.8.20. If you want to build from the source code, do not use the source archives generated automatically by GitHub, instead please use solidity_0.8.20.tar.gz and take a look at our documentation on how to build from source if you need guidance.
Please note that for those using Solidity versions below 0.8.0, there are breaking changes. We highly recommend reviewing the detailed list of breaking changes in our documentation to ensure a smooth upgrade process. Additionally, we encourage all Solidity users to regularly check for updates to stay up-to-date with the latest improvements and optimizations. We advise all Solidity developers to upgrade to version 0.8.20 to take advantage of these improvements and optimizations.