{ skip to content }

Solidity 0.8.3 Release Announcement

Posted by Solidity Team on March 23, 2021

Releases

Solidity v0.8.3 fixes the Solidity Optimizer Keccak Caching Bug, which is present in all prior versions of Solidity, and, in addition, includes two improvements to the optimizer which can provide a big gas benefit when writing structs that cover a full storage slot to storage.

Important Bugfixes

Solidity Optimizer Keccak Caching Bug

On March 20, 2021, a bug in Solidity’s bytecode optimizer was found by differential fuzzing. The bug is fixed with this version. The bug is present in all prior versions of Solidity and has a severity level of "medium". To learn more about the bug and check if your code is affected by it, please read the corresponding Security Alert.

Notable New Features

Optimizer Improvements

There are two optimizer improvements included in this release, namely improving storage writes for small types and replacing multiplications and divisions with powers of two by shifts. The former will make writing packed structs more gas efficient. In the following example, writing to the struct avoids reading from storage, i.e., the optimizer would be able to remove the redundant sload:

struct S {
    address a;
    uint96 b;
}

contract C {
    S s;
    function f(uint96 _b) public {
        s.a = msg.sender;
        s.b = _b;
    }
}

In the EVM, the shift operations (shl, shr and sar) are cheaper than the arithmetic operations mul and div. We added an optimization rule that converts multiplication and division by powers of two into shl and shr respectively. On top of the small gas saving from this simple rule, the rule also chains well with other shift operations. For example: shl(10, mul(x, 256)) -> shl(10, shl(8, x)) -> shl(18, x).

Full Changelog

Important Bugfixes:

  • Optimizer: Fix bug on incorrect caching of Keccak-256 hashes.

Compiler Features:

  • Command Line Interface: Drop experimental support for --machine evm15.
  • Optimizer: Try to move and with constant inside or to improve storage writes of small types.
  • Optimizer: Replace multiplications and divisions with powers of two by shifts.

Bugfixes:

  • AST Import: For constructors, a public visibility is ignored during importing.
  • Error Reporter: Fix handling of carriage return.
  • SMTChecker: Fix internal error in BMC on resolving virtual functions inside branches.
  • SMTChecker: Fix internal error on array.pop nested inside 1-tuple.
  • SMTChecker: Fix internal error on FixedBytes constant initialized with string literal.
  • SMTChecker: Fix internal error on array slices.
  • SMTChecker: Fix internal error on calling public getter on a state variable of type array (possibly nested) of structs.
  • SMTChecker: Fix internal error on pushing to string casted to bytes.
  • SMTChecker: Fix bug in virtual functions called by constructors.

AST Changes:

  • ModifierInvocation: Add kind field which can be modifierInvocation or baseConstructorSpecifier.

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