{ skip to content }

Solidity 0.8.18 Release Announcement

Posted by Solidity Team on February 1, 2023

Releases

Introducing the newest version of the Solidity Compiler!

We are excited to announce the latest release of the Solidity Compiler, Solidity v0.8.18. This latest version includes a range of improvements and it also introduces support for the Paris upgrade!

Notable New Features

These are the features we want to highlight in this release.

Disabling CBOR metadata

A new command-line flag (--no-cbor-metadata) and Standard JSON option (settings.metadata.appendCBOR: false) to prevent compiler from appending the CBOR metadata section at the end of the bytecode. Until now, it was only possible to exclude the hash of the JSON metadata file (--metadata-hash none/settings.metadata.bytecodehash: "none") from that section, but the bytecode would still include a small bit of CBOR data containing the version of the compiler.

Support for Paris Hardfork

The support for the Paris hard fork, includes:

  • Deprecation of global block.difficulty built-in in Solidity and removal of difficulty() instruction from inline assembly for EVM versions >= Paris. The change is due to the renaming and semantic changes of the difficulty instruction introduced by EIP-4399.
  • Introduction of global block.prevrandao built-in in Solidity and prevrandao() instruction in inline assembly for EVM versions >= Paris.

Note: block.difficulty is planned to be removed entirely in Solidity version 0.9.0.

Deprecation of selfdestruct

selfdestruct is now considered deprecated (EIP-6049) and the compiler will warn about its use, both in Solidity and in Yul, including inline assembly. There is currently no replacement, but its use is highly discouraged because it will eventually change its semantics and all contracts using it will be affected in some way.

EVM bytecode generation from Yul

This release also involves a change in the generation of EVM bytecode from Yul code when the optimizer is enabled: for Yul functions that never return back to the caller (i.e. always revert or always terminate the EVM call), the compiler no longer pushes a return label. The label is only used to jump back to the caller. This will decrease both gas cost and code size. Tooling that relies on the current calling convention on the bytecode level may need to be adjusted to accommodate this change.

Full Changelog

Language Features

  • Allow named parameters in mapping types.

Compiler Features

  • Commandline Interface: Add --no-cbor-metadata that skips CBOR metadata from getting appended at the end of the bytecode.
  • Commandline Interface: Return exit code 2 on uncaught exceptions.
  • EVM: Deprecate block.difficulty and disallow difficulty() in inline assembly for EVM versions >= paris. The change is due to the renaming introduced by EIP-4399.
  • EVM: Introduce block.prevrandao in Solidity and prevrandao() in inline assembly for EVM versions >= paris.
  • EVM: Set the default EVM version to "Paris".
  • EVM: Support for the EVM version "Paris".
  • Language Server: Add basic document hover support.
  • Natspec: Add event Natspec inheritance for devdoc.
  • Optimizer: Added optimization rule and(shl(X, Y), shl(X, Z)) => shl(X, and(Y, Z)).
  • Parser: More detailed error messages about invalid version pragmas.
  • SMTChecker: Make z3 the default solver for the BMC and CHC engines instead of all solvers.
  • SMTChecker: Support Eldarica as a Horn solver for the CHC engine when using the CLI option --model-checker-solvers eld. The binary eld must be available in the system.
  • Solidity Upgrade Tool: Remove solidity-upgrade tool.
  • Standard JSON: Add a boolean field settings.metadata.appendCBOR that skips CBOR metadata from getting appended at the end of the bytecode.
  • TypeChecker: Warn when using deprecated builtin selfdestruct.
  • Yul EVM Code Transform: Generate more optimal code for user-defined functions that always terminate a transaction. No return labels will be pushed for calls to functions that always terminate.
  • Yul Optimizer: Allow replacing the previously hard-coded cleanup sequence by specifying custom steps after a colon delimiter (:) in the sequence string.
  • Yul Optimizer: Eliminate keccak256 calls if the value was already calculated by a previous call and can be reused.

Bugfixes

  • Parser: Disallow several indexed attributes for the same event parameter.
  • Parser: Disallow usage of the indexed attribute for modifier parameters.
  • SMTChecker: Fix display error for negative integers that are one more than powers of two.
  • SMTChecker: Fix internal error on chain assignments using static fully specified state variables.
  • SMTChecker: Fix internal error on multiple wrong SMTChecker natspec entries.
  • SMTChecker: Fix internal error when a public library function is called internally.
  • SMTChecker: Fix internal error when deleting struct member of function type.
  • SMTChecker: Fix internal error when using user-defined types as mapping indices or struct members.
  • SMTChecker: Improved readability for large integers that are powers of two or almost powers of two in error messages.
  • TypeChecker: Fix bug where private library functions could be attached with using for outside of their declaration scope.
  • Yul Optimizer: Hash hex and decimal literals according to their value instead of their representation, improving the detection of equivalent functions.

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.18. 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.18.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.18 to take advantage of these improvements and optimizations. Our team remains dedicated to continuously enhancing Solidity to benefit the entire Ethereum ecosystem.

Get ready to unleash your creativity and build impactful decentralized applications with the latest version of the Solidity Compiler. Happy coding!

UPDATE 2023-02-02: Rebuilt Linux binary for Solidity 0.8.18

The Linux binary for the 0.8.18 release was originally built against a too recent version of glibc and thereby did not run on older Linux systems. Therefore, we rebuilt and replaced the binary so that you may encounter an older version of solc-linux-amd64-v0.8.18+commit.87f61d96 that does not match the hash you can find on the list of currently published Linux binaries. Both versions of the compiler will behave identically other than the fact that only the new one will work on systems with glibc versions older than 2.32.

To be clear: both binaries will produce identical outputs under all circumstances, including the commit hash in the metadata. Only the hash of the compiler binary itself will change due to the replacement, but the new binary will always produce byte-identical output.

In the listings at https://binaries.soliditylang.org, the original, now replaced binary, was listed as follows:

{
  "path": "solc-linux-amd64-v0.8.18+commit.87f61d96",
  "version": "0.8.18",
  "build": "commit.87f61d96",
  "longVersion": "0.8.18+commit.87f61d96",
  "keccak256": "0x265ad8479d7c5d30ef3556c5c23efddbf1718c1112abd219a6add420489cf930",
  "sha256": "0xa1c0f33eb4482c26f56719ecf62b0ee05d7d7a4f8264ffbddf9ebcd9095c32bd",
  "urls": [
    "bzzr://bc795017b74430520c9fd41300536f45d43edb74ca3c497ce2117d1954bbca12",
    "dweb:/ipfs/QmPkAoHf5hNoZS9W7uZhrGgVTSPoCui3h9MEEKTTfSe8am"
  ]
}

It has been replaced with:

{
  "path": "solc-linux-amd64-v0.8.18+commit.87f61d96",
  "version": "0.8.18",
  "build": "commit.87f61d96",
  "longVersion": "0.8.18+commit.87f61d96",
  "keccak256": "0x932901581a2ef0795851363522811fa160db5561e34cbb306e7105b6bbc3834d",
  "sha256": "0x95e6ed4949a63ad89afb443ecba1fb8302dd2860ee5e9baace3e674a0f48aa77",
  "urls": [
    "bzzr://61828ca55d703ddcd2ceff0e20a48ae6bca28a58b09725836893dc5f6b8e8018",
    "dweb:/ipfs/Qmf68UBPAspGAh6TJ1F9zKLFy3WjvH6W43HvzWWGAUQXTv"
  ]
}

Previous post

Next post

Get involved

GitHub

Twitter

Mastodon

Matrix

Discover more

BlogDocumentationUse casesContributeAboutForum

2023 Solidity Team

Security Policy

Code of Conduct