Repository navigation
Version 0.8.0
Solidity 0.8.0 is a breaking release of the Solidity compiler and language.
For a detailed explanation of the new features and changes, please see the blog post.
Breaking Changes:
- Code Generator: All arithmetic is checked by default. These checks can be disabled using
unchecked { ... }. - Code Generator: Cause a panic if a byte array in storage is accessed whose length is encoded incorrectly.
- Code Generator: Use
revertwith error signaturePanic(uint256)and error codes instead of invalid opcode on failing assertions. - Command Line Interface: JSON fields
abi,devdoc,userdocandstorage-layoutare now sub-objects rather than strings. - Command Line Interface: Remove the
--old-reporteroption. - Command Line Interface: Remove the legacy
--ast-jsonoption. Only the--ast-compact-jsonoption is supported now. - General: Enable ABI coder v2 by default.
- General: Remove global functions
log0,log1,log2,log3andlog4. - Parser: Exponentiation is right associative.
a**b**cis parsed asa**(b**c). - Scanner: Remove support for the
\b,\f, and\vescape sequences. - Standard JSON: Remove the
legacyASToption. - Type Checker: Function call options can only be given once.
- Type System: Declarations with the name
this,superand_are disallowed, with the exception of public functions and events. - Type System: Disallow
msg.datainreceive()function. - Type System: Disallow
type(super). - Type System: Disallow enums with more than 256 members.
- Type System: Disallow explicit conversions from negative literals and literals larger than
type(uint160).maxtoaddresstype. - Type System: Disallow the
bytetype. It was an alias tobytes1. - Type System: Explicit conversion to
addresstype always returns a non-payableaddresstype. In particular,address(u),address(b),address(c)andaddress(this)have the typeaddressinstead ofaddress payable(Hereu,b, andcare arbitrary variables of typeuint160,bytes20and contract type respectively.) - Type System: Explicit conversions between two types are disallowed if it changes more than one of sign, width or kind at the same time.
- Type System: Explicit conversions from literals to enums are only allowed if the value fits in the enum.
- Type System: Explicit conversions from literals to integer type is as strict as implicit conversions.
- Type System: Introduce
address(...).codeto retrieve the code asbytes memory. The size can be obtained viaaddress(...).code.length, but it will currently always include copying the code. - Type System: Introduce
block.chainidfor retrieving the current chain id. - Type System: Support
address(...).codehashto retrieve the codehash of an account. - Type System: The global variables
tx.originandmsg.senderhave typeaddressinstead ofaddress payable. - Type System: Unary negation can only be used on signed integers, not on unsigned integers.
- View Pure Checker: Mark
chainidas view. - Yul: Disallow the use of reserved identifiers, such as EVM instructions, even if they are not available in the given dialect / EVM version.
- Yul: The
assignimmutablebuiltin in the "EVM with objects" dialect takes the base offset of the code to modify as an additional argument.
Language Features:
- Super constructors can now be called using the member notation e.g.
M.C(123).
Bugfixes:
- Type Checker: Perform proper truncating integer arithmetic when using constants in array length expressions.
AST Changes:
- New AST Node
IdentifierPathreplacing in many places theUserDefinedTypeName. - New AST Node
UncheckedBlockused forunchecked { ... }.
We especially thank all the contributors that made this release possible:
Alex Beregszaszi, Christian Parpart, Daniel Kirchner, Djordje Mijovic, Harikrishnan Mulackal, Kamil Śliwak, Leonardo Alt, Mathias Baumann, ssi91
If you want to perform a source build, please only use solidity_0.8.0.tar.gz and not the zip provided by github directly.