Releases: ethereum/solidity
Version 0.7.5
This version of Solidity adds a new way to select which ABI coder to use in preparation for making ABI coder v2 the default for 0.8.0. Another notable feature is the option to compile via the new experimental Yul-based compiler pipeline.
Language Features
- Ability to select the abi coder using
pragma abicoder v1
andpragma abicoder v2
. - Inline Assembly: Use
.offset
and.length
for calldata variables of dynamic array type to access their calldata offset and length (number of elements). Both of them can also be assigned to. - Immutable variables with literal number values are considered pure.
Compiler Features
- Assembler: Perform linking in assembly mode when library addresses are provided.
- Command Line Interface: New option
--experimental-via-ir
allows switching compilation process to go through the Yul intermediate representation. This is highly experimental and is used for development purposes. - Command Line Interface: New option
--model-checker-timeout
sets a timeout in milliseconds for each individual query performed by the SMTChecker. - Command Line Interface: Report error if file could not be read in
--standard-json
mode. - Command Line interface: Report proper error for each output file which could not be written. Previously an exception was thrown, and execution aborted, on the first error.
- SMTChecker: Add division by zero checks in the CHC engine.
- SMTChecker: More precise analysis of external calls using
this
. - SMTChecker: Support
selector
for expressions with value known at compile-time. - Standard JSON: New option
modelCheckerSettings.timeout
sets a timeout in milliseconds for each individual query performed by the SMTChecker. - Standard JSON: New option
settings.viaIR
allows the same switch as--experimental-via-ir
on the commandline.
Bugfixes
- Code generator: Fix missing creation dependency tracking for abstract contracts.
- Command Line Interface: Fix write error when the directory passed to
--output-dir
ends with a slash. - Command Line Interface: Reject duplicate libraries in
--libraries
option instead of arbitrarily choosing one. - NatSpec: Fix internal error when inheriting return parameter documentation but the parameter names differ between base and inherited.
- SMTChecker: Fix CHC false positives when branches are used inside modifiers.
- SMTChecker: Fix false negative in modifier applied multiple times.
- SMTChecker: Fix incorrect counterexamples reported by the CHC engine.
- SMTChecker: Fix internal error in the BMC engine when inherited contract from a different source unit has private state variables.
- SMTChecker: Fix internal error on conversion from string literal to byte.
- SMTChecker: Fix internal error when
array.push()
is used as the LHS of an assignment. - SMTChecker: Fix internal error when assigning state variable via contract's name.
- SMTChecker: Fix internal error when using tuples of rational literals inside the conditional operator.
- SMTChecker: Fix lack of reporting potential violations when using only the CHC engine.
- Standard JSON: Fix library addresses specified in
libraries
being used for linking even if the file names do not match.
AST Changes
- New member
suffix
for inline assembly identifiers. Currently supported values are"slot"
,"offset"
and"length"
to access the components of a Solidity variable.
We especially thank all the contributors that made this release possible:
Alex Beregszaszi, Kamil Śliwak, Leonardo Alt, Christian Parpart, Martin Blicha, Đorđe Mijović, Harikrishnan Mulackal, Alexander Arlt, Mathias Baumann, DELL, Eric Bouchut, RishiGondkar, a3d4, cakesoft-khushi
If you want to perform a source build, please only use solidity_0.7.5.tar.gz and not the zip provided by github directly.
Preview of 0.8.x
This is a preview release of the Solidity 0.8.x series.
Read more about it in the blog post.
Version 0.7.4
Solidity v0.7.4 fixes a storage corruption bug of medium severity that occurs when copying empty byte arrays to storage.
To learn more about the bug and to check if your contract is vulnerable please read this post with further details about the bug.
We thank John Toman of the Certora development team for finding and reporting the bug.
In addition to the bug fix, this release contains many small fixes and allows you to define constants at file-level. More details can be found in the release announcement.
Important Bugfixes
- Code Generator: Fix data corruption bug when copying empty byte arrays from memory or calldata to storage.
Language Features
- Constants can be defined at file level.
Compiler Features
- Command Line Interface: New option
--model-checker-engine
allows to choose a specific SMTChecker engine. Options areall
(default),bmc
,chc
andnone
. - Control Flow Graph: Print warning for non-empty functions with unnamed return parameters that are not assigned a value in all code paths.
- SMTChecker: Support
keccak256
,sha256
,ripemd160
andecrecover
in the CHC engine. - SMTChecker: Support inline arrays.
- SMTChecker: Support variables
block
,msg
andtx
in the CHC engine. - Standard JSON: New option
modelCheckerSettings.engine
allows to choose a specific SMTChecker engine. Options areall
(default),bmc
,chc
andnone
.
Bugfixes
- Code generator: Fix
ABIEncoderV2
pragma from the current module affecting inherited functions and applied modifiers. - Code generator: Fix internal compiler error when referencing members via module name but not using the reference.
- Code generator: Fix internal error on returning structs containing mappings from library function.
- Code generator: Use revert instead of invalid opcode for out-of-bounds array index access in getter.
- Contract Level Checker: Add missing check against inheriting functions with ABIEncoderV2 return types in ABIEncoderV1 contracts.
- Name Resolver: Fix shadowing/same-name warnings for later declarations.
- Type Checker: Allow arrays of contract types as type expressions and as arguments for
abi.decode
. - Type Checker: Disallow invalid use of library names as type name.
- Type Checker: Fix internal compiler error caused by storage parameters with nested mappings in libraries.
We especially thank all the contributors that made this release possible:
a3d4, Bhargava Shastry, Christian Parpart, Daniel Kirchner, Đorđe Mijović, franzihei, Harikrishnan Mulackal, Kamil Śliwak, Leonardo Alt, Martin Blicha, Mathias Baumann, Ronald Eddy Jr
If you want to perform a source build, please only use solidity_0.7.4.tar.gz and not the zip provided by github directly.
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.