Version 0.4.22
This release features several major and long-awaited changes:
- It is now possible to access dynamic data (arrays, strings, etc) returned by function calls.
- You can specify error reason strings for
revert
andrequire
(support by tooling is still pending). - We added the global functions
abi.encode()
,abi.encodePacked()
,abi.encodeWithSelector()
andabi.encodeWithSignature()
which expose the ABI encoding functions and each return abytes
value. - Constructors should now be defined using
constructor(uint arg1, uint arg2) { ... }
to make them stand out and avoid bugs when contracts are renamed but not their constructors. - Some array operations got cheaper, especially the
push
function and initialization of memory arrays.
If you want to perform a source build, please only use solidity_0.4.22.tar.gz and not the zip provided by github directly.
Features:
- Code Generator: Initialize arrays without using
msize()
. - Code Generator: More specialized and thus optimized implementation for
x.push(...)
- Commandline interface: Error when missing or inaccessible file detected. Suppress it with the
--ignore-missing
flag. - Constant Evaluator: Fix evaluation of single element tuples.
- General: Add encoding routines
abi.encodePacked
,abi.encode
,abi.encodeWithSelector
andabi.encodeWithSignature
. - General: Add global function
gasleft()
and deprecatemsg.gas
. - General: Add global function
blockhash(uint)
and deprecateblock.hash(uint)
. - General: Allow providing reason string for
revert()
andrequire()
. - General: Allow and recommend new constructor syntax using the
constructor
keyword (generate error as experimental 0.5.0 feature). - General: Limit the number of errors output in a single run to 256.
- General: Support accessing dynamic return data in post-byzantium EVMs.
- Inheritance: Error when using empty parentheses for base class constructors that require arguments as experimental 0.5.0 feature.
- Inheritance: Error when using no parentheses in modifier-style constructor calls as experimental 0.5.0 feature.
- Interfaces: Allow overriding external functions in interfaces with public in an implementing contract.
- Optimizer: Optimize
SHL
andSHR
only involving constants (Constantinople only). - Optimizer: Remove useless
SWAP1
instruction preceding a commutative instruction (such asADD
,MUL
, etc). - Optimizer: Replace comparison operators (
LT
,GT
, etc) with opposites if preceded bySWAP1
, e.g.SWAP1 LT
is replaced withGT
. - Optimizer: Optimize across
mload
ifmsize()
is not used. - Static Analyzer: Error on duplicated super constructor calls as experimental 0.5.0 feature.
- Syntax Checker: Issue warning for empty structs (or error as experimental 0.5.0 feature).
- Syntax Checker: Warn about modifiers on functions without implementation (this will turn into an error with version 0.5.0).
- Syntax Tests: Add source locations to syntax test expectations.
- Type Checker: Improve documentation and warnings for accessing contract members inherited from
address
.
Bugfixes:
- Code Generator: Allow
block.blockhash
without being called. - Code Generator: Do not include internal functions in the runtime bytecode which are only referenced in the constructor.
- Code Generator: Properly skip unneeded storage array cleanup when not reducing length.
- Code Generator: Bugfix in modifier lookup in libraries.
- Code Generator: Implement packed encoding of external function types.
- Code Generator: Treat empty base constructor argument list as not provided.
- Code Generator: Properly force-clean bytesXX types for shortening conversions.
- Commandline interface: Fix error messages for imported files that do not exist.
- Commandline interface: Support
--evm-version constantinople
properly. - DocString Parser: Fix error message for empty descriptions.
- Gas Estimator: Correctly ignore costs of fallback function for other functions.
- JSON AST: Remove storage qualifier for type name strings.
- Parser: Fix internal compiler error when parsing
var
declaration without identifier. - Parser: Fix parsing of getters for function type variables.
- Standard JSON: Support
constantinople
asevmVersion
properly. - Static Analyzer: Fix non-deterministic order of unused variable warnings.
- Static Analyzer: Invalid arithmetic with constant expressions causes errors.
- Type Checker: Fix detection of recursive structs.
- Type Checker: Fix asymmetry bug when comparing with literal numbers.
- Type System: Improve error message when attempting to shift by a fractional amount.
- Type System: Make external library functions accessible.
- Type System: Prevent encoding of weird types.
- Type System: Restrict rational numbers to 4096 bits.
We especially thank all our open source community contributors:
Sergiusz Bazanski, Federico Bond, Anthony Broad-Crawford, Jason Cobb, dongsamb, Robbie Ferguson, Kevin Florenzano, Grzegorz Hasse, hydai, Lefteris Karapetsas, kevinflo, NetX, Daniel R, Matías A. Ré Medina, Roman, Yosyp Schwab, wbt, Li Xuanji, Haoliang Yu