Introduction

Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.

I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.

I also build and publish a variety of tools, libraries, and open-source projects.

This article covers the changes introduced in Solidity 0.8.27, based on the official release announcement.

Changes

Solidity 0.8.27 introduces the following changes.

  • Custom error support in require.
  • IR caching optimizations.
  • Other compiler changes.

Custom Error Support in require

Solidity 0.8.26 introduced support for custom errors in require.

The following article explains how to use this functionality.

However, it was only available when compiling through the IR pipeline (via Yul). Starting with version 0.8.27, the functionality is available through the legacy code generation pipeline as well.

IR Caching Optimization

This change improves the performance of the intermediate representation (IR) pipeline.

What Is the IR Pipeline?

Instead of translating contract source code directly into bytecode, the compiler first translates it into an intermediate representation and then generates bytecode.

This allows complex contracts to be transformed in stages and enables optimizations, such as reducing gas costs and improving execution efficiency.

When compiling a Solidity contract, the compiler may need the bytecode of another contract on which it depends. Examples include deploying another contract with the new operator or referencing .runtimeCode or .creationCode.

The new Operator

This operator creates another contract from an existing contract. The compiler needs to incorporate the bytecode required to deploy that contract as a dependency of the deploying contract. The IR pipeline handles this dependency.

Referencing .runtimeCode and .creationCode

  • .runtimeCode
    • The bytecode executed after a contract has been deployed.
    • Another contract may reference this code when it needs the deployed bytecode.
  • .creationCode
    • The bytecode used to create a contract.
    • It is used during deployment.

Previously, the IR pipeline incorporated dependent bytecode early, during Yul code generation. This integrated the code without requiring an external linking step, but repeated references to a dependency could cause its code to be optimized repeatedly.

Optimizing the same contract multiple times could substantially increase compilation time.

Version 0.8.27 introduces caching so that the optimized result for a dependent contract can be reused. This avoids redundant optimization work and improves compiler performance.

Specifically, the cache operates at the Yul object level, allowing the optimizer to reuse results when it encounters the same objects again.

The original article reports the following performance improvements.

Project Effect
OpenZeppelin No noticeable impact, as relatively little of the project benefits from this optimization
Uniswap v4 42% speedup
EigenLayer 44% speedup

Other Changes

Reducing Compilation Costs for Tests Using new

Test code frequently deploys new contracts using new. Repeated optimization of the same dependencies can slow compilation. Reusing optimized dependency code through the cache addresses this problem.

The original article refers to version 0.8.28 in this subsection, although the article and linked release announcement concern 0.8.27. Consult the release announcement for the precise version-specific changes.

Transient Storage Support

Transient storage provides temporary storage variables associated with Ethereum's Dencun upgrade.

Version 0.8.27 supports the relevant syntax, although support for transient state variables themselves was not yet complete in this release.

The following article provides additional background.

The --strict-assembly and --yul Options

Solidity previously provided the --yul option for compiling Yul, its intermediate language.

This release removes the experimental typed Yul dialect associated with that option. The --strict-assembly option is used for ordinary Yul compilation, and Yul itself remains supported.

Further Changes

For additional fixes, see the official announcement.

Conclusion

Solidity 0.8.27 expands custom error support and improves compilation performance through IR caching.