Skip to content

Commit c4cbbb0

Browse files
authored
Merge pull request #3261 from ethereum/develop
Merge develop into release for 0.4.19
2 parents 9cf6e91 + d0af0c1 commit c4cbbb0

File tree

99 files changed

+4500
-666
lines changed

Some content is hidden

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

99 files changed

+4500
-666
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ prerelease.txt
3434
build/
3535
docs/_build
3636
docs/utils/__pycache__
37+
docs/utils/*.pyc
3738

3839
# vim stuff
3940
*.swp

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ include(EthPolicy)
88
eth_policy()
99

1010
# project name and version should be set after cmake_policy CMP0048
11-
set(PROJECT_VERSION "0.4.18")
11+
set(PROJECT_VERSION "0.4.19")
1212
project(solidity VERSION ${PROJECT_VERSION})
1313

1414
option(SOLC_LINK_STATIC "Link solc executable statically on supported platforms" OFF)

Changelog.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
### 0.4.19 (2017-11-30)
2+
3+
Features:
4+
* Code Generator: New ABI decoder which supports structs and arbitrarily nested
5+
arrays and checks input size (activate using ``pragma experimental ABIEncoderV2;``).
6+
* General: Allow constant variables to be used as array length.
7+
* Inline Assembly: ``if`` statement.
8+
* Standard JSON: Support the ``outputSelection`` field for selective compilation of target artifacts.
9+
* Syntax Checker: Turn the usage of ``callcode`` into an error as experimental 0.5.0 feature.
10+
* Type Checker: Improve address checksum warning.
11+
* Type Checker: More detailed errors for invalid array lengths (such as division by zero).
12+
13+
Bugfixes:
14+
115
### 0.4.18 (2017-10-18)
216

317
Features:
@@ -11,6 +25,7 @@ Features:
1125
* Type Checker: Do not add members of ``address`` to contracts as experimental 0.5.0 feature.
1226
* Type Checker: Force interface functions to be external as experimental 0.5.0 feature.
1327
* Type Checker: Require ``storage`` or ``memory`` keyword for local variables as experimental 0.5.0 feature.
28+
* Compiler Interface: Better formatted error message for long source snippets
1429

1530
Bugfixes:
1631
* Code Generator: Allocate one byte per memory byte array element instead of 32.

appveyor.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,16 @@ build_script:
6868
- cd %APPVEYOR_BUILD_FOLDER%
6969
- scripts\release.bat %CONFIGURATION%
7070
- ps: $bytecodedir = git show -s --format="%cd-%H" --date=short
71+
72+
test_script:
73+
- cd %APPVEYOR_BUILD_FOLDER%\build\test\%CONFIGURATION%
74+
- soltest.exe --show-progress -- --no-ipc --no-smt
7175
# Skip bytecode compare if private key is not available
76+
- cd %APPVEYOR_BUILD_FOLDER%
7277
- ps: if ($env:priv_key) {
7378
scripts\bytecodecompare\storebytecode.bat $Env:CONFIGURATION $bytecodedir
7479
}
75-
76-
test_script:
77-
- cd %APPVEYOR_BUILD_FOLDER%
7880
- cd %APPVEYOR_BUILD_FOLDER%\build\test\%CONFIGURATION%
79-
- soltest.exe --show-progress -- --no-ipc --no-smt
8081

8182
artifacts:
8283
- path: solidity-windows.zip

docs/abi-spec.rst

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,14 @@ on the type of ``X`` being
130130
Note that in the dynamic case, ``head(X(i))`` is well-defined since the lengths of
131131
the head parts only depend on the types and not the values. Its value is the offset
132132
of the beginning of ``tail(X(i))`` relative to the start of ``enc(X)``.
133-
133+
134134
- ``T[k]`` for any ``T`` and ``k``:
135135

136136
``enc(X) = enc((X[0], ..., X[k-1]))``
137-
137+
138138
i.e. it is encoded as if it were a tuple with ``k`` elements
139139
of the same type.
140-
140+
141141
- ``T[]`` where ``X`` has ``k`` elements (``k`` is assumed to be of type ``uint256``):
142142

143143
``enc(X) = enc(k) enc([X[1], ..., X[k]])``
@@ -326,19 +326,19 @@ An event description is a JSON object with fairly similar fields:
326326

327327
- ``anonymous``: ``true`` if the event was declared as ``anonymous``.
328328

329-
For example,
329+
For example,
330330

331331
::
332332

333-
pragma solidity ^0.4.0;
333+
pragma solidity ^0.4.0;
334334

335-
contract Test {
336-
function Test(){ b = 0x12345678901234567890123456789012; }
337-
event Event(uint indexed a, bytes32 b)
338-
event Event2(uint indexed a, bytes32 b)
339-
function foo(uint a) { Event(a, b); }
340-
bytes32 b;
341-
}
335+
contract Test {
336+
function Test(){ b = 0x12345678901234567890123456789012; }
337+
event Event(uint indexed a, bytes32 b);
338+
event Event2(uint indexed a, bytes32 b);
339+
function foo(uint a) { Event(a, b); }
340+
bytes32 b;
341+
}
342342

343343
would result in the JSON:
344344

@@ -377,11 +377,11 @@ As an example, the code
377377

378378
::
379379

380-
contract Test {
381-
struct S { uint a; uint[] b; T[] c; }
382-
struct T { uint x; uint y; }
383-
function f(S s, T t, uint a) { }
384-
}
380+
contract Test {
381+
struct S { uint a; uint[] b; T[] c; }
382+
struct T { uint x; uint y; }
383+
function f(S s, T t, uint a) { }
384+
}
385385

386386
would result in the JSON:
387387

@@ -451,13 +451,18 @@ Non-standard Packed Mode
451451
Solidity supports a non-standard packed mode where:
452452

453453
- no :ref:`function selector <abi_function_selector>` is encoded,
454-
- short types are not zero padded and
454+
- types shorter than 32 bytes are neither zero padded nor sign extended and
455455
- dynamic types are encoded in-place and without the length.
456456

457-
As an example encoding ``uint1, bytes1, uint8, string`` with values ``1, 0x42, 0x2424, "Hello, world!"`` results in ::
457+
As an example encoding ``int1, bytes1, uint16, string`` with values ``-1, 0x42, 0x2424, "Hello, world!"`` results in ::
458458

459-
0x0142242448656c6c6f2c20776f726c6421
460-
^^ uint1(1)
459+
0xff42242448656c6c6f2c20776f726c6421
460+
^^ int1(-1)
461461
^^ bytes1(0x42)
462-
^^^^ uint8(0x2424)
462+
^^^^ uint16(0x2424)
463463
^^^^^^^^^^^^^^^^^^^^^^^^^^ string("Hello, world!") without a length field
464+
465+
More specifically, each statically-sized type takes as many bytes as its range has
466+
and dynamically-sized types like ``string``, ``bytes`` or ``uint[]`` are encoded without
467+
their length field. This means that the encoding is ambiguous as soon as there are two
468+
dynamically-sized elements.

docs/assembly.rst

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@ This assembly language can also be used as "inline assembly" inside Solidity
99
source code. We start with describing how to use inline assembly and how it
1010
differs from standalone assembly and then specify assembly itself.
1111

12-
.. note::
13-
TODO: Write about how scoping rules of inline assembly are a bit different
14-
and the complications that arise when for example using internal functions
15-
of libraries. Furthermore, write about the symbols defined by the compiler.
16-
1712
.. _inline-assembly:
1813

1914
Inline Assembly
@@ -31,6 +26,7 @@ arising when writing manual assembly by the following features:
3126
* access to external variables: ``function f(uint x) { assembly { x := sub(x, 1) } }``
3227
* labels: ``let x := 10 repeat: x := sub(x, 1) jumpi(repeat, eq(x, 0))``
3328
* loops: ``for { let i := 0 } lt(i, x) { i := add(i, 1) } { y := mul(2, y) }``
29+
* if statements: ``if slt(x, 0) { x := sub(0, x) }``
3430
* switch statements: ``switch x case 0 { y := mul(x, 2) } default { y := 0 }``
3531
* function calls: ``function f(x) -> y { switch x case 0 { y := 1 } default { y := mul(x, f(sub(x, 1))) } }``
3632

@@ -41,6 +37,11 @@ We now want to describe the inline assembly language in detail.
4137
at a low level. This discards several important safety
4238
features of Solidity.
4339

40+
.. note::
41+
TODO: Write about how scoping rules of inline assembly are a bit different
42+
and the complications that arise when for example using internal functions
43+
of libraries. Furthermore, write about the symbols defined by the compiler.
44+
4445
Example
4546
-------
4647

@@ -400,7 +401,7 @@ Labels
400401
Another problem in EVM assembly is that ``jump`` and ``jumpi`` use absolute addresses
401402
which can change easily. Solidity inline assembly provides labels to make the use of
402403
jumps easier. Note that labels are a low-level feature and it is possible to write
403-
efficient assembly without labels, just using assembly functions, loops and switch instructions
404+
efficient assembly without labels, just using assembly functions, loops, if and switch instructions
404405
(see below). The following code computes an element in the Fibonacci series.
405406

406407
.. code::
@@ -523,6 +524,21 @@ is performed by replacing the variable's value on the stack by the new value.
523524
=: v // instruction style assignment, puts the result of sload(10) into v
524525
}
525526
527+
If
528+
--
529+
530+
The if statement can be used for conditionally executing code.
531+
There is no "else" part, consider using "switch" (see below) if
532+
you need multiple alternatives.
533+
534+
.. code::
535+
536+
{
537+
if eq(value, 0) { revert(0, 0) }
538+
}
539+
540+
The curly braces for the body are required.
541+
526542
Switch
527543
------
528544

@@ -622,7 +638,7 @@ Things to Avoid
622638
---------------
623639

624640
Inline assembly might have a quite high-level look, but it actually is extremely
625-
low-level. Function calls, loops and switches are converted by simple
641+
low-level. Function calls, loops, ifs and switches are converted by simple
626642
rewriting rules and after that, the only thing the assembler does for you is re-arranging
627643
functional-style opcodes, managing jump labels, counting stack height for
628644
variable access and removing stack slots for assembly-local variables when the end
@@ -669,7 +685,7 @@ for the Solidity compiler. In this form, it tries to achieve several goals:
669685
3. Control flow should be easy to detect to help in formal verification and optimization.
670686

671687
In order to achieve the first and last goal, assembly provides high-level constructs
672-
like ``for`` loops, ``switch`` statements and function calls. It should be possible
688+
like ``for`` loops, ``if`` and ``switch`` statements and function calls. It should be possible
673689
to write assembly programs that do not make use of explicit ``SWAP``, ``DUP``,
674690
``JUMP`` and ``JUMPI`` statements, because the first two obfuscate the data flow
675691
and the last two obfuscate control flow. Furthermore, functional statements of
@@ -875,6 +891,7 @@ Grammar::
875891
FunctionalAssemblyAssignment |
876892
AssemblyAssignment |
877893
LabelDefinition |
894+
AssemblyIf |
878895
AssemblySwitch |
879896
AssemblyFunctionDefinition |
880897
AssemblyFor |
@@ -891,6 +908,7 @@ Grammar::
891908
IdentifierList = Identifier ( ',' Identifier)*
892909
AssemblyAssignment = '=:' Identifier
893910
LabelDefinition = Identifier ':'
911+
AssemblyIf = 'if' FunctionalAssemblyExpression AssemblyBlock
894912
AssemblySwitch = 'switch' FunctionalAssemblyExpression AssemblyCase*
895913
( 'default' AssemblyBlock )?
896914
AssemblyCase = 'case' FunctionalAssemblyExpression AssemblyBlock

docs/bugs_by_version.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,10 @@
397397
"bugs": [],
398398
"released": "2017-10-18"
399399
},
400+
"0.4.19": {
401+
"bugs": [],
402+
"released": "2017-11-30"
403+
},
400404
"0.4.2": {
401405
"bugs": [
402406
"ZeroFunctionSelector",

0 commit comments

Comments
 (0)