Skip to content

Commit 68ef581

Browse files
authored
Merge pull request #2219 from ethereum/develop
Release for version 0.4.11
2 parents f0d539a + 34b28ed commit 68ef581

File tree

121 files changed

+5006
-1398
lines changed

Some content is hidden

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

121 files changed

+5006
-1398
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
.commit_hash.txt
2-
.prerelease.txt
1+
commit_hash.txt
2+
prerelease.txt
33

44
# Compiled Object files
55
*.slo

.travis.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ env:
4444
- SOLC_INSTALL_DEPS_TRAVIS=On
4545
- SOLC_RELEASE=On
4646
- SOLC_TESTS=On
47+
- SOLC_STOREBYTECODE=Off
4748
- SOLC_DOCKER=Off
4849

4950
matrix:
@@ -61,13 +62,15 @@ matrix:
6162
compiler: gcc
6263
env:
6364
- ZIP_SUFFIX=ubuntu-trusty
65+
- SOLC_STOREBYTECODE=On
6466

6567
- os: linux
6668
dist: trusty
6769
sudo: required
6870
compiler: clang
6971
env:
7072
- ZIP_SUFFIX=ubuntu-trusty-clang
73+
- SOLC_STOREBYTECODE=On
7174

7275
# Documentation target, which generates documentation using Phoenix / ReadTheDocs.
7376
- os: linux
@@ -113,6 +116,8 @@ matrix:
113116
- SOLC_INSTALL_DEPS_TRAVIS=Off
114117
- SOLC_RELEASE=Off
115118
- SOLC_TESTS=Off
119+
- ZIP_SUFFIX=emscripten
120+
- SOLC_STOREBYTECODE=On
116121

117122
# OS X Mavericks (10.9)
118123
# https://en.wikipedia.org/wiki/OS_X_Mavericks
@@ -175,18 +180,20 @@ cache:
175180
install:
176181
- test $SOLC_INSTALL_DEPS_TRAVIS != On || (scripts/install_deps.sh)
177182
- test "$TRAVIS_OS_NAME" != "linux" || (scripts/install_cmake.sh)
183+
- if [ "$TRAVIS_BRANCH" = release ]; then echo -n > prerelease.txt; else date -u +"nightly.%Y.%-m.%-d" > prerelease.txt; fi
178184
- echo -n "$TRAVIS_COMMIT" > commit_hash.txt
179-
- test $SOLC_DOCKER != On || (docker build -t ethereum/solc:build -f scripts/Dockerfile .)
180185

181186
before_script:
182187
- test $SOLC_EMSCRIPTEN != On || (scripts/build_emscripten.sh)
188+
- test $SOLC_DOCKER != On || (scripts/docker_build.sh)
183189
- test $SOLC_RELEASE != On || (scripts/build.sh $SOLC_BUILD_TYPE
184190
&& scripts/release.sh $ZIP_SUFFIX
185191
&& scripts/create_source_tarball.sh)
186192

187193
script:
188194
- test $SOLC_DOCS != On || (scripts/docs.sh)
189195
- test $SOLC_TESTS != On || (cd $TRAVIS_BUILD_DIR && scripts/tests.sh)
196+
- test $SOLC_STOREBYTECODE != On || (cd $TRAVIS_BUILD_DIR && scripts/bytecodecompare/storebytecode.sh)
190197

191198
deploy:
192199
# This is the deploy target for the Emscripten build.
@@ -223,11 +230,8 @@ deploy:
223230

224231
overwrite: true
225232
file_glob: true
226-
file:
227-
- $TRAVIS_BUILD_DIR/solidity*.zip
228-
- $TRAVIS_BUILD_DIR/solidity*tar.gz
233+
file: $TRAVIS_BUILD_DIR/upload/*
229234
skip_cleanup: true
230235
on:
231236
all_branches: true
232237
tags: true
233-
condition: $SOLC_RELEASE == On

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.10")
11+
set(PROJECT_VERSION "0.4.11")
1212
project(solidity VERSION ${PROJECT_VERSION})
1313

1414
# Let's find our dependencies

Changelog.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
### 0.4.11 (2017-05-03)
2+
3+
Features:
4+
* Implement the Standard JSON Input / Output API
5+
* Support ``interface`` contracts.
6+
* C API (``jsonCompiler``): Add the ``compileStandard()`` method to process a Standard JSON I/O.
7+
* Commandline interface: Add the ``--standard-json`` parameter to process a Standard JSON I/O.
8+
* Commandline interface: Support ``--allow-paths`` to define trusted import paths. Note: the
9+
path(s) of the supplied source file(s) is always trusted.
10+
* Inline Assembly: Storage variable access using ``_slot`` and ``_offset`` suffixes.
11+
* Inline Assembly: Disallow blocks with unbalanced stack.
12+
* Static analyzer: Warn about statements without effects.
13+
* Static analyzer: Warn about unused local variables, parameters, and return parameters.
14+
* Syntax checker: issue deprecation warning for unary '+'
15+
16+
Bugfixes:
17+
* Assembly output: Implement missing AssemblyItem types.
18+
* Compiler interface: Fix a bug where source indexes could be inconsistent between Solidity compiled
19+
with different compilers (clang vs. gcc) or compiler settings. The bug was visible in AST
20+
and source mappings.
21+
* Gas Estimator: Reflect the most recent fee schedule.
22+
* Type system: Contract inheriting from base with unimplemented constructor should be abstract.
23+
* Optimizer: Number representation bug in the constant optimizer fixed.
24+
125
### 0.4.10 (2017-03-15)
226

327
Features:

appveyor.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ branches:
3434
os: Visual Studio 2015
3535
configuration:
3636
- RelWithDebInfo
37+
environment:
38+
# This is used for pushing to solidity-test-bytecodes
39+
priv_key:
40+
secure: yYGwg4rhCdHfwuv2mFjaNEDwAx3IKUbp0D5fMGpaKefnfk+BiMS5bqSHRiOj91PZ91P9pUk2Vu+eNuS4hTFCf1zFGfrOhlJ4Ij0xSyU5m/LQr590Mo+f7W94Xc8ubgo6j2hp9qH/szTqTzmAkmxKO5TLlWjVzVny2t/s5o5UprLS1/MdzDNLjpVNXR03oKfdWUV9a2l6+PejXCbqyUCagh6BByZqeAPbDcil6eAfxu4EPX83Fuurof+KqFzIWycBG5qK1pTipn2pxiA0QKuUrD8y8VNL0S23NTgxoxSp7nPVMd3K0qRSzPM5lrqS7Z8i3evkVwPbuhu0gSiV08jGVahH2snQ3JGYsH2D4KmVn/xiVBeJ0lRplYlfZF0GUu7iJ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NsqOuBtDdIkApefzc1pT38uKpmVfggKUsoWUdqMXAWqCDWr2uw9EE900RJpEY6mIEWhkcro5LAMwaqByOGpqFFUkH+UWTC102eVHEmjxKpC6c6cSzoKKU6Ckd+jVRFO7TvmVe1MKCwjXj8lcAfAM2gQ+XehtrQdIBhAmCrnzurfz2u9tKVdpiADC1ig+kMs1/HX2713LYVXzDKdk+duQ94SVtGv9F2Iv+KN5oq4UFgll6VGt7GHsJOrYYf/wrOfB09IkpmjNygvcpmmSdcXXF8ulDD6KHTGEGUlFwLOpEwKx+zX2ZvviStHhN8KsoTKSVSueDmSSI63HdTS7FxfrHJc1yAzsdqEN5g5eV/z2Fn34qy64mdFSAZMF5zsbWZYFpc9ef3llF5aRcuD90JWT2VC7rB2jeGEtiwGkDlqKzxqRvJk06wTK6+n5RncN66bDaksulOPJMAR/bRW7dinV8T6yIvybuhqDetxJQP6eyAnW4xr1YxIAG4BXGZV6XAPTgOG2oGvMdncxkcLQHXVu07x39ySqP/m2MBxn0zF3DmaqrSPIRMhS8gG3d/23Jux3YHDEOBHjdJSdwqs5F5+QBFPV2rmJnpcSoW4d3M119XI20L914c62R7wY4e6+qmi3ydQU9g6p8psZgaE3TuMsyzX3k4C30nC/3gWT+zl253NjZwfbzIdHu5LWNDY9kEHtKzLP
3741
# NB: Appveyor cache is disabled, because it is proving very unreliable.
3842
# We can re-enable it when we find a way to mitigate the unreliability
3943
# issues. Have automated builds be reliable is the more important thing.
@@ -43,7 +47,14 @@ configuration:
4347
#init:
4448
# - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
4549
install:
50+
- ps: $fileContent = "-----BEGIN RSA PRIVATE KEY-----`n"
51+
- ps: $fileContent += $env:priv_key.Replace(' ', "`n")
52+
- ps: $fileContent += "`n-----END RSA PRIVATE KEY-----`n"
53+
- ps: Set-Content c:\users\appveyor\.ssh\id_rsa $fileContent
4654
- git submodule update --init --recursive
55+
- ps: $prerelease = "nightly."
56+
- ps: $prerelease += Get-Date -format "yyyy.M.d"
57+
- ps: Set-Content prerelease.txt $prerelease
4758
- scripts/install_deps.bat
4859
- set ETHEREUM_DEPS_PATH=%APPVEYOR_BUILD_FOLDER%\deps\install
4960
before_build:
@@ -54,15 +65,12 @@ build_script:
5465
- msbuild solidity.sln /p:Configuration=%CONFIGURATION% /m:%NUMBER_OF_PROCESSORS% /v:minimal
5566
- cd %APPVEYOR_BUILD_FOLDER%
5667
- scripts\release.bat %CONFIGURATION%
68+
- scripts\bytecodecompare\storebytecode.bat %CONFIGURATION% %APPVEYOR_REPO_COMMIT%
5769

5870
test_script:
5971
- cd %APPVEYOR_BUILD_FOLDER%
60-
- cd deps\install\x64\eth
61-
- ps: $ethProc = Start-Process eth.exe --test
62-
- ps: Start-Sleep -s 100
6372
- cd %APPVEYOR_BUILD_FOLDER%\build\test\%CONFIGURATION%
64-
- copy "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\redist\x86\Microsoft.VC140.CRT\msvc*.dll" .
65-
- soltest.exe --show-progress -- --ipcpath \\.\pipe\geth.ipc
73+
- soltest.exe --show-progress -- --no-ipc
6674

6775
artifacts:
6876
- path: solidity-windows.zip

docs/assembly.rst

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ differs from standalone assembly and then specify assembly itself.
1111

1212
TODO: Write about how scoping rules of inline assembly are a bit different
1313
and the complications that arise when for example using internal functions
14-
of libraries. Furhermore, write about the symbols defined by the compiler.
14+
of libraries. Furthermore, write about the symbols defined by the compiler.
1515

1616
Inline Assembly
1717
===============
@@ -29,7 +29,7 @@ arising when writing manual assembly by the following features:
2929
* labels: ``let x := 10 repeat: x := sub(x, 1) jumpi(repeat, eq(x, 0))``
3030
* loops: ``for { let i := 0 } lt(i, x) { i := add(i, 1) } { y := mul(2, y) }``
3131
* switch statements: ``switch x case 0: { y := mul(x, 2) } default: { y := 0 }``
32-
* function calls: ``function f(x) -> (y) { switch x case 0: { y := 1 } default: { y := mul(x, f(sub(x, 1))) } }``
32+
* function calls: ``function f(x) -> y { switch x case 0: { y := 1 } default: { y := mul(x, f(sub(x, 1))) } }``
3333

3434
.. note::
3535
Of the above, loops, function calls and switch statements are not yet implemented.
@@ -323,9 +323,12 @@ Access to External Variables and Functions
323323
------------------------------------------
324324

325325
Solidity variables and other identifiers can be accessed by simply using their name.
326-
For storage and memory variables, this will push the address and not the value onto the
327-
stack. Also note that non-struct and non-array storage variable addresses occupy two slots
328-
on the stack: One for the address and one for the byte offset inside the storage slot.
326+
For memory variables, this will push the address and not the value onto the
327+
stack. Storage variables are different: Values in storage might not occupy a
328+
full storage slot, so their "address" is composed of a slot and a byte-offset
329+
inside that slot. To retrieve the slot pointed to by the variable ``x``, you
330+
used ``x_slot`` and to retrieve the byte-offset you used ``x_offset``.
331+
329332
In assignments (see below), we can even use local Solidity variables to assign to.
330333

331334
Functions external to inline assembly can also be accessed: The assembly will
@@ -340,17 +343,13 @@ changes during the call, and thus references to local variables will be wrong.
340343

341344
.. code::
342345
343-
pragma solidity ^0.4.0;
346+
pragma solidity ^0.4.11;
344347
345348
contract C {
346349
uint b;
347350
function f(uint x) returns (uint r) {
348351
assembly {
349-
b pop // remove the offset, we know it is zero
350-
sload
351-
x
352-
mul
353-
=: r // assign to return variable r
352+
r := mul(x, sload(b_slot)) // ignore the offset, we know it is zero
354353
}
355354
}
356355
}
@@ -567,7 +566,7 @@ The following example implements the power function by square-and-multiply.
567566
.. code::
568567
569568
assembly {
570-
function power(base, exponent) -> (result) {
569+
function power(base, exponent) -> result {
571570
switch exponent
572571
0: { result := 1 }
573572
1: { result := base }
@@ -702,12 +701,12 @@ The following assembly will be generated::
702701
}
703702
default: { jump(invalidJumpLabel) }
704703
// memory allocator
705-
function $allocate(size) -> (pos) {
704+
function $allocate(size) -> pos {
706705
pos := mload(0x40)
707706
mstore(0x40, add(pos, size))
708707
}
709708
// the contract function
710-
function f(x) -> (y) {
709+
function f(x) -> y {
711710
y := 1
712711
for { let i := 0 } lt(i, x) { i := add(i, 1) } {
713712
y := mul(2, y)

docs/bugs.json

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
[
2+
{
3+
"name": "ConstantOptimizerSubtraction",
4+
"summary": "In some situations, the optimizer replaces certain numbers in the code with routines that compute different numbers.",
5+
"description": "The optimizer tries to represent any number in the bytecode by routines that compute them with less gas. For some special numbers, an incorrect routine is generated. This could allow an attacker to e.g. trick victims about a specific amount of ether, or function calls to call different functions (or none at all).",
6+
"link": "https://blog.ethereum.org/2017/05/03/solidity-optimizer-bug/",
7+
"fixed": "0.4.11",
8+
"severity": "low",
9+
"conditions": {
10+
"optimizer": true
11+
}
12+
},
13+
{
14+
"name": "IdentityPrecompileReturnIgnored",
15+
"summary": "Failure of the identity precompile was ignored.",
16+
"description": "Calls to the identity contract, which is used for copying memory, ignored its return value. On the public chain, calls to the identity precompile can be made in a way that they never fail, but this might be different on private chains.",
17+
"severity": "low",
18+
"fixed": "0.4.7"
19+
},
20+
{
21+
"name": "OptimizerStateKnowledgeNotResetForJumpdest",
22+
"summary": "The optimizer did not properly reset its internal state at jump destinations, which could lead to data corruption.",
23+
"description": "The optimizer performs symbolic execution at certain stages. At jump destinations, multiple code paths join and thus it has to compute a common state from the incoming edges. Computing this common state was simplified to just use the empty state, but this implementation was not done properly. This bug can cause data corruption.",
24+
"severity": "medium",
25+
"introduced": "0.4.5",
26+
"fixed": "0.4.6",
27+
"conditions": {
28+
"optimizer": true
29+
}
30+
},
31+
{
32+
"name": "HighOrderByteCleanStorage",
33+
"summary": "For short types, the high order bytes were not cleaned properly and could overwrite existing data.",
34+
"description": "Types shorter than 32 bytes are packed together into the same 32 byte storage slot, but storage writes always write 32 bytes. For some types, the higher order bytes were not cleaned properly, which made it sometimes possible to overwrite a variable in storage when writing to another one.",
35+
"link": "https://blog.ethereum.org/2016/11/01/security-alert-solidity-variables-can-overwritten-storage/",
36+
"severity": "high",
37+
"introduced": "0.1.6",
38+
"fixed": "0.4.4"
39+
},
40+
{
41+
"name": "OptimizerStaleKnowledgeAboutSHA3",
42+
"summary": "The optimizer did not properly reset its knowledge about SHA3 operations resulting in some hashes (also used for storage variable positions) not being calculated correctly.",
43+
"description": "The optimizer performs symbolic execution in order to save re-evaluating expressions whose value is already known. This knowledge was not properly reset across control flow paths and thus the optimizer sometimes thought that the result of a SHA3 operation is already present on the stack. This could result in data corruption by accessing the wrong storage slot.",
44+
"severity": "medium",
45+
"fixed": "0.4.3",
46+
"conditions": {
47+
"optimizer": true
48+
}
49+
},
50+
{
51+
"name": "LibrariesNotCallableFromPayableFunctions",
52+
"summary": "Library functions threw an exception when called from a call that received Ether.",
53+
"description": "Library functions are protected against sending them Ether through a call. Since the DELEGATECALL opcode forwards the information about how much Ether was sent with a call, the library function incorrectly assumed that Ether was sent to the library and threw an exception.",
54+
"severity": "low",
55+
"introduced": "0.4.0",
56+
"fixed": "0.4.2"
57+
},
58+
{
59+
"name": "SendFailsForZeroEther",
60+
"summary": "The send function did not provide enough gas to the recipient if no Ether was sent with it.",
61+
"description": "The recipient of an Ether transfer automatically receives a certain amount of gas from the EVM to handle the transfer. In the case of a zero-transfer, this gas is not provided which causes the recipient to throw an exception.",
62+
"severity": "low",
63+
"fixed": "0.4.0"
64+
},
65+
{
66+
"name": "DynamicAllocationInfiniteLoop",
67+
"summary": "Dynamic allocation of an empty memory array caused an infinite loop and thus an exception.",
68+
"description": "Memory arrays can be created provided a length. If this length is zero, code was generated that did not terminate and thus consumed all gas.",
69+
"severity": "low",
70+
"fixed": "0.3.6"
71+
},
72+
{
73+
"name": "OptimizerClearStateOnCodePathJoin",
74+
"summary": "The optimizer did not properly reset its internal state at jump destinations, which could lead to data corruption.",
75+
"description": "The optimizer performs symbolic execution at certain stages. At jump destinations, multiple code paths join and thus it has to compute a common state from the incoming edges. Computing this common state was not done correctly. This bug can cause data corruption, but it is probably quite hard to use for targeted attacks.",
76+
"severity": "low",
77+
"fixed": "0.3.6",
78+
"conditions": {
79+
"optimizer": true
80+
}
81+
},
82+
{
83+
"name": "CleanBytesHigherOrderBits",
84+
"summary": "The higher order bits of short bytesNN types were not cleaned before comparison.",
85+
"description": "Two variables of type bytesNN were considered different if their higher order bits, which are not part of the actual value, were different. An attacker might use this to reach seemingly unreachable code paths by providing incorrectly formatted input data.",
86+
"severity": "medium/high",
87+
"fixed": "0.3.3"
88+
},
89+
{
90+
"name": "ArrayAccessCleanHigherOrderBits",
91+
"summary": "Access to array elements for arrays of types with less than 32 bytes did not correctly clean the higher order bits, causing corruption in other array elements.",
92+
"description": "Multiple elements of an array of values that are shorter than 17 bytes are packed into the same storage slot. Writing to a single element of such an array did not properly clean the higher order bytes and thus could lead to data corruption.",
93+
"severity": "medium/high",
94+
"fixed": "0.3.1"
95+
},
96+
{
97+
"name": "AncientCompiler",
98+
"summary": "This compiler version is ancient and might contain several undocumented or undiscovered bugs.",
99+
"description": "The list of bugs is only kept for compiler versions starting from 0.3.0, so older versions might contain undocumented bugs.",
100+
"severity": "high",
101+
"fixed": "0.3.0"
102+
}
103+
]

0 commit comments

Comments
 (0)