Skip to content

Commit 9e61f92

Browse files
authored
Merge pull request #9536 from ethereum/develop
Merge develop into release for 0.7.0
2 parents 27d5176 + 52eeeac commit 9e61f92

File tree

1,066 files changed

+5901
-4119
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,066 files changed

+5901
-4119
lines changed

Diff for: .circleci/config.yml

+10-4
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,20 @@ version: 2.1
99
parameters:
1010
ubuntu-1804-docker-image:
1111
type: string
12-
default: "solbuildpackpusher/solidity-buildpack-deps@sha256:4484ac3da8fdc337cc77a7a7be1af71cd0f28f9c890d934f1d6ae7532beb66b1"
12+
# solbuildpackpusher/solidity-buildpack-deps:ubuntu1804-2
13+
default: "solbuildpackpusher/solidity-buildpack-deps@sha256:9ab317e583c395e50884ba82e9f99811c374344cea4c550725be8ec836e07acc"
1314
ubuntu-2004-docker-image:
1415
type: string
15-
default: "solbuildpackpusher/solidity-buildpack-deps@sha256:48b5bb6b91ac7dddfe9345c88876ebed126c652258800f114caed69db73b29bf"
16+
# solbuildpackpusher/solidity-buildpack-deps:ubuntu2004-2
17+
default: "solbuildpackpusher/solidity-buildpack-deps@sha256:cbfa42d8ecbe94391ba8837e218869242666de7a0da6ccac065a856c85b6a6a0"
1618
ubuntu-2004-clang-docker-image:
1719
type: string
18-
default: "solbuildpackpusher/solidity-buildpack-deps@sha256:d8775de58167db5a11690fdb6ef639317fe1e579ec5d46e9732d2d903b55d135"
20+
# solbuildpackpusher/solidity-buildpack-deps:ubuntu2004.clang-2
21+
default: "solbuildpackpusher/solidity-buildpack-deps@sha256:7a4d5271b5552139d9f2caefc50d42f401bf74132cf8f253e199e11c80ab42de"
1922
ubuntu-1604-clang-ossfuzz-docker-image:
2023
type: string
21-
default: "solbuildpackpusher/solidity-buildpack-deps@sha256:db52f3257396814215744a19904e42c07e040ab36b68be72a27ba71ad2f1083c"
24+
# solbuildpackpusher/solidity-buildpack-deps:ubuntu1604.clang.ossfuzz-2
25+
default: "solbuildpackpusher/solidity-buildpack-deps@sha256:efaabb3c143f64171be596932c62013bcfd7f73b1fbcb832025a34dd2b6e6922"
2226
emscripten-docker-image:
2327
type: string
2428
default: "solbuildpackpusher/solidity-buildpack-deps@sha256:d557d015918c3cf68b0d22839bab41013f0757b651a7fef21595f89721dbebcc"
@@ -385,11 +389,13 @@ jobs:
385389
- run: *run_docs_pragma_min_version
386390

387391
b_ubu_clang: &build_ubuntu2004_clang
392+
resource_class: xlarge
388393
docker:
389394
- image: << pipeline.parameters.ubuntu-2004-clang-docker-image >>
390395
environment:
391396
CC: clang
392397
CXX: clang++
398+
MAKEFLAGS: -j 10
393399
steps:
394400
- checkout
395401
- run: *run_build

Diff for: CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ include(EthPolicy)
1010
eth_policy()
1111

1212
# project name and version should be set after cmake_policy CMP0048
13-
set(PROJECT_VERSION "0.6.12")
13+
set(PROJECT_VERSION "0.7.0")
1414
# OSX target needed in order to support std::visit
1515
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14")
1616
project(solidity VERSION ${PROJECT_VERSION} LANGUAGES C CXX)

Diff for: Changelog.md

+47
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,49 @@
1+
### 0.7.0 (2020-07-28)
2+
3+
Breaking changes:
4+
* Inline Assembly: Disallow ``.`` in user-defined function and variable names.
5+
* Inline Assembly: Slot and offset of storage pointer variable ``x`` are accessed via ``x.slot`` and ``x.offset`` instead of ``x_slot`` and ``x_offset``.
6+
* JSON AST: Mark hex string literals with ``kind: "hexString"``.
7+
* JSON AST: Remove members with ``null`` value from JSON output.
8+
* Parser: Disallow ``gwei`` as identifier.
9+
* Parser: Disallow dot syntax for ``value`` and ``gas``.
10+
* Parser: Disallow non-printable characters in string literals.
11+
* Parser: Introduce Unicode string literals: ``unicode"😃"``.
12+
* Parser: NatSpec comments on variables are only allowed for public state variables.
13+
* Parser: Remove the ``finney`` and ``szabo`` denominations.
14+
* Parser: Remove the identifier ``now`` (replaced by ``block.timestamp``).
15+
* Reference Resolver: ``using A for B`` only affects the contract it is mentioned in and not all derived contracts
16+
* Type Checker: Disallow ``virtual`` for library functions.
17+
* Type Checker: Disallow assignments to state variables that contain nested mappings.
18+
* Type checker: Disallow events with same name and parameter types in inheritance hierarchy.
19+
* Type Checker: Disallow shifts by signed types.
20+
* Type Checker: Disallow structs and arrays in memory or calldata if they contain nested mappings.
21+
* Type Checker: Exponentiation and shifts of literals by non-literals will always use ``uint256`` or ``int256`` as a type.
22+
* Yul: Disallow consecutive and trailing dots in identifiers. Leading dots were already disallowed.
23+
* Yul: Disallow EVM instruction `pc()`.
24+
25+
26+
Language Features:
27+
* Inheritance: Allow overrides to have stricter state mutability: ``view`` can override ``nonpayable`` and ``pure`` can override ``view``.
28+
* Parser: Deprecate visibility for constructors.
29+
* State mutability: Do not issue recommendation for stricter mutability for virtual functions but do issue it for functions that override.
30+
31+
32+
Compiler Features:
33+
* 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.
34+
* Variable declarations using the ``var`` keyword are not recognized anymore.
35+
36+
37+
Bugfixes:
38+
* Immutables: Fix internal compiler error when immutables are not assigned.
39+
* Inheritance: Disallow public state variables overwriting ``pure`` functions.
40+
* NatSpec: Constructors and functions have consistent userdoc output.
41+
* SMTChecker: Fix internal error when assigning to a 1-tuple.
42+
* SMTChecker: Fix internal error when tuples have extra effectless parenthesis.
43+
* State Mutability: Constant public state variables are considered ``pure`` functions.
44+
* Type Checker: Fixing deduction issues on function types when function call has named arguments.
45+
46+
147
### 0.6.12 (2020-07-22)
248

349
Language Features:
@@ -29,6 +75,7 @@ Build System:
2975

3076
### 0.6.11 (2020-07-07)
3177

78+
3279
Language Features:
3380
* General: Add unit denomination ``gwei``
3481
* Yul: Support ``linkersymbol`` builtin in standalone assembly mode to refer to library addresses.

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ found in the [Solidity documentation](https://solidity.readthedocs.io/en/latest/
3737
A "Hello World" program in Solidity is of even less use than in other languages, but still:
3838

3939
```solidity
40-
pragma solidity ^0.6.0;
40+
pragma solidity >=0.6.0 <0.8.0;
4141
4242
contract HelloWorld {
4343
function helloWorld() external pure returns (string memory) {

Diff for: ReleaseChecklist.md

+16-4
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,26 @@
2626
- [ ] Run ``scripts/create_source_tarball.sh`` while being on the tag to create the source tarball. Make sure to create ``prerelease.txt`` before: (``echo -n > prerelease.txt``). This will create the tarball in a directory called ``upload``.
2727
- [ ] Take the tarball from the upload directory (its name should be ``solidity_x.x.x.tar.gz``, otherwise ``prerelease.txt`` was missing in the step before) and upload the source tarball to the release page.
2828

29+
### Homebrew and MacOS
30+
- [ ] Update the version and the hash (``sha256sum solidity_x.x.x.tar.gz``) in https://github.com/ethereum/homebrew-ethereum/blob/master/solidity.rb
31+
- [ ] Take the binary from the ``b_osx`` run of the released commit in circle-ci and add it to the release page as ``solc-macos``.
32+
33+
### Update solc-bin
34+
- [ ] Copy ``soljson.js`` from the release page to ``solc-bin/bin/soljson-v<version>+commit.<commit>.js``
35+
- [ ] Copy ``solc-static-linux`` from the release page to ``solc-bin/linux-amd64/solc-linux-amd64-v<version>+commit.<commit>``
36+
- [ ] Copy ``solc-macos`` from the release page to ``solc-bin/macos-amd64/solc-macos-amd64-v<version>+commit.<commit>``
37+
- [ ] Copy ``solc-windows.zip`` from the release page to ``solc-bin/windows-amd64/solc-windows-amd64-v<version>+commit.<commit>.zip``
38+
- [ ] Make the linux and the macos binaries executable.
39+
- [ ] Run ``./update`` in ``solc-bin`` and verify that the script has updated ``list.js``, ``list.txt`` and ``list.json`` files correctly and that symlinks to the new release have been added in ``solc-bin/wasm/`` and ``solc-bin/emscripten-wasm32/``.
40+
- [ ] Create a pull request and merge.
41+
2942
### PPA
3043
- [ ] Change ``scripts/release_ppa.sh`` to match your key's email and key id.
3144
- [ ] Run ``scripts/release_ppa.sh release`` to create the PPA release (you need the relevant openssl key).
3245
- [ ] Wait for the ``~ethereum/ubuntu/ethereum-static`` PPA build to be finished and published for *all platforms*. SERIOUSLY: DO NOT PROCEED EARLIER!!! *After* the static builds are *published*, copy the static package to the ``~ethereum/ubuntu/ethereum`` PPA for the destination series ``Trusty`` and ``Xenial`` while selecting ``Copy existing binaries``.
33-
- [ ] Check that the Docker release was pushed to Docker Hub (this still seems to have problems, run ``./scripts/docker_deploy_manual.sh v0.x.x``).
3446

35-
### Homebrew and MacOS
36-
- [ ] Update the version and the hash (``sha256sum solidity_x.x.x.tar.gz``) in https://github.com/ethereum/homebrew-ethereum/blob/master/solidity.rb
37-
- [ ] Take the binary from the ``b_osx`` run of the released commit in circle-ci and add it to the release page as ``solc-macos``.
47+
### Docker
48+
- [ ] Check that the Docker release was pushed to Docker Hub (this still seems to have problems, run ``./scripts/docker_deploy_manual.sh v0.x.x``).
3849

3950
### Documentation
4051
- [ ] Build the new version on https://readthedocs.org/projects/solidity/ (select `latest` on the bottom of the page and click `BUILD`)
@@ -46,6 +57,7 @@
4657
- [ ] Make sure to push the tag ``npm publish`` created with ``git push --tags``.
4758

4859
### Post-release
60+
- [ ] Publish the blog post.
4961
- [ ] Create a commit to increase the version number on ``develop`` in ``CMakeLists.txt`` and add a new skeleton changelog entry.
5062
- [ ] Merge ``release`` back into ``develop``.
5163
- [ ] Announce on Twitter and Reddit.

Diff for: docs/050-breaking-changes.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ This will no longer compile with Solidity v0.5.0. However, you can define a comp
311311
::
312312

313313
// SPDX-License-Identifier: GPL-3.0
314-
pragma solidity >=0.5.0 <0.7.0;
314+
pragma solidity >=0.5.0 <0.8.0;
315315
interface OldContract {
316316
function someOldFunction(uint8 a) external;
317317
function anotherOldFunction() external returns (bool);
@@ -329,7 +329,7 @@ Given the interface defined above, you can now easily use the already deployed p
329329
::
330330

331331
// SPDX-License-Identifier: GPL-3.0
332-
pragma solidity >=0.5.0 <0.7.0;
332+
pragma solidity >=0.5.0 <0.8.0;
333333

334334
interface OldContract {
335335
function someOldFunction(uint8 a) external;

Diff for: docs/070-breaking-changes.rst

+133
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
********************************
2+
Solidity v0.7.0 Breaking Changes
3+
********************************
4+
5+
This section highlights the main breaking changes introduced in Solidity
6+
version 0.7.0, along with the reasoning behind the changes and how to update
7+
affected code.
8+
For the full list check
9+
`the release changelog <https://github.com/ethereum/solidity/releases/tag/v0.7.0>`_.
10+
11+
12+
Silent Changes of the Semantics
13+
===============================
14+
15+
* Exponentiation and shifts of literals by non-literals (e.g. ``1 << x`` or ``2 ** x``)
16+
will always use either the type ``uint256`` (for non-negative literals) or
17+
``int256`` (for negative literals) to perform the operation.
18+
Previously, the operation was performed in the type of the shift amount / the
19+
exponent which can be misleading.
20+
21+
22+
Changes to the Syntax
23+
=====================
24+
25+
* In external function and contract creation calls, Ether and gas is now specified using a new syntax:
26+
``x.f{gas: 10000, value: 2 ether}(arg1, arg2)``.
27+
The old syntax -- ``x.f.gas(10000).value(2 ether)(arg1, arg2)`` -- will cause an error.
28+
29+
* The global variable ``now`` is deprecated, ``block.timestamp`` should be used instead.
30+
The single identifier ``now`` is too generic for a global variable and could give the impression
31+
that it changes during transaction processing, whereas ``block.timestamp`` correctly
32+
reflects the fact that it is just a property of the block.
33+
34+
* NatSpec comments on variables are only allowed for public state variables and not
35+
for local or internal variables.
36+
37+
* The token ``gwei`` is a keyword now (used to specify, e.g. ``2 gwei`` as a number)
38+
and cannot be used as an identifier.
39+
40+
* String literals now can only contain printable ASCII characters and this also includes a variety of
41+
escape sequences, such as hexadecimal (``\xff``) and unicode escapes (``\u20ac``).
42+
43+
* Unicode string literals are supported now to accommodate valid UTF-8 sequences. They are identified
44+
with the ``unicode`` prefix: ``unicode"Hello 😃"``.
45+
46+
* State Mutability: The state mutability of functions can now be restricted during inheritance:
47+
Functions with default state mutability can be overridden by ``pure`` and ``view`` functions
48+
while ``view`` functions can be overridden by ``pure`` functions.
49+
At the same time, public state variables are considered ``view`` and even ``pure``
50+
if they are constants.
51+
52+
53+
54+
Inline Assembly
55+
---------------
56+
57+
* Disallow ``.`` in user-defined function and variable names in inline assembly.
58+
It is still valid if you use Solidity in Yul-only mode.
59+
60+
* Slot and offset of storage pointer variable ``x`` are accessed via ``x.slot``
61+
and ``x.offset`` instead of ``x_slot`` and ``x_offset``.
62+
63+
Removal of Unused or Unsafe Features
64+
====================================
65+
66+
Mappings outside Storage
67+
------------------------
68+
69+
* If a struct or array contains a mapping, it can only be used in storage.
70+
Previously, mapping members were silently skipped in memory, which
71+
is confusing and error-prone.
72+
73+
* Assignments to structs or arrays in storage does not work if they contain
74+
mappings.
75+
Previously, mappings were silently skipped during the copy operation, which
76+
is misleading and error-prone.
77+
78+
Functions and Events
79+
--------------------
80+
81+
* Visibility (``public`` / ``external``) is not needed for constructors anymore:
82+
To prevent a contract from being created, it can be marked ``abstract``.
83+
This makes the visibility concept for constructors obsolete.
84+
85+
* Type Checker: Disallow ``virtual`` for library functions:
86+
Since libraries cannot be inherited from, library functions should not be virtual.
87+
88+
* Multiple events with the same name and parameter types in the same
89+
inheritance hierarchy are disallowed.
90+
91+
* ``using A for B`` only affects the contract it is mentioned in.
92+
Previously, the effect was inherited. Now, you have to repeat the ``using``
93+
statement in all derived contracts that make use of the feature.
94+
95+
Expressions
96+
-----------
97+
98+
* Shifts by signed types are disallowed.
99+
Previously, shifts by negative amounts were allowed, but reverted at runtime.
100+
101+
* The ``finney`` and ``szabo`` denominations are removed.
102+
They are rarely used and do not make the actual amount readily visible. Instead, explicit
103+
values like ``1e20`` or the very common ``gwei`` can be used.
104+
105+
Declarations
106+
------------
107+
108+
* The keyword ``var`` cannot be used anymore.
109+
Previously, this keyword would parse but result in a type error and
110+
a suggestion about which type to use. Now, it results in a parser error.
111+
112+
Interface Changes
113+
=================
114+
115+
* JSON AST: Mark hex string literals with ``kind: "hexString"``.
116+
* JSON AST: Members with value ``null`` are removed from JSON output.
117+
* NatSpec: Constructors and functions have consistent userdoc output.
118+
119+
120+
How to update your code
121+
=======================
122+
123+
This section gives detailed instructions on how to update prior code for every breaking change.
124+
125+
* Change ``x.f.value(...)()`` to ``x.f{value: ...}()``. Similarly ``(new C).value(...)()`` to
126+
``new C{value: ...}()`` and ``x.f.gas(...).value(...)()`` to ``x.f{gas: ..., value: ...}()``.
127+
* Change ``now`` to ``block.timestamp``.
128+
* Change types of right operand in shift operators to unsigned types. For example change ``x >> (256 - y)`` to
129+
``x >> uint(256 - y)``.
130+
* Repeat the ``using A for B`` statements in all derived contracts if needed.
131+
* Remove the ``public`` keyword from every constructor.
132+
* Remove the ``internal`` keyword from every constructor and add ``abstract`` to the contract (if not already present).
133+
* Change ``_slot`` and ``_offset`` suffixes in inline assembly to ``.slot`` and ``.offset``, respectively.

Diff for: docs/Solidity.g4

+19-5
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ primaryExpression
253253
| numberLiteral
254254
| hexLiteral
255255
| stringLiteral
256+
| unicodeStringLiteral
256257
| identifier ('[' ']')?
257258
| TypeKeyword
258259
| tupleExpression
@@ -306,7 +307,7 @@ assemblyBlock
306307
: '{' assemblyItem* '}' ;
307308

308309
assemblyExpression
309-
: assemblyCall | assemblyLiteral ;
310+
: assemblyCall | assemblyLiteral | assemblyIdentifier ;
310311

311312
assemblyCall
312313
: ( 'return' | 'address' | 'byte' | identifier ) ( '(' assemblyExpression? ( ',' assemblyExpression )* ')' )? ;
@@ -318,7 +319,10 @@ assemblyAssignment
318319
: assemblyIdentifierList ':=' assemblyExpression ;
319320

320321
assemblyIdentifierList
321-
: identifier ( ',' identifier )* ;
322+
: assemblyIdentifier ( ',' assemblyIdentifier )* ;
323+
324+
assemblyIdentifier
325+
: identifier ( '.' identifier )* ;
322326

323327
assemblyStackAssignment
324328
: '=:' identifier ;
@@ -358,11 +362,12 @@ assemblyType
358362
subAssembly
359363
: 'assembly' identifier assemblyBlock ;
360364

365+
// 'finney' and 'szabo' are no longer supported as denominations by latest Solidity.
361366
numberLiteral
362-
: (DecimalNumber | HexNumber) (NumberUnit | Gwei)?;
367+
: (DecimalNumber | HexNumber) (NumberUnit | Gwei | Finney | Szabo)?;
363368

364369
identifier
365-
: (Gwei | 'from' | 'calldata' | 'address' | Identifier) ;
370+
: (Gwei | Finney | Szabo | 'from' | 'calldata' | 'address' | Identifier) ;
366371

367372
BooleanLiteral
368373
: 'true' | 'false' ;
@@ -382,10 +387,12 @@ HexDigits
382387
: HexCharacter ( '_'? HexCharacter )* ;
383388

384389
NumberUnit
385-
: 'wei' | 'szabo' | 'finney' | 'ether'
390+
: 'wei' | 'ether'
386391
| 'seconds' | 'minutes' | 'hours' | 'days' | 'weeks' | 'years' ;
387392

388393
Gwei: 'gwei' ;
394+
Szabo: 'szabo' ;
395+
Finney: 'finney' ;
389396

390397
HexLiteralFragment
391398
: 'hex' (('"' HexDigits? '"') | ('\'' HexDigits? '\'')) ;
@@ -455,6 +462,13 @@ StringLiteralFragment
455462
: '"' DoubleQuotedStringCharacter* '"'
456463
| '\'' SingleQuotedStringCharacter* '\'' ;
457464

465+
unicodeStringLiteral
466+
: UnicodeStringLiteralFragment+ ;
467+
468+
UnicodeStringLiteralFragment
469+
: 'unicode"' DoubleQuotedStringCharacter* '"'
470+
| 'unicode\'' SingleQuotedStringCharacter* '\'' ;
471+
458472
fragment
459473
DoubleQuotedStringCharacter
460474
: ~["\r\n\\] | ('\\' .) ;

0 commit comments

Comments
 (0)