Solidity v0.8.6 fixes some non-critical but annoying bugs, especially a warning about unreachable code that is in fact reachable.

Bugfixes

Unreachable Warning

With Solidity 0.8.5, we released a new feature that detects if code is unreachable because a called function always reverts before the code is executed. This detection contained a bug in connection with nested calls to internal library functions where the “reverting behaviour” of a function was not properly updated after a function called by it was determined to be not always reverting.

Because the bug was rather common, we are releasing this version with an unusually short changelog.

Optimizer Setting

We discovered that the default optimizer setting differed depending on the way the compiler was invoked: Using the compiler on the commandline (“solc”) caused minimal optimizer features to be activated (the intended functionality) while using solc-js all optimizer features were disabled.

These minimal features are the “peephole optimizer”, a routine that performs obvious replacements like removing PUSH1 0 POP and the “jumpdest remover” which removes code that is not jumped to from anywhere.

The peephole optimizer and the jumpdest remover are activated even when setting settings.optimizer.enabled to false in Standard JSON and have to be explicitly disabled in the detailed settings.

The bug was that providing a value for settings.optimizer but not including enabled in it was not equivalent to setting enabled to false. It was equivalent to explicitly disabling all optimizer components. If settings.optimizer was not provided at all, the bug did not manifest.

Full Changelog

Language Features

  • Yul: Special meaning of ".metadata" data object in Yul object.

Bugfixes

  • Control Flow Graph: Fix incorrectly reported unreachable code.
  • Solc-Js: When running solcjs without the --optimize flag, use settings.optimizer.enabled=false in Standard JSON instead of omitting the key.
  • Standard JSON: Omitting settings.optimizer.enabled was not equivalent to setting it to false. It meant disabling also the peephole optimizer and jumpdest remover which by default still run with enabled=false.

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

Download the new version of Solidity here.