Introducing the newest version of the Solidity Compiler: v0.8.25. This is a minor release following the Dencun hard-fork on Ethereum mainnet that occurred on March 13, 2024 at 13:55 UTC.
Dencun Upgrade
The Dencun upgrade combines changes to both Ethereum's consensus and execution layers. The full list of protocol changes can be found in EIP-7569.
With Dencun now live on mainnet, we are accordingly making cancun the default EVM version the compiler will emit code for.
MCOPY in code generator
The previous release made the mcopy() builtin available in Yul and inline assembly. Solidity 0.8.25 finally makes use of it in the code generator, replacing the use of mload()/mstore() loops.
The operations that will benefit from the new opcode are the encoding and decoding of byte arrays stored in memory. This includes both any explicit use of abi.decode() and abi.encode() as well as passing/returning such arrays into/from external functions.
Note, however, that while many contracts should see some reduction in gas usage, we expect it to be very modest. Firstly, in the vast majority of cases the compiler can avoid unnecessary copying of data within memory in the first place (the fact that memory variables can only be of reference types is one of the main reasons). A much more common case is the copying of data between memory and locations, such as calldata, storage or returndata and for these operations the cost remains unchanged. Secondly, the new instruction works with contiguous areas of memory, which makes it perfect for byte arrays like bytes and string, but not so much for more complex array types that require cleanup for each element.
Important Note About Transient Storage
To bring attention to the dangers of incorrect use of transient storage opcodes, the compiler, since version 0.8.24, always warns about the use of tstore opcode in assembly. Since problematic usage patterns, in general, cannot be algorithmically distinguished from safe use of transient storage, we still have little choice but to emit the warning unconditionally. As of 0.8.25 the compiler will keep doing so, although now only once per compilation, at the first occurrence of tstore. We are aware that this may be annoying to users and library authors who use transient storage responsibly, but, at least for the time being, we consider raising awareness of the danger of careless use of transient storage to be more important than convenience in safe cases. This way, we hope to reduce the risk of users being completely ignorant of the fact that those problems exist in the first place and inadvertently introducing subtle bugs into their code.
To learn more about transient storage and the issues that prompted the introduction of the warning, read the full blog post about transient storage.
Full Changelog
Compiler Features
- Code Generator: Use MCOPY instead of MLOAD/MSTORE loop when copying byte arrays.
- EVM: Set default EVM version to cancun.
- Yul Analyzer: Emit transient storage warning only for the first occurrence of tstore.
Bugfixes
- Assembler: Prevent incorrect calculation of tag sizes.
- Commandline Interface: Do not run IR pipeline when --via-ir is used but no output that depends on the IR is requested.
- EVM Assembly Import: Fix handling of missing source locations during import.
- SMTChecker: Ensure query is properly flushed to a file before calling solver when using SMT-LIB interface.
- SMTChecker: Fix internal error caused by not respecting the sign of an integer type when constructing zero-value SMT expressions.
- SMTChecker: Run Eldarica only when explicitly requested with --model-checker-solvers eld, even when it is present on the system.
How to Install/Upgrade?
To upgrade to the latest version of the Solidity Compiler, please follow the installation instructions available in our documentation.
You can download the new version of Solidity here: v0.8.25. If you want to build from the source code, do not use the source archives generated automatically by GitHub. Instead use solidity_0.8.25.tar.gz and take a look at our documentation on how to build from source. We advise all Solidity developers to always upgrade to the latest version of Solidity in order to take advantage of improvements, optimizations, and most importantly, bug fixes.
And last but not least, we would like to give a big thank you to all the contributors who helped make this release possible!