Skip to content

Commit 3155dd8

Browse files
authored
Merge pull request #3503 from ethereum/develop
Merge develop into release for v0.4.20.
2 parents c4cbbb0 + ef8292c commit 3155dd8

File tree

165 files changed

+7455
-1164
lines changed

Some content is hidden

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

165 files changed

+7455
-1164
lines changed

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,12 @@ matrix:
9797
sudo: required
9898
compiler: gcc
9999
node_js:
100-
- "6"
100+
- "7"
101101
services:
102102
- docker
103103
before_install:
104-
- nvm install 6
105-
- nvm use 6
104+
- nvm install 7
105+
- nvm use 7
106106
- docker pull trzeci/emscripten:sdk-tag-1.35.4-64bit
107107
env:
108108
- SOLC_EMSCRIPTEN=On

CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ include(EthPolicy)
88
eth_policy()
99

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

1414
option(SOLC_LINK_STATIC "Link solc executable statically on supported platforms" OFF)
15+
option(LLLC_LINK_STATIC "Link lllc executable statically on supported platforms" OFF)
16+
option(INSTALL_LLLC "Include lllc executable in installation" OFF)
1517

1618
# Setup cccache.
1719
include(EthCcache)
@@ -43,9 +45,10 @@ configure_project(TESTS)
4345
add_subdirectory(libdevcore)
4446
add_subdirectory(libevmasm)
4547
add_subdirectory(libsolidity)
46-
add_subdirectory(solc)
48+
add_subdirectory(libsolc)
4749

4850
if (NOT EMSCRIPTEN)
51+
add_subdirectory(solc)
4952
add_subdirectory(liblll)
5053
add_subdirectory(lllc)
5154
endif()

Changelog.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,31 @@
1+
### 0.4.20 (2018-02-14)
2+
3+
Features:
4+
* Code Generator: Prevent non-view functions in libraries from being called
5+
directly (as opposed to via delegatecall).
6+
* Commandline interface: Support strict mode of assembly (disallowing jumps,
7+
instructional opcodes, etc) with the ``--strict-assembly`` switch.
8+
* Inline Assembly: Issue warning for using jump labels (already existed for jump instructions).
9+
* Inline Assembly: Support some restricted tokens (return, byte, address) as identifiers in Iulia mode.
10+
* Optimiser: Replace ``x % 2**i`` by ``x & (2**i-1)``.
11+
* Resolver: Continue resolving references after the first error.
12+
* Resolver: Suggest alternative identifiers if a given identifier is not found.
13+
* SMT Checker: Take if-else branch conditions into account in the SMT encoding of the program
14+
variables.
15+
* Syntax Checker: Deprecate the ``var`` keyword (and mark it an error as experimental 0.5.0 feature).
16+
* Type Checker: Allow `this.f.selector` to be a pure expression.
17+
* Type Checker: Issue warning for using ``public`` visibility for interface functions.
18+
* Type Checker: Limit the number of warnings raised for creating abstract contracts.
19+
20+
Bugfixes:
21+
* Error Output: Truncate huge number literals in the middle to avoid output blow-up.
22+
* Parser: Disallow event declarations with no parameter list.
23+
* Standard JSON: Populate the ``sourceLocation`` field in the error list.
24+
* Standard JSON: Properly support contract and library file names containing a colon (such as URLs).
25+
* Type Checker: Suggest the experimental ABI encoder if using ``struct``s as function parameters
26+
(instead of an internal compiler error).
27+
* Type Checker: Improve error message for wrong struct initialization.
28+
129
### 0.4.19 (2017-11-30)
230

331
Features:

circle.yml

Lines changed: 113 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,144 @@
11
version: 2
22
jobs:
3-
build:
3+
build_emscripten:
44
docker:
55
- image: trzeci/emscripten:sdk-tag-1.37.21-64bit
66
steps:
77
- checkout
8+
- run:
9+
name: Init submodules
10+
command: |
11+
git submodule update --init
12+
- restore_cache:
13+
name: Restore Boost build
14+
key: &boost-cache-key emscripten-boost-{{ checksum "scripts/travis-emscripten/install_deps.sh" }}{{ checksum "scripts/travis-emscripten/build_emscripten.sh" }}
15+
- run:
16+
name: Bootstrap Boost
17+
command: |
18+
scripts/travis-emscripten/install_deps.sh
19+
- run:
20+
name: Build
21+
command: |
22+
scripts/travis-emscripten/build_emscripten.sh
23+
- save_cache:
24+
name: Save Boost build
25+
key: *boost-cache-key
26+
paths:
27+
- boost_1_57_0
28+
- store_artifacts:
29+
path: build/libsolc/soljson.js
30+
destination: soljson.js
31+
- run: mkdir -p workspace
32+
- run: cp build/libsolc/soljson.js workspace/soljson.js
33+
- run: scripts/get_version.sh > workspace/version.txt
34+
- persist_to_workspace:
35+
root: workspace
36+
paths:
37+
- soljson.js
38+
- version.txt
39+
test_emscripten_solcjs:
40+
docker:
41+
- image: trzeci/emscripten:sdk-tag-1.37.21-64bit
42+
steps:
43+
- checkout
44+
- attach_workspace:
45+
at: /tmp/workspace
846
- run:
947
name: Install external tests deps
1048
command: |
1149
apt-get -qq update
1250
apt-get -qy install netcat curl
1351
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.4/install.sh | NVM_DIR=/usr/local/nvm bash
52+
export NVM_DIR="/usr/local/nvm"
53+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
54+
nvm --version
55+
nvm install 6
56+
node --version
57+
npm --version
58+
- run:
59+
name: Test solcjs
60+
command: |
61+
. /usr/local/nvm/nvm.sh
62+
test/solcjsTests.sh /tmp/workspace/soljson.js $(cat /tmp/workspace/version.txt)
63+
test_emscripten_external:
64+
docker:
65+
- image: trzeci/emscripten:sdk-tag-1.37.21-64bit
66+
steps:
67+
- checkout
68+
- attach_workspace:
69+
at: /tmp/workspace
1470
- run:
15-
name: Test external tests deps
71+
name: Install external tests deps
1672
command: |
73+
apt-get -qq update
74+
apt-get -qy install netcat curl
75+
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.4/install.sh | NVM_DIR=/usr/local/nvm bash
1776
export NVM_DIR="/usr/local/nvm"
1877
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
1978
nvm --version
20-
nvm install 6
79+
nvm install 7
2180
node --version
2281
npm --version
82+
- run:
83+
name: External tests
84+
command: |
85+
. /usr/local/nvm/nvm.sh
86+
test/externalTests.sh /tmp/workspace/soljson.js
87+
build_x86:
88+
docker:
89+
- image: buildpack-deps:artful
90+
steps:
91+
- checkout
92+
- run:
93+
name: Install build dependencies
94+
command: |
95+
apt-get -qq update
96+
apt-get -qy install ccache cmake libboost-all-dev libz3-dev
2397
- run:
2498
name: Init submodules
2599
command: |
26100
git submodule update --init
27-
- restore_cache:
28-
name: Restore Boost build
29-
key: &boost-cache-key emscripten-boost-{{ checksum "scripts/travis-emscripten/install_deps.sh" }}{{ checksum "scripts/travis-emscripten/build_emscripten.sh" }}
30101
- run:
31-
name: Bootstrap Boost
102+
name: Store commit hash and prerelease
32103
command: |
33-
scripts/travis-emscripten/install_deps.sh
104+
date -u +"nightly.%Y.%-m.%-d" > prerelease.txt
105+
echo -n "$CIRCLE_SHA1" > commit_hash.txt
106+
- restore_cache:
107+
key: ccache-{{ arch }}-{{ .Branch }}
108+
key: ccache-{{ arch }}
109+
key: ccache
34110
- run:
35111
name: Build
36-
command: |
37-
scripts/travis-emscripten/build_emscripten.sh
112+
command: ./scripts/build.sh RelWithDebInfo
38113
- save_cache:
39-
name: Save Boost build
40-
key: *boost-cache-key
114+
key: ccache-{{ arch }}-{{ .Branch }}
41115
paths:
42-
- boost_1_57_0
116+
- ~/.ccache
43117
- run:
44-
name: Test
45-
command: |
46-
. /usr/local/nvm/nvm.sh
47-
scripts/test_emscripten.sh
118+
name: Commandline tests
119+
command: test/cmdlineTests.sh
120+
- run: mkdir -p test_results
121+
- run:
122+
name: Test without optimizer (exclude IPC tests)
123+
command: build/test/soltest --logger=JUNIT,test_suite,test_results/no_opt.xml -- --no-ipc
124+
- run:
125+
name: Test with optimizer (exclude IPC tests)
126+
command: build/test/soltest --logger=JUNIT,test_suite,test_results/opt.xml -- --optimize --no-ipc
127+
- store_test_results:
128+
path: test_results/
48129
- store_artifacts:
49-
path: build/solc/soljson.js
50-
destination: soljson.js
130+
path: build/solc/solc
131+
destination: solc
132+
133+
workflows:
134+
version: 2
135+
build_all:
136+
jobs:
137+
- build_emscripten
138+
- test_emscripten_solcjs:
139+
requires:
140+
- build_emscripten
141+
- test_emscripten_external:
142+
requires:
143+
- build_emscripten
144+
- build_x86

cmake/EthCompilerSettings.cmake

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,15 @@ if (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MA
9393
# testing on at least OS X and Ubuntu.
9494
add_compile_options(-Wno-unused-function)
9595
add_compile_options(-Wno-dangling-else)
96-
96+
97+
if ("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
98+
# Set stack size to 16MB - by default Apple's clang defines a stack size of 8MB, some tests require more.
99+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-stack_size -Wl,0x1000000")
100+
endif()
101+
97102
# Some Linux-specific Clang settings. We don't want these for OS X.
98103
if ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
99-
104+
100105
# TODO - Is this even necessary? Why?
101106
# See http://stackoverflow.com/questions/19774778/when-is-it-necessary-to-use-use-the-flag-stdlib-libstdc.
102107
add_compile_options(-stdlib=libstdc++)
@@ -115,7 +120,7 @@ if (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MA
115120
endif()
116121

117122
if (EMSCRIPTEN)
118-
# Do emit a separate memory initialiser file
123+
# Do not emit a separate memory initialiser file
119124
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --memory-init-file 0")
120125
# Leave only exported symbols as public and agressively remove others
121126
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdata-sections -ffunction-sections -Wl,--gc-sections -fvisibility=hidden")
@@ -133,6 +138,8 @@ if (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MA
133138
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s ALLOW_MEMORY_GROWTH=1")
134139
# Disable eval()
135140
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s NO_DYNAMIC_EXECUTION=1")
141+
# Disable greedy exception catcher
142+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s NODEJS_CATCH_EXIT=0")
136143
add_definitions(-DETH_EMSCRIPTEN=1)
137144
endif()
138145
endif()

docs/abi-spec.rst

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,21 @@ The following elementary types exist:
4040

4141
- ``int<M>``: two's complement signed integer type of ``M`` bits, ``0 < M <= 256``, ``M % 8 == 0``.
4242

43-
- ``address``: equivalent to ``uint160``, except for the assumed interpretation and language typing.
43+
- ``address``: equivalent to ``uint160``, except for the assumed interpretation and language typing. For computing the function selector, ``address`` is used.
4444

45-
- ``uint``, ``int``: synonyms for ``uint256``, ``int256`` respectively (this shorthand not to be used for computing the function selector).
45+
- ``uint``, ``int``: synonyms for ``uint256``, ``int256`` respectively. For computing the function selector, ``uint256`` and ``int256`` have to be used.
4646

47-
- ``bool``: equivalent to ``uint8`` restricted to the values 0 and 1
47+
- ``bool``: equivalent to ``uint8`` restricted to the values 0 and 1. For computing the function selector, ``bool`` is used.
4848

4949
- ``fixed<M>x<N>``: signed fixed-point decimal number of ``M`` bits, ``8 <= M <= 256``, ``M % 8 ==0``, and ``0 < N <= 80``, which denotes the value ``v`` as ``v / (10 ** N)``.
5050

5151
- ``ufixed<M>x<N>``: unsigned variant of ``fixed<M>x<N>``.
5252

53-
- ``fixed``, ``ufixed``: synonyms for ``fixed128x19``, ``ufixed128x19`` respectively (this shorthand not to be used for computing the function selector).
53+
- ``fixed``, ``ufixed``: synonyms for ``fixed128x19``, ``ufixed128x19`` respectively. For computing the function selector, ``fixed128x19`` and ``ufixed128x19`` have to be used.
5454

5555
- ``bytes<M>``: binary type of ``M`` bytes, ``0 < M <= 32``.
5656

57-
- ``function``: equivalent to ``bytes24``: an address, followed by a function selector
57+
- ``function``: an address (20 bytes) folled by a function selector (4 bytes). Encoded identical to ``bytes24``.
5858

5959
The following (fixed-size) array type exists:
6060

@@ -187,12 +187,12 @@ Given the contract:
187187

188188
::
189189

190-
pragma solidity ^0.4.0;
190+
pragma solidity ^0.4.16;
191191

192192
contract Foo {
193-
function bar(bytes3[2] xy) {}
194-
function baz(uint32 x, bool y) returns (bool r) { r = x > 32 || y; }
195-
function sam(bytes name, bool z, uint[] data) {}
193+
function bar(bytes3[2]) public pure {}
194+
function baz(uint32 x, bool y) public pure returns (bool r) { r = x > 32 || y; }
195+
function sam(bytes, bool, uint[]) public pure {}
196196
}
197197

198198

@@ -288,6 +288,8 @@ In effect, a log entry using this ABI is described as:
288288
- ``topics[n]``: ``EVENT_INDEXED_ARGS[n - 1]`` (``EVENT_INDEXED_ARGS`` is the series of ``EVENT_ARGS`` that are indexed);
289289
- ``data``: ``abi_serialise(EVENT_NON_INDEXED_ARGS)`` (``EVENT_NON_INDEXED_ARGS`` is the series of ``EVENT_ARGS`` that are not indexed, ``abi_serialise`` is the ABI serialisation function used for returning a series of typed values from a function, as described above).
290290

291+
For all fixed-length Solidity types, the ``EVENT_INDEXED_ARGS`` array contains the 32-byte encoded value directly. However, for *types of dynamic length*, which include ``string``, ``bytes``, and arrays, ``EVENT_INDEXED_ARGS`` will contain the *Keccak hash* of the encoded value, rather than the encoded value directly. This allows applications to efficiently query for values of dynamic-length types (by setting the hash of the encoded value as the topic), but leaves applications unable to decode indexed values they have not queried for. For dynamic-length types, application developers face a trade-off between fast search for predetermined values (if the argument is indexed) and legibility of arbitrary values (which requires that the arguments not be indexed). Developers may overcome this tradeoff and achieve both efficient search and arbitrary legibility by defining events with two arguments — one indexed, one not — intended to hold the same value.
292+
291293
JSON
292294
====
293295

@@ -333,10 +335,10 @@ For example,
333335
pragma solidity ^0.4.0;
334336

335337
contract Test {
336-
function Test(){ b = 0x12345678901234567890123456789012; }
338+
function Test() public { b = 0x12345678901234567890123456789012; }
337339
event Event(uint indexed a, bytes32 b);
338340
event Event2(uint indexed a, bytes32 b);
339-
function foo(uint a) { Event(a, b); }
341+
function foo(uint a) public { Event(a, b); }
340342
bytes32 b;
341343
}
342344

@@ -377,10 +379,14 @@ As an example, the code
377379

378380
::
379381

382+
pragma solidity ^0.4.19;
383+
pragma experimental ABIEncoderV2;
384+
380385
contract Test {
381386
struct S { uint a; uint[] b; T[] c; }
382387
struct T { uint x; uint y; }
383-
function f(S s, T t, uint a) { }
388+
function f(S s, T t, uint a) public { }
389+
function g() public returns (S s, T t, uint a) {}
384390
}
385391

386392
would result in the JSON:

0 commit comments

Comments
 (0)