{ skip to content }

Solidity 0.8.4 Release Announcement

Posted by Solidity Team on April 21, 2021

Releases

Solidity v0.8.4 adds custom structured errors, bytes.concat(...), allows more flexible configuration of the SMT checker and fixes a bug in the Solidity ABI decoder v2.

Important Bugfixes:

On April 5th, 2021, a bug in the Solidity ABI decoder v2 was reported by John Toman of the Certora development team. For two-dimensional arrays and specially crafted data in memory, the result of abi.decode can depend on data elsewhere in memory. Calldata decoding is not affected. The bug is present in all prior versions of ABI coder v2 and was assigned a severity level of "very low". Read all details on the bug and who should be concerned in the corresponding security alert.

Notable New Features

Custom Errors

Errors can now be defined inside and outside of contracts (including interfaces and libraries). This provides a convenient and gas-efficient way to explain to users why an operation failed. Read more details on Custom Errors in this explainer post.

SMTChecker

We are starting to deprecate pragma experimental SMTChecker;. From Solidity 0.8.4 on the standard way to activate the SMTChecker is by either using the CLI option --model-checker-engine {all,chc,bmc} or the JSON option settings.modelChecker.engine={all,chc,bmc}. The pragma version will still work until the next breaking release, where it will be removed completely. Furthermore, the SMTChecker now also verifies whether index accesses are safe, and allows users to choose precisely which contracts should be analyzed, potentially reducing the complexity of the generated symbolic model and increasing proving power.

Full Changelog

Important Bugfixes:

  • ABI Decoder V2: For two-dimensional arrays and specially crafted data in memory, the result of abi.decode can depend on data elsewhere in memory. Calldata decoding is not affected.

Language Features:

  • Assembly / Yul: Allow hex string literals.
  • Possibility to use bytes.concat with variable number of bytes and bytesNN arguments which behaves as a restricted version of abi.encodePacked with a more descriptive name.
  • Support custom errors via the error keyword and introduce the revert statement.

Compiler Features:

  • Analysis: Properly detect circular references to the bytecode of other contracts across all function calls.
  • Commandline Interface: Model checker option --model-checker-targets also accepts outOfBounds.
  • Commandline Interface: New model checker option --model-checker-contracts allows users to select which contracts should be analyzed as the most derived.
  • Low-Level Inliner: Inline ordinary jumps to small blocks and jumps to small blocks that terminate.
  • NatSpec: Allow @notice tag on non-public state variables and local variable declarations. The documentation will only be part of the AST, under the field documentation.
  • SMTChecker: Deprecate pragma experimental SMTChecker; and set default model checker engine to none.
  • SMTChecker: Report local variables in CHC counterexamples.
  • SMTChecker: Report out of bounds index access for arrays and fixed bytes.
  • SMTChecker: Support file level functions and constants.
  • Standard JSON: Model checker option settings.modelChecker.targets also accepts outOfBounds.
  • Standard JSON: Model checker option settings.modelChecker.targets takes an array of string targets instead of string of comma separated targets.
  • Standard JSON: New model checker option settings.modelChecker.contracts allows users to select which contracts should be analyzed as the most derived.
  • Yul EVM Code Transform: Stack Optimization: Reuse slots of unused function arguments and defer allocating stack slots for return variables until after expression statements and assignments that do not reference them.
  • Yul Optimizer: Added a new step FunctionSpecializer, that specializes a function with its literal arguments.

Bugfixes:

  • Antlr Grammar: Fix parsing of import paths involving properly distinguishing between empty and non-empty string literals in general.
  • AST Output: Fix kind field of ModifierInvocation for base constructor calls.
  • Commandline interface: Fix internal error when printing AST and using --base-path or file:// prefix in imports.
  • Commandline interface: Fix standard input bypassing allowed path checks.
  • Natspec: Fix internal error related to the @returns documentation for a public state variable overriding a function.
  • SMTChecker: Fix false positive and false negative on push as LHS of a compound assignment.
  • SMTChecker: Fix false positive in contracts that cannot be deployed.
  • SMTChecker: Fix internal error on public getter returning dynamic data on older EVM versions where these are not available.
  • SMTChecker: Fix internal error on try-catch with function call in catch block.
  • Type Checker: Fix missing error when events are used without an emit statement.

AST Changes:

  • New property for ContractDefinition nodes: usedErrors lists AST IDs of all errors used by the contract (even if defined outside).

A big thank you to all contributors who helped make this release possible!

Download the new version of Solidity here.

Previous post

Next post

Get involved

GitHub

Twitter

Mastodon

Matrix

Discover more

BlogDocumentationUse casesContributeAboutForum

2024 Solidity Team

Security Policy

Code of Conduct