Releases: ethereum/solidity
Version 0.7.3
This release fixes a bug in the routine that copies dynamically-sized arrays to storage. More details about the bug can be found in the blog post.
Important Bugfixes
- Code Generator: Properly cleanup after copying dynamic-array to storage for packed types.
Compiler Features
- Code generator: Implemented events with function type as one of its indexed parameters.
- General: Option to stop compilation after parsing stage. Can be used with
solc --stop-after parsing
- Optimizer: Optimize
exp
when base is-1
. - SMTChecker: Support
addmod
andmulmod
. - SMTChecker: Support array slices.
- SMTChecker: Support type conversions.
Bugfixes
- Fixed internal compiler errors for certain contracts involving the
new
expression. - JSON AST: Fix internal error when using
--ast-json
on a function with memory arguments in ABIEncoderV2 contracts. - Type Checker: Add missing checks for calls using types incompatible with ABIEncoderV1 in modules where ABIEncoderV2 is not enabled.
- Type Checker: Fix internal compiler error when calling
.push(<arg>)
for a storage array with a nested mapping.
We especially thank all the contributors that made this release possible:
a3d4, Alex Beregszaszi, Alexander Arlt, Djordje Mijovic, Harikrishnan Mulackal, Leonardo Alt, Mathias Baumann
If you want to perform a source build, please only use solidity_0.7.3.tar.gz and not the zip provided by github directly.
Version 0.7.2
This release of Solidity includes a fix for the "free functions" feature introduced in the previous release: Two free functions with the same name and parameter types were not considered an error. For more details, please see the blog post.
The language support by the SMT checker has also been expanded considerably and the compiler can now export generated internal routines like the ABI encoder and decoder as readable Yul code.
Important Bugfixes
- Type Checker: Disallow two or more free functions with identical name (potentially imported and aliased) and parameter types.
Compiler Features
- Export compiler-generated utility sources via standard-json or combined-json.
- Optimizer: Optimize
exp
when base is 0, 1 or 2. - SMTChecker: Keep knowledge about string literals, even through assignment, and thus support the
.length
property properly. - SMTChecker: Support
address
type conversion with literals, e.g.address(0)
. - SMTChecker: Support
revert()
. - SMTChecker: Support
type(T).min
,type(T).max
, andtype(I).interfaceId
. - SMTChecker: Support compound and, or, and xor operators.
- SMTChecker: Support events and low-level logs.
- SMTChecker: Support fixed bytes index access.
- SMTChecker: Support memory allocation, e.g.
new bytes(123)
. - SMTChecker: Support shifts.
- SMTChecker: Support structs.
- Type Checker: Explain why oversized hex string literals can not be explicitly converted to a shorter
bytesNN
type. - Type Checker: More detailed error messages why implicit conversions fail.
- Type Checker: Report position of first invalid UTF-8 sequence in
unicode""
literals. - Yul IR Generator: Report source locations related to unimplemented features.
- Yul Optimizer: Inline into functions further down in the call graph first.
- Yul Optimizer: Prune unused parameters in functions.
- Yul Optimizer: Try to simplify function names.
Bugfixes
- Code generator: Fix internal error on stripping dynamic types from return parameters on EVM versions without
RETURNDATACOPY
. - Type Checker: Add missing check against nested dynamic arrays in ABI encoding functions when ABIEncoderV2 is disabled.
- Type Checker: Correct the error message for invalid named parameter in a call to refer to the right argument.
- Type Checker: Correct the warning for homonymous, but not shadowing declarations.
- Type Checker: Disallow
virtual
for modifiers in libraries. - Type system: Fix internal error on implicit conversion of contract instance to the type of its
super
. - Type system: Fix internal error on implicit conversion of string literal to a calldata string.
- Type system: Fix named parameters in overloaded function and event calls being matched incorrectly if the order differs from the declaration.
- ViewPureChecker: Prevent visibility check on constructors.
We especially thank all the contributors that made this release possible:
a3d4, Alex Beregszaszi, Alexander Arlt, Bhargava Shastry, Christian Parpart, Daniel Kirchner, Djordje Mijovic, Đorđe Mijović, franzihei, Harikrishnan Mulackal, John B Nelson, Kamil Śliwak, Leonardo Alt, Mathias Baumann, Nikesh Nazareth, Omkar Nikhal, Wayne Nilsen
If you want to perform a source build, please only use solidity_0.7.2.tar.gz and not the zip provided by github directly.
Version 0.7.1
This release introduces the possibility to define functions at file level. This is a way to define helper-functions that are independent of specific contracts which is much more natural than using internal library functions. Apart from this, the release contains many bugfixes.
Language Features:
- Allow function definitions outside of contracts, behaving much like internal library functions.
- Code generator: Implementing copying structs from calldata to storage.
Compiler Features:
- SMTChecker: Add underflow and overflow as verification conditions in the CHC engine.
- SMTChecker: Support bitwise or, xor and not operators.
- SMTChecker: Support conditional operator.
- Standard JSON Interface: Do not run EVM bytecode code generation, if only Yul IR or EWasm output is requested.
- Yul Optimizer: LoopInvariantCodeMotion can move reading operations outside for-loops as long as the affected area is not modified inside the loop.
- Yul: Report error when using non-string literals for
datasize()
,dataoffset()
,linkersymbol()
,loadimmutable()
,setimmutable()
.
Bugfixes:
- AST: Remove
null
member values also when the compiler is used in standard-json-mode. - General: Allow
type(Contract).name
for abstract contracts and interfaces. - Immutables: Disallow assigning immutables more than once during their declaration.
- Immutables: Properly treat complex assignment and increment/decrement as both reading and writing and thus disallow it everywhere for immutable variables.
- Optimizer: Keep side-effects of
x
inbyte(a, shr(b, x))
even if the constantsa
andb
would make the expression zero unconditionally. This optimizer rule is very hard if not impossible to trigger in a way that it can result in invalid code, though. - References Resolver: Fix internal bug when using constructor for library.
- Scanner: Fix bug where whitespace would be allowed within the
->
token (e.g.function f() - > x {}
becomes invalid in inline assembly and Yul). - SMTChecker: Fix internal error in BMC function inlining.
- SMTChecker: Fix internal error on array implicit conversion.
- SMTChecker: Fix internal error on fixed bytes index access.
- SMTChecker: Fix internal error on lvalue unary operators with tuples.
- SMTChecker: Fix internal error on tuple assignment.
- SMTChecker: Fix internal error on tuples of one element that have tuple type.
- SMTChecker: Fix soundness of array
pop
. - Type Checker: Disallow
using for
directive inside interfaces. - Type Checker: Disallow signed literals as exponent in exponentiation operator.
- Type Checker: Disallow structs containing nested mapping in memory as parameters for library functions.
- Yul Optimizer: Ensure that Yul keywords are not mistakenly used by the NameDispenser and VarNameCleaners. The bug would manifest as uncompilable code.
- Yul Optimizer: Make function inlining order more resilient to whether or not unrelated source files are present.
We especially thank all the contributors that made this release possible:
a3d4, Alex Beregszaszi, Alexander Arlt, Bhargava Shastry, cakesoft-omkar, Christian Parpart, Daniel Kirchner, Đorđe Mijović, Goh Chun Lin, hactrox, Harikrishnan Mulackal, Harry Altman, Jason Cobb, Kamil Śliwak, Leonardo Alt, Mathias Baumann.
If you want to perform a source build, please only use solidity_0.7.1.tar.gz and not the zip provided by github directly.
Version 0.7.0
Solidity 0.7.0 is a breaking release of the Solidity compiler and language.
This release does not include many features but rather changes that require a
backwards-incompatible adjustment in syntax or semantics. For a detailed explanation,
please see the documentation.
Most notably, further cleanup of visibility and state mutability has been performed
and several unpopular keywords have been removed. Types with mappings
in memory are disallowed and shift and exponentiation operations use more reasonable types.
Since we usually do not backport bugfixes, it is recommended to upgrade all code to be compatible with Solidity v.0.7.0.
The solidity-upgrade tool can help you to semi-automatically upgrade your contracts to breaking language changes. While solidity-upgrade
carries out a large part of the work, your contracts will most likely need further manual adjustments.
You can find a guide on how to update your code here.
Note that changes listed below are the changes between 0.6.12 and 0.7.0. For changes introduced
during the 0.6.x series, please see the individual changelogs or release announcements on this blog.
Breaking Changes:
- Inline Assembly: Disallow
.
in user-defined function and variable names. - Inline Assembly: Slot and offset of storage pointer variable
x
are accessed viax.slot
andx.offset
instead ofx_slot
andx_offset
. - JSON AST: Mark hex string literals with
kind: "hexString"
. - JSON AST: Remove members with
null
value from JSON output. - Parser: Disallow
gwei
as identifier. - Parser: Disallow dot syntax for
value
andgas
. - Parser: Disallow non-printable characters in string literals.
- Parser: Introduce Unicode string literals:
unicode"😃"
. - Parser: NatSpec comments on variables are only allowed for public state variables.
- Parser: Remove the
finney
andszabo
denominations. - Parser: Remove the identifier
now
(replaced byblock.timestamp
). - Reference Resolver:
using A for B
only affects the contract it is mentioned in and not all derived contracts - Type Checker: Disallow
virtual
for library functions. - Type Checker: Disallow assignments to state variables that contain nested mappings.
- Type checker: Disallow events with same name and parameter types in inheritance hierarchy.
- Type Checker: Disallow shifts by signed types.
- Type Checker: Disallow structs and arrays in memory or calldata if they contain nested mappings.
- Type Checker: Exponentiation and shifts of literals by non-literals will always use
uint256
orint256
as a type. - Yul: Disallow consecutive and trailing dots in identifiers. Leading dots were already disallowed.
- Yul: Disallow EVM instruction
pc()
.
Language Features:
- Inheritance: Allow overrides to have stricter state mutability:
view
can overridenonpayable
andpure
can overrideview
. - Parser: Deprecate visibility for constructors.
- State mutability: Do not issue recommendation for stricter mutability for virtual functions but do issue it for functions that override.
Compiler Features:
- SMTChecker: Report multi-transaction counterexamples including the function calls that initiate the transactions. This does not include concrete values for reference types and reentrant calls.
- Variable declarations using the
var
keyword are not recognized anymore.
Bugfixes:
- Inheritance: Disallow public state variables overwriting
pure
functions. - NatSpec: Constructors and functions have consistent userdoc output.
- SMTChecker: Fix internal error when assigning to a 1-tuple.
- SMTChecker: Fix internal error when tuples have extra effectless parenthesis.
- State Mutability: Constant public state variables are considered
pure
functions. - Type Checker: Fixing deduction issues on function types when function call has named arguments.
- Immutables: Fix internal compiler error when immutables are not assigned.
We especially thank all the contributors that made this release possible:
a3d4, Alex Beregszaszi, Alexander Arlt, Bhargava Shastry, Christian Parpart, Daniel Kirchner, Djordje Mijovic, Erik Kundt, franzihei, Harikrishnan Mulackal, Leonardo Alt, Mathias Baumann.
If you want to perform a source build, please only use solidity_0.7.0.tar.gz and not the zip provided by github directly.
Version 0.6.12
This release of Solidity adds more flexibility to inheriting NatSpec and improves the handling of the stack.
Language Features:
- NatSpec: Implement tag
@inheritdoc
to copy documentation from a specific base contract. - Wasm backend: Add
i32.ctz
,i64.ctz
,i32.popcnt
, andi64.popcnt
.
Compiler Features:
- Code Generator: Avoid double cleanup when copying to memory.
- Code Generator: Evaluate
keccak256
of string literals at compile-time. - Optimizer: Add rule to remove shifts inside the byte opcode.
- Peephole Optimizer: Add rule to remove swap after dup.
- Peephole Optimizer: Remove unnecessary masking of tags.
- Yul EVM Code Transform: Free stack slots directly after visiting the right-hand-side of variable declarations instead of at the end of the statement only.
Bugfixes:
- SMTChecker: Fix error in events with indices of type static array.
- SMTChecker: Fix internal error in sequential storage array pushes (
push().push()
). - SMTChecker: Fix internal error when using bitwise operators on fixed bytes type.
- SMTChecker: Fix internal error when using compound bitwise operator assignments on array indices inside branches.
- Type Checker: Fix internal compiler error related to oversized types.
- Type Checker: Fix overload resolution in combination with
{value: ...}
.
Build System
- Update internal dependency of jsoncpp to 1.9.3.
We especially thank all the contributors that made this release possible:
a3d4, Alex Beregszaszi, Alexander Arlt, Bhargava Shastry, Daniel Kirchner, Djordje Mijovic, Kamil Śliwak, Leonardo Alt, Mathias Baumann, Sachin Grover, Tiny熊,
If you want to perform a source build, please only use solidity_0.6.12.tar.gz and not the zip provided by github directly.
Version 0.6.11
This release adds inheritance to NatSpec comments, improves debugging data output and fixes some minor issues with opening up calldata
for non-external functions.
Language Features:
- General: Add unit denomination
gwei
- Yul: Support
linkersymbol
builtin in standalone assembly mode to refer to library addresses. - Yul: Support using string literals exceeding 32 bytes as literal arguments for builtins.
Compiler Features:
- NatSpec: Add fields
kind
andversion
to the JSON output. - NatSpec: Inherit tags from unique base functions if derived function does not provide any.
- Commandline Interface: Prevent some incompatible commandline options from being used together.
- NatSpec: Support NatSpec comments on events.
- Yul Optimizer: Store knowledge about storage / memory after
a := sload(x)
/a := mload(x)
. - SMTChecker: Support external calls to unknown code.
- Source Maps: Also tag jumps into and out of Yul functions as jumps into and out of functions.
Bugfixes:
- NatSpec: Do not consider
////
and/***
as NatSpec comments. - Type Checker: Disallow constructor parameters with
calldata
data location. - Type Checker: Do not disallow assigning to calldata variables.
- Type Checker: Fix internal error related to
using for
applied to non-libraries. - Wasm backend: Fix code generation for for-loops with pre statements.
- Wasm backend: Properly support both
i32.drop
andi64.drop
, and removedrop
. - Yul: Disallow the same variable to occur multiple times on the left-hand side of an assignment.
- Yul: Fix source location of variable multi-assignment.
We especially thank all the contributors that made this release possible:
a3d4, Alex Beregszaszi, Alexander Arlt, Bhargava Shastry, Daniel Kirchner, Djordje Mijovic, Harikrishnan Mulackal, Kamil Śliwak, Leonardo Alt, Mathias Baumann, step21
If you want to perform a source build, please only use solidity_0.6.11.tar.gz and not the zip provided by github directly.
Version 0.6.10
Solidity 0.6.10 is a bugfix release that fixes a bug introduced in 0.6.9 related to library functions with calldata parameters that are called via using for
. For more details on the bug, pleas see the blog post.
In addition to that, the compiler now generates error codes that could be useful for IDEs or automated analysis tools.
Important Bugfixes:
- Fixed a bug related to internal library functions with
calldata
parameters called viausing for
.
Compiler Features:
- Commandline Interface: Re-group help screen.
- Output compilation error codes in standard-json and when using
--error-codes
. - Yul: Raise warning for switch statements that only have a default and no other cases.
Bugfixes:
- SMTChecker: Fix internal error when encoding tuples of tuples.
- SMTChecker: Fix aliasing soundness after pushing to an array pointer.
- Type system: Fix internal compiler error on calling externally a function that returns variables with calldata location.
- Type system: Fix bug where a bound function was not found if
using for
is applied to explicit reference types.
We especially thank all the contributors that made this release possible:
a3d4, Daniel Kirchner, Djordje Mijovic, ethers, Harikrishnan Mulackal, Igor Line, Kamil Śliwak, Leonardo Alt, Leonardo, Paul Razvan Berg, TrentZ
If you want to perform a source build, please only use solidity_0.6.10.tar.gz and not the zip provided by github directly.
Version 0.6.9
This is the first release of Solidity where the solc-js / soljson binary includes the Z3 SMT solver built-in. This means you can use pragma experimental SMTChecker;
even without a local install of z3. Note that this causes an increase in the binary size.
On the language side, the calldata
data location for variables and parameters is now allowed everywhere, even in internal functions.
To enhance developer experience, the option --base-path
allows you to specify a root path of your contract directory structure to help with imports.
Language Features:
- Permit calldata location for all variables.
- NatSpec: Support NatSpec comments on state variables.
- Yul: EVM instruction
pc()
is marked deprecated and will be removed in the next breaking release.
Compiler Features:
- Build system: Update the soljson.js build to emscripten 1.39.15 and boost 1.73.0 and include Z3 for integrated SMTChecker support without the callback mechanism.
- Build system: Switch the emscripten build from the fastcomp backend to the upstream backend.
- Code Generator: Do not introduce new internal source references for small compiler routines.
- Commandline Interface: Adds new option
--base-path PATH
to use the given path as the root of the source tree (defaults to the root of the filesystem). - SMTChecker: Support array
length
. - SMTChecker: Support array
push
andpop
. - SMTChecker: General support to BitVectors and the bitwise
and
operator.
Bugfixes:
- Code Generator: Trigger proper unimplemented errors on certain array copy operations.
- Commandline Interface: Fix internal error when using
--assemble
or--yul
options with--machine ewasm
but without specifying--yul-dialect
. - NatSpec: DocString block is terminated when encountering an empty line.
- Optimizer: Fixed a bug in BlockDeDuplicator.
- Scanner: Fix bug when two empty NatSpec comments lead to scanning past EOL.
- SMTChecker: Fix internal error on try/catch clauses with parameters.
- SMTChecker: Fix internal error when applying arithmetic operators to fixed point variables.
- SMTChecker: Fix internal error when assigning to index access inside branches.
- SMTChecker: Fix internal error when short circuiting Boolean expressions with function calls in state variable initialization.
- Type Checker: Disallow assignments to storage variables of type
mapping
. - Type Checker: Disallow inline arrays of non-nameable types.
- Type Checker: Disallow usage of override with non-public state variables.
- Type Checker: Fix internal compiler error when accessing members of array slices.
- Type Checker: Fix internal compiler error when forward referencing non-literal constants from inline assembly.
- Type Checker: Fix internal compiler error when trying to decode too large static arrays.
- Type Checker: Fix wrong compiler error when referencing an overridden function without calling it.
We especially thank all the contributors that made this release possible:
a3d4, Alex Beregszaszi, Alexander Arlt, Bhargava Shastry, Christian Parpart, Daniel Kirchner, Djordje Mijovic, Erik Kundt, Flash Sheridan, Harikrishnan Mulackal, Jason Cobb, Juan Franco, Kamil Śliwak, Leonardo Alt, Mathias Baumann, ssi91, William Entriken
If you want to perform a source build, please only use solidity_0.6.9.tar.gz and not the zip provided by github directly.
Version 0.6.8
This release of Solidity fixes three important bugs in the code generator:
- a missing callvalue check for constructors
- a bug connected with array slices for arrays containing dynamic types
- literal strings containing backslash characters in connection with ABIEncoderV2
In addition to that:
- we introduced a recommendation to use SPDX license identifiers for all source files which are also stored in the contract metadata
- it is possible to access the min and max values of an integer type directly
- WebAssembly support has been extended
Important Bugfixes:
- Add missing callvalue check to the creation code of a contract that does not define a constructor but has a base that does define a constructor.
- Disallow array slices of arrays with dynamically encoded base types.
- String literals containing backslash characters can no longer cause incorrect code to be generated when passed directly to function calls or encoding functions when ABIEncoderV2 is active.
Language Features:
- Implemented
type(T).min
andtype(T).max
for every integer typeT
that returns the smallest and largest value representable by the type.
Compiler Features:
- Commandline Interface: Don't ignore
--yul-optimizations
in assembly mode. - Allow using abi encoding functions for calldata array slices without explicit casts.
- Wasm binary output: Implement
br
andbr_if
.
Bugfixes:
- ABI: Skip
private
orinternal
constructors. - Fixed an "Assembly Exception in Bytecode" error where requested functions were generated twice.
- Natspec: Fixed a bug that ignored
@return
tag when no other developer-documentation tags were present. - Type Checker: Checks if a literal exponent in the
**
operation is too large or fractional. - Type Checker: Disallow accessing
runtimeCode
for contract types that contain immutable state variables. - Yul Assembler: Fix source location of variable declarations without value.
We especially thank all the contributors that made this release possible:
a3d4, Alex Beregszaszi, Alexander Arlt, Bhargava Shastry, Christian Parpart, Daniel Kirchner, Djordje Mijovic, Harikrishnan Mulackal, Kamil Śliwak, Mathias Baumann
If you want to perform a source build, please only use solidity_0.6.8.tar.gz and not the zip provided by github directly.
Version 0.6.7
Solidity version 0.6.7 introduces support for EIP-165 via type(InterfaceName).interfaceId
.
Language Features:
- Add support for EIP 165 interface identifiers with
type(I).interfaceId
. - Allow virtual modifiers inside abstract contracts to have empty body.
Compiler Features:
- Optimizer: Simplify repeated AND and OR operations.
- Option to specify optimization steps to be performed by Yul optimizer with
--yul-optimizations
in the commandline interface oroptimizer.details.yulDetails.optimizerSteps
in standard-json. - Standard Json Input: Support the prefix
file://
in the fieldurls
.
Bugfixes:
- SMTChecker: Fix internal error when fixed points are used.
- SMTChecker: Fix internal error when using array slices.
- Type Checker: Disallow
virtual
andoverride
for constructors. - Type Checker: Fix several internal errors by performing size and recursiveness checks of types before the full type checking.
- Type Checker: Fix internal error when assigning to empty tuples.
- Type Checker: Fix internal error when applying unary operators to tuples with empty components.
- Type Checker: Perform recursiveness check on structs declared at the file level.
Build System:
- soltest.sh:
SOLIDITY_BUILD_DIR
is no longer relative toREPO_ROOT
to allow for build directories outside of the source tree.
We especially thank all the contributors that made this release possible:
a3d4, Alex Beregszaszi, Alexander Arlt, Bhargava Shastry, Chris Chinchilla, Christian Parpart, Daniel Kirchner, David Cian, Djordje Mijovic, Evan Saulpaugh, hrkrshnn, iamdefinitelyahuman, Jason Cobb, KaiYu Feng, Kamil Śliwak, Leonardo Alt, Mathias Baumann, Noel Maersk, ssi91, yoni206
If you want to perform a source build, please only use solidity_0.6.7.tar.gz and not the zip provided by github directly.