Skip to content

Commit 5ef660b

Browse files
authored
Merge pull request #9339 from ethereum/develop
Merge develop into release for 0.6.11.
2 parents 00c0fca + c16d7d0 commit 5ef660b

File tree

2,036 files changed

+7964
-5082
lines changed

Some content is hidden

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

2,036 files changed

+7964
-5082
lines changed

Diff for: .circleci/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ jobs:
323323
- checkout
324324
- run:
325325
name: Check for error codes
326-
command: ./scripts/fix_error_ids.py --check-only
326+
command: ./scripts/error_codes.py --check
327327

328328
chk_pylint:
329329
docker:

Diff for: .travis.yml

+7-5
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ env:
4040
- ENCRYPTION_LABEL="6d4541b72666"
4141
- SOLC_BUILD_TYPE=RelWithDebInfo
4242
- SOLC_EMSCRIPTEN=Off
43+
# FIXME: Pushing solcjson.js to solc-bin disabled until we fix the cause of #9261
44+
- SOLC_PUBLISH_EMSCRIPTEN=Off
4345
- SOLC_INSTALL_DEPS_TRAVIS=On
4446
- SOLC_RELEASE=On
4547
- SOLC_TESTS=On
@@ -104,13 +106,13 @@ matrix:
104106
sudo: required
105107
compiler: gcc
106108
node_js:
107-
- "8"
109+
- "10"
108110
services:
109111
- docker
110112
before_install:
111-
- nvm install 8
112-
- nvm use 8
113-
- docker pull ethereum/solidity-buildpack-deps:emsdk-1.39.15-1
113+
- nvm install 10
114+
- nvm use 10
115+
- docker pull ethereum/solidity-buildpack-deps:emsdk-1.39.15-2
114116
env:
115117
- SOLC_EMSCRIPTEN=On
116118
- SOLC_INSTALL_DEPS_TRAVIS=Off
@@ -213,7 +215,7 @@ deploy:
213215
# scripts because TravisCI doesn't provide much in the way of conditional logic.
214216

215217
- provider: script
216-
script: test $SOLC_EMSCRIPTEN != On || (scripts/release_emscripten.sh)
218+
script: test $SOLC_PUBLISH_EMSCRIPTEN != On || $SOLC_EMSCRIPTEN != On || (scripts/release_emscripten.sh)
217219
skip_cleanup: true
218220
on:
219221
branch:

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.10")
13+
set(PROJECT_VERSION "0.6.11")
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

+29
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,32 @@
1+
### 0.6.11 (2020-07-07)
2+
3+
Language Features:
4+
* General: Add unit denomination ``gwei``
5+
* Yul: Support ``linkersymbol`` builtin in standalone assembly mode to refer to library addresses.
6+
* Yul: Support using string literals exceeding 32 bytes as literal arguments for builtins.
7+
8+
9+
Compiler Features:
10+
* NatSpec: Add fields ``kind`` and ``version`` to the JSON output.
11+
* NatSpec: Inherit tags from unique base functions if derived function does not provide any.
12+
* Commandline Interface: Prevent some incompatible commandline options from being used together.
13+
* NatSpec: Support NatSpec comments on events.
14+
* Yul Optimizer: Store knowledge about storage / memory after ``a := sload(x)`` / ``a := mload(x)``.
15+
* SMTChecker: Support external calls to unknown code.
16+
* Source Maps: Also tag jumps into and out of Yul functions as jumps into and out of functions.
17+
18+
19+
Bugfixes:
20+
* NatSpec: Do not consider ``////`` and ``/***`` as NatSpec comments.
21+
* Type Checker: Disallow constructor parameters with ``calldata`` data location.
22+
* Type Checker: Do not disallow assigning to calldata variables.
23+
* Type Checker: Fix internal error related to ``using for`` applied to non-libraries.
24+
* Wasm backend: Fix code generation for for-loops with pre statements.
25+
* Wasm backend: Properly support both ``i32.drop`` and ``i64.drop``, and remove ``drop``.
26+
* Yul: Disallow the same variable to occur multiple times on the left-hand side of an assignment.
27+
* Yul: Fix source location of variable multi-assignment.
28+
29+
130
### 0.6.10 (2020-06-11)
231

332
Important Bugfixes:

Diff for: docs/Solidity.g4

+5-18
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,11 @@ sourceUnit
1111
: (pragmaDirective | importDirective | structDefinition | enumDefinition | contractDefinition)* EOF ;
1212

1313
pragmaDirective
14-
: 'pragma' pragmaName pragmaValue ';' ;
14+
: 'pragma' pragmaName ( ~';' )* ';' ;
1515

1616
pragmaName
1717
: identifier ;
1818

19-
pragmaValue
20-
: version | expression ;
21-
22-
version
23-
: versionConstraint versionConstraint? ;
24-
25-
versionConstraint
26-
: versionOperator? VersionLiteral ;
27-
28-
versionOperator
29-
: '^' | '~' | '>=' | '>' | '<' | '<=' | '=' ;
30-
3119
importDirective
3220
: 'import' StringLiteralFragment ('as' identifier)? ';'
3321
| 'import' ('*' | identifier) ('as' identifier)? 'from' StringLiteralFragment ';'
@@ -371,10 +359,10 @@ subAssembly
371359
: 'assembly' identifier assemblyBlock ;
372360

373361
numberLiteral
374-
: (DecimalNumber | HexNumber) NumberUnit? ;
362+
: (DecimalNumber | HexNumber) (NumberUnit | Gwei)?;
375363

376364
identifier
377-
: ('from' | 'calldata' | 'address' | Identifier) ;
365+
: (Gwei | 'from' | 'calldata' | 'address' | Identifier) ;
378366

379367
BooleanLiteral
380368
: 'true' | 'false' ;
@@ -397,6 +385,8 @@ NumberUnit
397385
: 'wei' | 'szabo' | 'finney' | 'ether'
398386
| 'seconds' | 'minutes' | 'hours' | 'days' | 'weeks' | 'years' ;
399387

388+
Gwei: 'gwei' ;
389+
400390
HexLiteralFragment
401391
: 'hex' (('"' HexDigits? '"') | ('\'' HexDigits? '\'')) ;
402392

@@ -473,9 +463,6 @@ fragment
473463
SingleQuotedStringCharacter
474464
: ~['\r\n\\] | ('\\' .) ;
475465
476-
VersionLiteral
477-
: [0-9]+ ( '.' [0-9]+ ('.' [0-9]+)? )? ;
478-
479466
WS
480467
: [ \t\r\n\u000C]+ -> skip ;
481468

Diff for: docs/bugs_by_version.json

+4
Original file line numberDiff line numberDiff line change
@@ -1109,6 +1109,10 @@
11091109
"bugs": [],
11101110
"released": "2020-06-11"
11111111
},
1112+
"0.6.11": {
1113+
"bugs": [],
1114+
"released": "2020-07-07"
1115+
},
11121116
"0.6.2": {
11131117
"bugs": [
11141118
"MissingEscapingInFormatting",

Diff for: docs/installing-solidity.rst

+10
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,16 @@ you should fork Solidity and add your personal fork as a second remote:
314314
315315
git remote add personal [email protected]:[username]/solidity.git
316316
317+
.. note::
318+
This method will result in a prerelease build leading to e.g. a flag
319+
being set in each bytecode produced by such a compiler.
320+
If you want to re-build a released Solidity compiler, then
321+
please use the source tarball on the github release page:
322+
323+
https://github.com/ethereum/solidity/releases/download/v0.X.Y/solidity_0.X.Y.tar.gz
324+
325+
(not the "Source code" provided by github).
326+
317327
Command-Line Build
318328
------------------
319329

Diff for: docs/natspec-format.rst

+9-13
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,6 @@ The following example shows a contract and a function using all available tags.
4242

4343
.. note::
4444

45-
NatSpec currently does NOT apply to public state variables (see
46-
`solidity#3418 <https://github.com/ethereum/solidity/issues/3418>`__),
47-
even if they are declared public and therefore do affect the ABI.
48-
4945
The Solidity compiler only interprets tags if they are external or
5046
public. You are welcome to use similar comments for your internal and
5147
private functions, but those will not be parsed.
@@ -60,7 +56,6 @@ The following example shows a contract and a function using all available tags.
6056
/// @notice You can use this contract for only the most basic simulation
6157
/// @dev All function calls are currently implemented without side effects
6258
contract Tree {
63-
/// @author Mary A. Botanist
6459
/// @notice Calculate tree age in years, rounded up, for live trees
6560
/// @dev The Alexandr N. Tetearing algorithm could increase precision
6661
/// @param rings The number of rings from dendrochronological sample
@@ -84,10 +79,10 @@ in the same way as if it were tagged with ``@notice``.
8479
Tag Context
8580
=========== =============================================================================== =============================
8681
``@title`` A title that should describe the contract/interface contract, interface
87-
``@author`` The name of the author contract, interface, function
88-
``@notice`` Explain to an end user what this does contract, interface, function, public state variable
89-
``@dev`` Explain to a developer any extra details contract, interface, function, state variable
90-
``@param`` Documents a parameter just like in doxygen (must be followed by parameter name) function
82+
``@author`` The name of the author contract, interface
83+
``@notice`` Explain to an end user what this does contract, interface, function, public state variable, event
84+
``@dev`` Explain to a developer any extra details contract, interface, function, state variable, event
85+
``@param`` Documents a parameter just like in doxygen (must be followed by parameter name) function, event
9186
``@return`` Documents the return variables of a contract's function function, public state variable
9287
=========== =============================================================================== =============================
9388

@@ -127,9 +122,11 @@ documentation and you may read more at
127122
Inheritance Notes
128123
-----------------
129124

130-
Currently it is undefined whether a contract with a function having no
131-
NatSpec will inherit the NatSpec of a parent contract/interface for that
132-
same function.
125+
Functions without NatSpec will automatically inherit the documentation of their
126+
base function. Exceptions to this are:
127+
128+
* When the parameter names are different.
129+
* When there is more than one base function.
133130

134131
.. _header-output:
135132

@@ -193,7 +190,6 @@ file should also be produced and should look like this:
193190
{
194191
"age(uint256)" :
195192
{
196-
"author" : "Mary A. Botanist",
197193
"details" : "The Alexandr N. Tetearing algorithm could increase precision",
198194
"params" :
199195
{

Diff for: docs/units-and-global-variables.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ Units and Globally Available Variables
77
Ether Units
88
===========
99

10-
A literal number can take a suffix of ``wei``, ``finney``, ``szabo`` or ``ether`` to specify a subdenomination of Ether, where Ether numbers without a postfix are assumed to be Wei.
10+
A literal number can take a suffix of ``wei``, ``gwei``, ``finney``, ``szabo`` or ``ether`` to specify a subdenomination of Ether, where Ether numbers without a postfix are assumed to be Wei.
1111

1212
::
1313

1414
assert(1 wei == 1);
15+
assert(1 gwei == 1e9);
1516
assert(1 szabo == 1e12);
1617
assert(1 finney == 1e15);
1718
assert(1 ether == 1e18);

Diff for: docs/yul.rst

+36-4
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ The design of Yul tries to achieve several goals:
3030
In order to achieve the first and second goal, Yul provides high-level constructs
3131
like ``for`` loops, ``if`` and ``switch`` statements and function calls. These should
3232
be sufficient for adequately representing the control flow for assembly programs.
33-
Therefore, no explicit statements for ``SWAP``, ``DUP``, ``JUMP`` and ``JUMPI``
33+
Therefore, no explicit statements for ``SWAP``, ``DUP``, ``JUMPDEST``, ``JUMP`` and ``JUMPI``
3434
are provided, because the first two obfuscate the data flow
3535
and the last two obfuscate control flow. Furthermore, functional statements of
3636
the form ``mul(add(x, y), 7)`` are preferred over pure opcode statements like
@@ -180,7 +180,11 @@ appropriate ``PUSHi`` instruction. In the following example,
180180
``3`` and ``2`` are added resulting in 5 and then the
181181
bitwise ``and`` with the string "abc" is computed.
182182
The final value is assigned to a local variable called ``x``.
183+
183184
Strings are stored left-aligned and cannot be longer than 32 bytes.
185+
The limit does not apply to string literals passed to builtin functions that require
186+
literal arguments (e.g. ``setimmutable`` or ``loadimmutable``). Those strings never end up in the
187+
generated bytecode.
184188

185189
.. code-block:: yul
186190
@@ -284,6 +288,8 @@ variables at the same time. For this, the number and types of the
284288
values have to match.
285289
If you want to assign the values returned from a function that has
286290
multiple return parameters, you have to provide multiple variables.
291+
The same variable may not occur multiple times on the left-hand side of
292+
an assignment, e.g. ``x, x := f()`` is invalid.
287293

288294
.. code-block:: yul
289295
@@ -502,6 +508,8 @@ In variable declarations and assignments, the right-hand-side expression
502508
variables on the left-hand-side.
503509
This is the only situation where an expression evaluating
504510
to more than one value is allowed.
511+
The same variable name cannot occur more than once in the left-hand-side of
512+
an assignment or variable declaration.
505513

506514
Expressions that are also statements (i.e. at the block level) have to
507515
evaluate to zero values.
@@ -904,7 +912,7 @@ In some internal dialects, there are additional functions:
904912
datasize, dataoffset, datacopy
905913
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
906914

907-
The functions ``datasize(x)``, ``dataoffset(x)`` and ``datacopy(t, f, l)``,
915+
The functions ``datasize(x)``, ``dataoffset(x)`` and ``datacopy(t, f, l)``
908916
are used to access other parts of a Yul object.
909917

910918
``datasize`` and ``dataoffset`` can only take string literals (the names of other objects)
@@ -916,13 +924,37 @@ setimmutable, loadimmutable
916924
^^^^^^^^^^^^^^^^^^^^^^^^^^^
917925

918926
The functions ``setimmutable("name", value)`` and ``loadimmutable("name")`` are
919-
used for the immutable mechanism in Solidity and do not nicely map to pur Yul.
927+
used for the immutable mechanism in Solidity and do not nicely map to pure Yul.
920928
The function ``setimmutable`` assumes that the runtime code of a contract
921-
is currently copied to memory at offsot zero. The call to ``setimmutable("name", value)``
929+
is currently copied to memory at offset zero. The call to ``setimmutable("name", value)``
922930
will store ``value`` at all points in memory that contain a call to
923931
``loadimmutable("name")``.
924932

925933

934+
linkersymbol
935+
^^^^^^^^^^^^
936+
937+
The function ``linkersymbol("fq_library_name")`` is a placeholder for an address literal to be
938+
substituted by the linker. Its first and only argument must be a string literal and represents the
939+
fully qualified library name used with the ``--libraries`` option.
940+
941+
For example this code
942+
943+
.. code-block:: yul
944+
945+
let a := linkersymbol("file.sol:Math")
946+
947+
is equivalent to
948+
949+
.. code-block:: yul
950+
951+
let a := 0x1234567890123456789012345678901234567890
952+
953+
when the linker is invoked with ``--libraries "file.sol:Math:0x1234567890123456789012345678901234567890``
954+
option.
955+
956+
See :ref:`Using the Commandline Compiler <commandline-compiler>` for details about the Solidity linker.
957+
926958

927959
.. _yul-object:
928960

Diff for: libevmasm/AssemblyItem.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ void AssemblyItem::setPushTagSubIdAndTag(size_t _subId, size_t _tag)
5959
setData(data);
6060
}
6161

62-
unsigned AssemblyItem::bytesRequired(unsigned _addressLength) const
62+
size_t AssemblyItem::bytesRequired(size_t _addressLength) const
6363
{
6464
switch (m_type)
6565
{
@@ -69,7 +69,7 @@ unsigned AssemblyItem::bytesRequired(unsigned _addressLength) const
6969
case PushString:
7070
return 1 + 32;
7171
case Push:
72-
return 1 + max<unsigned>(1, util::bytesRequired(data()));
72+
return 1 + max<size_t>(1, util::bytesRequired(data()));
7373
case PushSubSize:
7474
case PushProgramSize:
7575
return 1 + 4; // worst case: a 16MB program

Diff for: libevmasm/AssemblyItem.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ class AssemblyItem
133133

134134
/// @returns an upper bound for the number of bytes required by this item, assuming that
135135
/// the value of a jump tag takes @a _addressLength bytes.
136-
unsigned bytesRequired(unsigned _addressLength) const;
136+
size_t bytesRequired(size_t _addressLength) const;
137137
size_t arguments() const;
138138
size_t returnValues() const;
139139
size_t deposit() const { return returnValues() - arguments(); }

Diff for: liblangutil/CharStream.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ tuple<int, int> CharStream::translatePositionToLineColumn(int _position) const
107107
using size_type = string::size_type;
108108
using diff_type = string::difference_type;
109109
size_type searchPosition = min<size_type>(m_source.size(), size_type(_position));
110-
int lineNumber = count(m_source.begin(), m_source.begin() + diff_type(searchPosition), '\n');
110+
int lineNumber = static_cast<int>(count(m_source.begin(), m_source.begin() + diff_type(searchPosition), '\n'));
111111
size_type lineStart;
112112
if (searchPosition == 0)
113113
lineStart = 0;

Diff for: liblangutil/Exceptions.h

+7-2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class Error;
3838
using ErrorList = std::vector<std::shared_ptr<Error const>>;
3939

4040
struct CompilerError: virtual util::Exception {};
41+
struct StackTooDeepError: virtual CompilerError {};
4142
struct InternalCompilerError: virtual util::Exception {};
4243
struct FatalError: virtual util::Exception {};
4344
struct UnimplementedFeatureError: virtual util::Exception {};
@@ -61,10 +62,14 @@ struct InvalidAstError: virtual util::Exception {};
6162
* They are passed as the first parameter of error reporting functions.
6263
* Suffix _error helps to find them in the sources.
6364
* The struct ErrorId prevents incidental calls like typeError(3141) instead of typeError(3141_error).
64-
* To create a new ID, one can add 0000_error and then run "python ./scripts/fix_error_ids.py"
65+
* To create a new ID, one can add 0000_error and then run "python ./scripts/error_codes.py --fix"
6566
* from the root of the repo.
6667
*/
67-
struct ErrorId { unsigned long long error = 0; };
68+
struct ErrorId
69+
{
70+
unsigned long long error = 0;
71+
bool operator==(ErrorId const& _rhs) const { return error == _rhs.error; }
72+
};
6873
constexpr ErrorId operator"" _error(unsigned long long _error) { return ErrorId{ _error }; }
6974

7075
class Error: virtual public util::Exception

0 commit comments

Comments
 (0)