{ skip to content }

Solidity 0.8.24 Release Announcement

Posted by Solidity Team on January 26, 2024

Releases

We are excited to announce the release of the Solidity Compiler v0.8.24. This newest version of the compiler brings readiness for the "Cancun" network upgrade, including support for transient storage (EIP-1153), shard blob transactions (EIP-4844) & more. The release binaries for macOS are now also compatible with Apple silicon chips.

Cancun Network Upgrade

The "Cancun" network upgrade provides new features in the form of opcodes and precompiles, which will need to be explicitly used to have any benefits, but also introduces changes in the existing EVM behavior that will automatically affect already deployed contracts. Solidity 0.8.24 adds full Yul-level support for the new opcodes and also Solidity-level builtins for some of them.

The hard fork will include the following execution layer changes:

Important Note

"Cancun" has not been deployed to the Ethereum mainnet yet. Thus, this new compiler release does not yet make it its default target. In order to use the new opcodes and builtins, users are required to select this version using the --evm-version cancun flag. Note that code compiled with this flag may not work as desired on any network where the hard fork is not yet implemented.

It is important to note that at the moment the code generator does not automatically make use of the new opcodes to improve the emitted code and the optimizer support is minimal. Code generation and optimizer improvements will follow in subsequent releases.

Supported EIPs & Notable Features

Transient Storage (EIP-1153)

Transient storage is a long-awaited feature on the EVM level that introduces another data location besides memory, storage, calldata (and return-data and code). The new data location behaves as a key-value store similar to storage with the main difference being that data in transient storage is not permanent, but is scoped to the current transaction only, and is reset to zero when the transaction ends. Consequently, transient storage is as cheap as warm storage access, with both reads and writes priced at 100 gas.

To learn more about its use cases and important things to note, read the full blog post about transient storage.

Solidity 0.8.24 adds two new assembly builtins to support EIP-1153: tstore() and tload().

Shard Blob Transactions (EIP-4844)

EIP-4844 introduces a new transaction format, which is a part of the data sharding mechanism to be fully implemented in the future. Blob-carrying transactions will allow users to include large amounts of data. While such data blobs cannot be accessed directly by contracts, access to their KZG commitments is provided instead. The compiler makes the versioned blob hash available through the blobhash() Yul builtin and a global Solidity function of the same name.

The pricing of such transactions involves a new type of gas, with a self-adjusting price, similar to normal gas, but independent of it. Similar to how the base-fee of the current block is made available to contracts through basefee(), blob base-fee can be accessed with the blobbasefee() builtin in Yul and block.blobbasefee variable in Solidity. See EIP-7516 for details about the new opcode.

An Efficient EVM Instruction for Copying Memory Areas (EIP-5656)

Until now, EVM did not have an appropriately priced mechanism for copying data directly between memory areas. There have been multiple attempts in the past, but for various reasons none of them ended up replacing the simple mload/mstore loops, which is what the compiler uses today.

EIP-5656 finally introduces the MCOPY opcode, available in Yul as the mcopy() builtin. Note that Solidity 0.8.24 only makes it available for explicit use in assembly. Future versions will make extensive use of the new opcode in the copying routines emitted by the code generator, lowering the gas cost of high-level copy operations as well.

Changes in SELFDESTRUCT Behavior (EIP-6780)

EIP-6780 significantly curtails the functionality of the SELFDESTRUCT opcode. In Cancun, the opcode will only perform an Ether transfer of the entire contract balance. The account, including its storage and contract code, will no longer be cleared. The only exception are cases in which destruction happens in the same transaction which deployed the contract.

The change does not require any support from the compiler. It is a network-wide change that will affect all deployed contracts. The --evm-version setting used when compiling the contract has no bearing on it.

Note that SELFDESTRUCT has already been deprecated for some time, by EIP-6049. The deprecation is still in effect and the compiler will still emit warnings on its use. Any use in newly deployed contracts is strongly discouraged even if the new behavior is taken into account. Future changes to the EVM might further reduce the functionality of the opcode.

Support for Apple Silicon

Starting with this release, we are replacing the Intel-only macOS binary (solc-macos) with a universal binary which can run on ARM-based Macs as well. This update ensures that the Solidity compiler runs natively on Apple Silicon architecture, eliminating the need for its users to compile it from source. Intel-based Mac users can continue using the binary as before.

You can find the solc-macos binary on the github release page.

Full Changelog

Language Features

  • Introduce global block.blobbasefee for retrieving the blob base fee of the current block.
  • Introduce global function blobhash(uint) for retrieving versioned hashes of blobs, akin to the homonymous Yul builtin.
  • Yul: Introduce builtin blobbasefee() for retrieving the blob base fee of the current block.
  • Yul: Introduce builtin blobhash() for retrieving versioned hashes of blobs associated with the transaction.
  • Yul: Introduce builtin mcopy() for cheaply copying data between memory areas.
  • Yul: Introduce builtins tload() and tstore() for transient storage access.

Compiler Features

  • EVM: Support for the EVM Version "Cancun".
  • SMTChecker: Support bytes.concat except when string literals are passed as arguments.
  • Standard JSON Interface: Add experimental support to import EVM assembly in the format used by --asm-json.
  • TypeChecker: Comparison of internal function pointers now yields a warning, as it can produce unexpected results with the legacy pipeline enabled.

Bugfixes

  • AST import: Fix bug when importing inline assembly with empty let variable declaration.

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.24. If you want to build from the source code, do not use the source archives generated automatically by GitHub. Instead use solidity_0.8.24.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!

Previous post

Next post

Get involved

GitHub

Twitter

Mastodon

Matrix

Discover more

BlogDocumentationUse casesContributeAboutForum

2023 Solidity Team

Security Policy

Code of Conduct