Skip to content

Commit

Permalink
Merge pull request #3503 from ethereum/develop
Browse files Browse the repository at this point in the history
Merge develop into release for v0.4.20.
  • Loading branch information
chriseth authored Feb 14, 2018
2 parents c4cbbb0 + ef8292c commit 3155dd8
Show file tree
Hide file tree
Showing 165 changed files with 7,455 additions and 1,164 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ matrix:
sudo: required
compiler: gcc
node_js:
- "6"
- "7"
services:
- docker
before_install:
- nvm install 6
- nvm use 6
- nvm install 7
- nvm use 7
- docker pull trzeci/emscripten:sdk-tag-1.35.4-64bit
env:
- SOLC_EMSCRIPTEN=On
Expand Down
7 changes: 5 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ include(EthPolicy)
eth_policy()

# project name and version should be set after cmake_policy CMP0048
set(PROJECT_VERSION "0.4.19")
set(PROJECT_VERSION "0.4.20")
project(solidity VERSION ${PROJECT_VERSION})

option(SOLC_LINK_STATIC "Link solc executable statically on supported platforms" OFF)
option(LLLC_LINK_STATIC "Link lllc executable statically on supported platforms" OFF)
option(INSTALL_LLLC "Include lllc executable in installation" OFF)

# Setup cccache.
include(EthCcache)
Expand Down Expand Up @@ -43,9 +45,10 @@ configure_project(TESTS)
add_subdirectory(libdevcore)
add_subdirectory(libevmasm)
add_subdirectory(libsolidity)
add_subdirectory(solc)
add_subdirectory(libsolc)

if (NOT EMSCRIPTEN)
add_subdirectory(solc)
add_subdirectory(liblll)
add_subdirectory(lllc)
endif()
Expand Down
28 changes: 28 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
### 0.4.20 (2018-02-14)

Features:
* Code Generator: Prevent non-view functions in libraries from being called
directly (as opposed to via delegatecall).
* Commandline interface: Support strict mode of assembly (disallowing jumps,
instructional opcodes, etc) with the ``--strict-assembly`` switch.
* Inline Assembly: Issue warning for using jump labels (already existed for jump instructions).
* Inline Assembly: Support some restricted tokens (return, byte, address) as identifiers in Iulia mode.
* Optimiser: Replace ``x % 2**i`` by ``x & (2**i-1)``.
* Resolver: Continue resolving references after the first error.
* Resolver: Suggest alternative identifiers if a given identifier is not found.
* SMT Checker: Take if-else branch conditions into account in the SMT encoding of the program
variables.
* Syntax Checker: Deprecate the ``var`` keyword (and mark it an error as experimental 0.5.0 feature).
* Type Checker: Allow `this.f.selector` to be a pure expression.
* Type Checker: Issue warning for using ``public`` visibility for interface functions.
* Type Checker: Limit the number of warnings raised for creating abstract contracts.

Bugfixes:
* Error Output: Truncate huge number literals in the middle to avoid output blow-up.
* Parser: Disallow event declarations with no parameter list.
* Standard JSON: Populate the ``sourceLocation`` field in the error list.
* Standard JSON: Properly support contract and library file names containing a colon (such as URLs).
* Type Checker: Suggest the experimental ABI encoder if using ``struct``s as function parameters
(instead of an internal compiler error).
* Type Checker: Improve error message for wrong struct initialization.

### 0.4.19 (2017-11-30)

Features:
Expand Down
132 changes: 113 additions & 19 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,144 @@
version: 2
jobs:
build:
build_emscripten:
docker:
- image: trzeci/emscripten:sdk-tag-1.37.21-64bit
steps:
- checkout
- run:
name: Init submodules
command: |
git submodule update --init
- restore_cache:
name: Restore Boost build
key: &boost-cache-key emscripten-boost-{{ checksum "scripts/travis-emscripten/install_deps.sh" }}{{ checksum "scripts/travis-emscripten/build_emscripten.sh" }}
- run:
name: Bootstrap Boost
command: |
scripts/travis-emscripten/install_deps.sh
- run:
name: Build
command: |
scripts/travis-emscripten/build_emscripten.sh
- save_cache:
name: Save Boost build
key: *boost-cache-key
paths:
- boost_1_57_0
- store_artifacts:
path: build/libsolc/soljson.js
destination: soljson.js
- run: mkdir -p workspace
- run: cp build/libsolc/soljson.js workspace/soljson.js
- run: scripts/get_version.sh > workspace/version.txt
- persist_to_workspace:
root: workspace
paths:
- soljson.js
- version.txt
test_emscripten_solcjs:
docker:
- image: trzeci/emscripten:sdk-tag-1.37.21-64bit
steps:
- checkout
- attach_workspace:
at: /tmp/workspace
- run:
name: Install external tests deps
command: |
apt-get -qq update
apt-get -qy install netcat curl
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.4/install.sh | NVM_DIR=/usr/local/nvm bash
export NVM_DIR="/usr/local/nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
nvm --version
nvm install 6
node --version
npm --version
- run:
name: Test solcjs
command: |
. /usr/local/nvm/nvm.sh
test/solcjsTests.sh /tmp/workspace/soljson.js $(cat /tmp/workspace/version.txt)
test_emscripten_external:
docker:
- image: trzeci/emscripten:sdk-tag-1.37.21-64bit
steps:
- checkout
- attach_workspace:
at: /tmp/workspace
- run:
name: Test external tests deps
name: Install external tests deps
command: |
apt-get -qq update
apt-get -qy install netcat curl
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.4/install.sh | NVM_DIR=/usr/local/nvm bash
export NVM_DIR="/usr/local/nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
nvm --version
nvm install 6
nvm install 7
node --version
npm --version
- run:
name: External tests
command: |
. /usr/local/nvm/nvm.sh
test/externalTests.sh /tmp/workspace/soljson.js
build_x86:
docker:
- image: buildpack-deps:artful
steps:
- checkout
- run:
name: Install build dependencies
command: |
apt-get -qq update
apt-get -qy install ccache cmake libboost-all-dev libz3-dev
- run:
name: Init submodules
command: |
git submodule update --init
- restore_cache:
name: Restore Boost build
key: &boost-cache-key emscripten-boost-{{ checksum "scripts/travis-emscripten/install_deps.sh" }}{{ checksum "scripts/travis-emscripten/build_emscripten.sh" }}
- run:
name: Bootstrap Boost
name: Store commit hash and prerelease
command: |
scripts/travis-emscripten/install_deps.sh
date -u +"nightly.%Y.%-m.%-d" > prerelease.txt
echo -n "$CIRCLE_SHA1" > commit_hash.txt
- restore_cache:
key: ccache-{{ arch }}-{{ .Branch }}
key: ccache-{{ arch }}
key: ccache
- run:
name: Build
command: |
scripts/travis-emscripten/build_emscripten.sh
command: ./scripts/build.sh RelWithDebInfo
- save_cache:
name: Save Boost build
key: *boost-cache-key
key: ccache-{{ arch }}-{{ .Branch }}
paths:
- boost_1_57_0
- ~/.ccache
- run:
name: Test
command: |
. /usr/local/nvm/nvm.sh
scripts/test_emscripten.sh
name: Commandline tests
command: test/cmdlineTests.sh
- run: mkdir -p test_results
- run:
name: Test without optimizer (exclude IPC tests)
command: build/test/soltest --logger=JUNIT,test_suite,test_results/no_opt.xml -- --no-ipc
- run:
name: Test with optimizer (exclude IPC tests)
command: build/test/soltest --logger=JUNIT,test_suite,test_results/opt.xml -- --optimize --no-ipc
- store_test_results:
path: test_results/
- store_artifacts:
path: build/solc/soljson.js
destination: soljson.js
path: build/solc/solc
destination: solc

workflows:
version: 2
build_all:
jobs:
- build_emscripten
- test_emscripten_solcjs:
requires:
- build_emscripten
- test_emscripten_external:
requires:
- build_emscripten
- build_x86
13 changes: 10 additions & 3 deletions cmake/EthCompilerSettings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,15 @@ if (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MA
# testing on at least OS X and Ubuntu.
add_compile_options(-Wno-unused-function)
add_compile_options(-Wno-dangling-else)


if ("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
# Set stack size to 16MB - by default Apple's clang defines a stack size of 8MB, some tests require more.
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-stack_size -Wl,0x1000000")
endif()

# Some Linux-specific Clang settings. We don't want these for OS X.
if ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")

# TODO - Is this even necessary? Why?
# See http://stackoverflow.com/questions/19774778/when-is-it-necessary-to-use-use-the-flag-stdlib-libstdc.
add_compile_options(-stdlib=libstdc++)
Expand All @@ -115,7 +120,7 @@ if (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MA
endif()

if (EMSCRIPTEN)
# Do emit a separate memory initialiser file
# Do not emit a separate memory initialiser file
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --memory-init-file 0")
# Leave only exported symbols as public and agressively remove others
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdata-sections -ffunction-sections -Wl,--gc-sections -fvisibility=hidden")
Expand All @@ -133,6 +138,8 @@ if (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MA
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s ALLOW_MEMORY_GROWTH=1")
# Disable eval()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s NO_DYNAMIC_EXECUTION=1")
# Disable greedy exception catcher
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s NODEJS_CATCH_EXIT=0")
add_definitions(-DETH_EMSCRIPTEN=1)
endif()
endif()
Expand Down
30 changes: 18 additions & 12 deletions docs/abi-spec.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,21 @@ The following elementary types exist:

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

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

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

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

- ``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)``.

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

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

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

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

The following (fixed-size) array type exists:

Expand Down Expand Up @@ -187,12 +187,12 @@ Given the contract:

::

pragma solidity ^0.4.0;
pragma solidity ^0.4.16;

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


Expand Down Expand Up @@ -288,6 +288,8 @@ In effect, a log entry using this ABI is described as:
- ``topics[n]``: ``EVENT_INDEXED_ARGS[n - 1]`` (``EVENT_INDEXED_ARGS`` is the series of ``EVENT_ARGS`` that are indexed);
- ``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).

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.

JSON
====

Expand Down Expand Up @@ -333,10 +335,10 @@ For example,
pragma solidity ^0.4.0;

contract Test {
function Test(){ b = 0x12345678901234567890123456789012; }
function Test() public { b = 0x12345678901234567890123456789012; }
event Event(uint indexed a, bytes32 b);
event Event2(uint indexed a, bytes32 b);
function foo(uint a) { Event(a, b); }
function foo(uint a) public { Event(a, b); }
bytes32 b;
}

Expand Down Expand Up @@ -377,10 +379,14 @@ As an example, the code

::

pragma solidity ^0.4.19;
pragma experimental ABIEncoderV2;

contract Test {
struct S { uint a; uint[] b; T[] c; }
struct T { uint x; uint y; }
function f(S s, T t, uint a) { }
function f(S s, T t, uint a) public { }
function g() public returns (S s, T t, uint a) {}
}

would result in the JSON:
Expand Down
Loading

0 comments on commit 3155dd8

Please sign in to comment.