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.25, based on the official release announcement.

Changes

Solidity 0.8.25 introduces the following changes.

  • The default EVM target changes to Cancun.
  • The code generator uses the mcopy opcode.
  • The compiler changes how often it emits warnings for tstore.

Cancun Becomes the Default EVM Target

Ethereum's Dencun upgrade introduced Cancun, a new EVM version. Solidity's default compiler target now generates code for Cancun.

MCOPY Support in the Code Generator

Solidity 0.8.24 introduced support for the mcopy opcode in Yul and inline assembly.

For an introduction to Yul and inline assembly, see the following article.

In Solidity 0.8.25, the code generator replaces memory-copy loops using mload and mstore with mcopy, enabling more efficient memory copying.

mload

This instruction reads 32 bytes (256 bits) from memory at the specified address.

solidity
uint256 value = mload(add(memPtr, offset));

This example illustrates reading 32 bytes from the memory address obtained by adding offset to memPtr and assigning the result to value.

mstore

This instruction writes 32 bytes (256 bits) to the specified memory address.

solidity
mstore(add(memPtr, offset), value);

This example writes value as 32 bytes at the address obtained by adding offset to memPtr.

mcopy

This instruction copies data from one memory region to another, efficiently moving contiguous regions of memory.

solidity
mcopy(destPtr, srcPtr, length);

This copies length bytes from srcPtr to destPtr.

Compared with copying through separate mload and mstore instructions, mcopy performs the copy in a single instruction and can reduce execution cost.

Examples of operations that may benefit from memory copying include abi.encode() and abi.decode(). Encoding converts typed data to bytes, and decoding recovers typed values from the encoded bytes. These operations can involve copying substantial amounts of memory.

The overall gas savings may be modest because the compiler already avoids unnecessary memory copies where possible. Moreover, mcopy cannot directly copy from other data regions such as calldata, storage, or returndata.

Changes to TSTORE Warning Frequency

Transient storage retains temporary data until a transaction ends. The EVM provides the tstore and tload opcodes to access it.

Incorrect use of transient storage can cause unexpected behavior or bugs. Starting in Solidity 0.8.24, the compiler emitted warnings when tstore was used.

Because repeated warnings can be distracting, Solidity 0.8.25 changes this behavior so the warning appears only once per compilation.

Other Changes

For additional minor changes, see the official release announcement.

Conclusion

Solidity 0.8.25 updates the default EVM target, improves generated memory-copy code, and reduces repetitive transient storage warnings.