Solidity v0.8.12 improves the JavaScript / Wasm binary and fixes several bugs.

Notable New Features

Emscripten Build / solc-js

We were able to reduce the size of the JavaScript / WebAssembly binaries from 27 MB to just over 8 MB. The reason for the large binary in the first place is that we include the SMT solver Z3.

The size reduction is achieved by compressing the binary using LZ4 and decompressing it when it is loaded, which should be completely transparent to the user. We were initially worried that this might have a negative impact on people who switch compiler versions often or always run it in a fresh Node.js environment, but our benchmarks show that the decompression is faster than the base64 decoding, so it should not be an issue.

TypeScript Migration of solc-js

The code for the JavaScript wrappers of the compiler has been partially ported to TypeScript, which should have no impact on users of the npm package. If you build the package yourself or use the repository without the npm package, please contact us if you encounter any problems.

Full Changelog

Language Features:

  • General: Add equality-comparison operators for external function types.
  • General: Support ContractName.functionName for abi.encodeCall, in addition to external function pointers.

Compiler Features:

  • Commandline Interface: Event and error signatures are also returned when using --hashes.
  • Yul Optimizer: Remove mstore and sstore operations if the slot already contains the same value.
  • Yul: Emit immutable references for pure yul code when requested.

Bugfixes:

  • Antlr Grammar: Allow builtin names in yulPath to support .address in function pointers.
  • Code Generator: Fix internal error when accessing the members of external functions occupying more than two stack slots.
  • Code Generator: Fix internal error when doing an explicit conversion from string calldata to bytes.
  • Control Flow Graph: Perform proper virtual lookup for modifiers for uninitialized variable and unreachable code analysis.
  • General: string.concat now properly takes strings as arguments and returns string memory. It was accidentally introduced as a copy of bytes.concat before.
  • Immutables: Fix wrong error when the constructor of a base contract uses return and the derived contract contains immutable variables.
  • Inheritance: Consider functions in all ancestors during override analysis.
  • IR Generator: Add missing cleanup during the conversion of fixed bytes types to smaller fixed bytes types.
  • IR Generator: Add missing cleanup for indexed event arguments of value type.
  • IR Generator: Fix internal error when copying reference types in calldata and storage to struct or array members in memory.
  • IR Generator: Fix IR syntax error when copying storage arrays of structs containing functions.
  • Natspec: Fix internal error when overriding a struct getter with a Natspec-documented return value and the name in the struct is different.
  • Type Checker: Fix internal error when a constant variable declaration forward references a struct.
  • Yul EVM Code Transform: Improved stack shuffling in corner cases.

Solc-Js:

  • The wrapper now requires at least nodejs v10.
  • The code has been ported to TypeScript.

Build System:

  • Emscripten builds store the embedded WebAssembly binary in LZ4 compressed format and transparently decompress on loading.

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

Download the new version of Solidity here.