Skip to content

Commit

Permalink
Merge pull request #4148 from ethereum/develop
Browse files Browse the repository at this point in the history
Merge develop into release for 0.4.24
  • Loading branch information
chriseth authored May 16, 2018
2 parents 124ca40 + 1e45d3a commit e67f014
Show file tree
Hide file tree
Showing 254 changed files with 4,902 additions and 1,598 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ before_script:
&& scripts/create_source_tarball.sh)

script:
- test $SOLC_EMSCRIPTEN != On || (scripts/test_emscripten.sh)
- test $SOLC_EMSCRIPTEN != On -o $SOLC_TESTS != On || (scripts/test_emscripten.sh)
- test $SOLC_TESTS != On || (cd $TRAVIS_BUILD_DIR && scripts/tests.sh)
- test $SOLC_STOREBYTECODE != On || (cd $TRAVIS_BUILD_DIR && scripts/bytecodecompare/storebytecode.sh)

Expand Down
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ include(EthPolicy)
eth_policy()

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

option(SOLC_LINK_STATIC "Link solc executable statically on supported platforms" OFF)
Expand All @@ -21,6 +21,7 @@ include(EthCcache)
# Let's find our dependencies
include(EthDependencies)
include(jsoncpp)
include_directories(SYSTEM ${JSONCPP_INCLUDE_DIR})

find_package(Threads)

Expand Down
19 changes: 13 additions & 6 deletions CODING_STYLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,28 @@ cout << "some very long string that contains completely irrelevant text that tal
## 1. Namespaces
1. No `using namespace` declarations in header files.
2. All symbols should be declared in a namespace except for final applications.
3. Use anonymous namespaces for helpers whose scope is a cpp file only.
4. Preprocessor symbols should be prefixed with the namespace in all-caps and an underscore.
2. Use `using namespace std;` in cpp files, but avoid importing namespaces from boost and others.
3. All symbols should be declared in a namespace except for final applications.
4. Use anonymous namespaces for helpers whose scope is a cpp file only.
5. Preprocessor symbols should be prefixed with the namespace in all-caps and an underscore.
Yes:
Only in the header:
```cpp
#include <cassert>
namespace myNamespace
{
std::tuple<float, float> meanAndSigma(std::vector<float> const& _v);
}
```

No:
Only in the cpp file:
```cpp
#include <cassert>
using namespace std;
tuple<float, float> meanAndSigma(vector<float> const& _v);
tuple<float, float> myNamespace::meanAndSigma(vector<float> const& _v)
{
// ...
}
```
## 2. Preprocessor
Expand Down
27 changes: 27 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
### 0.4.24 (2018-05-16)

Language Features:
* Code Generator: Use native shift instructions on target Constantinople.
* General: Allow multiple variables to be declared as part of a tuple assignment, e.g. ``(uint a, uint b) = ...``.
* General: Remove deprecated ``constant`` as function state modifier from documentation and tests (but still leave it as a valid feature).
* Type Checker: Deprecate the ``years`` unit denomination and raise a warning for it (or an error as experimental 0.5.0 feature).
* Type Checker: Make literals (without explicit type casting) an error for tight packing as experimental 0.5.0 feature.
* Type Checker: Warn about wildcard tuple assignments (this will turn into an error with version 0.5.0).
* Type Checker: Warn when ``keccak256``, ``sha256`` and ``ripemd160`` are not used with a single bytes argument (suggest to use ``abi.encodePacked(...)``). This will turn into an error with version 0.5.0.

Compiler Features:
* Build System: Update internal dependency of jsoncpp to 1.8.4, which introduces more strictness and reduces memory usage.
* Control Flow Graph: Add Control Flow Graph as analysis structure.
* Control Flow Graph: Warn about returning uninitialized storage pointers.
* Gas Estimator: Only explore paths with higher gas costs. This reduces accuracy but greatly improves the speed of gas estimation.
* Optimizer: Remove unnecessary masking of the result of known short instructions (``ADDRESS``, ``CALLER``, ``ORIGIN`` and ``COINBASE``).
* Parser: Display nicer error messages by showing the actual tokens and not internal names.
* Parser: Use the entire location of the token instead of only its starting position as source location for parser errors.
* SMT Checker: Support state variables of integer and bool type.

Bugfixes:
* Code Generator: Fix ``revert`` with reason coming from a state or local string variable.
* Type Checker: Show proper error when trying to ``emit`` a non-event.
* Type Checker: Warn about empty tuple components (this will turn into an error with version 0.5.0).
* Type Checker: The ABI encoding functions are pure and thus can be used for constants.

### 0.4.23 (2018-04-19)

Features:
Expand Down
9 changes: 6 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ branches:
only:
- release
- develop
os: Visual Studio 2015
configuration:
- RelWithDebInfo
environment:
matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
# This is used for pushing to solidity-test-bytecodes
priv_key:
secure: yYGwg4rhCdHfwuv2mFjaNEDwAx3IKUbp0D5fMGpaKefnfk+BiMS5bqSHRiOj91PZ91P9pUk2Vu+eNuS4hTFCf1zFGfrOhlJ4Ij0xSyU5m/LQr590Mo+f7W94Xc8ubgo6j2hp9qH/szTqTzmAkmxKO5TLlWjVzVny2t/s5o5UprLS1/MdzDNLjpVNXR03oKfdWUV9a2l6+PejXCbqyUCagh6BByZqeAPbDcil6eAfxu4EPX83Fuurof+KqFzIWycBG5qK1pTipn2pxiA0QKuUrD8y8VNL0S23NTgxoxSp7nPVMd3K0qRSzPM5lrqS7Z8i3evkVwPbuhu0gSiV08jGVahH2snQ3JGYsH2D4KmVn/xiVBeJ0lRplYlfZF0GUu7iJ+DDxi6wBPhW9A25/NyD/mx7Ub2dLheyWi8AjdSCzhfRD+4We8FQQeHRo3Q0kAohFmlCXdXhrcwOOloId8r6xYwg+hWxHTt2Oe9CKwXfmiPjgl/Gd6lYgLpyyfJ8drQ6tjO/pybLEa10v74qYNdVW5LaLIsRUM9Jm/FDVTrOGYtPndi87mF+/tBJIaXXNz0EMl5xvsKW0SBfUMV49zoDDKZZgWyO9U/cfViEUi7Sdn9QLsBWLZfSgBQNkq3WGZVKPq58OxEWT9dUghQHlSVh2qWF/NUx0TRBjiJl9JM56ENTMD00y18eDcXNCeLLVYB+R1axabUPdXivrO+BrWQK94IWxKEJ+YYN8WVJWAO5T/EBDKw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ZMF5zsbWZYFpc9ef3llF5aRcuD90JWT2VC7rB2jeGEtiwGkDlqKzxqRvJk06wTK6+n5RncN66bDaksulOPJMAR/bRW7dinV8T6yIvybuhqDetxJQP6eyAnW4xr1YxIAG4BXGZV6XAPTgOG2oGvMdncxkcLQHXVu07x39ySqP/m2MBxn0zF3DmaqrSPIRMhS8gG3d/23Jux3YHDEOBHjdJSdwqs5F5+QBFPV2rmJnpcSoW4d3M119XI20L914c62R7wY4e6+qmi3ydQU9g6p8psZgaE3TuMsyzX3k4C30nC/3gWT+zl253NjZwfbzIdHu5LWNDY9kEHtKzLP
Expand Down Expand Up @@ -62,11 +64,12 @@ install:
before_build:
- if not exist build mkdir build
- cd build
- cmake -G "Visual Studio 14 2015 Win64" .. -DTESTS=On
- if "%APPVEYOR_BUILD_WORKER_IMAGE%" == "Visual Studio 2015" ( cmake -G "Visual Studio 14 2015 Win64" .. -DTESTS=On )
else ( cmake -G "Visual Studio 15 2017 Win64" .. -DTESTS=On )
build_script:
- msbuild solidity.sln /p:Configuration=%CONFIGURATION% /m:%NUMBER_OF_PROCESSORS% /v:minimal
- cd %APPVEYOR_BUILD_FOLDER%
- scripts\release.bat %CONFIGURATION%
- if "%APPVEYOR_BUILD_WORKER_IMAGE%" == "Visual Studio 2017" ( scripts\release.bat %CONFIGURATION% 2017 )
- ps: $bytecodedir = git show -s --format="%cd-%H" --date=short

test_script:
Expand Down
120 changes: 89 additions & 31 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,38 @@ defaults:
filters:
tags:
only: /.*/
- setup_prerelease_commit_hash: &setup_prerelease_commit_hash
name: Store commit hash and prerelease
command: |
if [ "$CIRCLE_BRANCH" = release -o -n "$CIRCLE_TAG" ]; then echo -n > prerelease.txt; else date -u +"nightly.%Y.%-m.%-d" > prerelease.txt; fi
echo -n "$CIRCLE_SHA1" > commit_hash.txt
- run_build: &run_build
name: Build
command: |
mkdir -p build
cd build
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo
make -j4
- run_tests: &run_tests
name: Tests
command: scripts/tests.sh --junit_report test_results
- solc_artifact: &solc_artifact
path: build/solc/solc
destination: solc
- all_artifacts: &all_artifacts
root: build
paths:
- solc/solc
- test/soltest
- test/tools/solfuzzer

version: 2
jobs:
build_emscripten:
docker:
- image: trzeci/emscripten:sdk-tag-1.37.21-64bit
environment:
TERM: xterm
steps:
- checkout
- restore_cache:
Expand Down Expand Up @@ -42,6 +68,8 @@ jobs:
test_emscripten_solcjs:
docker:
- image: trzeci/emscripten:sdk-tag-1.37.21-64bit
environment:
TERM: xterm
steps:
- checkout
- attach_workspace:
Expand All @@ -66,6 +94,8 @@ jobs:
test_emscripten_external:
docker:
- image: trzeci/emscripten:sdk-tag-1.37.21-64bit
environment:
TERM: xterm
steps:
- checkout
- attach_workspace:
Expand All @@ -87,41 +117,49 @@ jobs:
command: |
. /usr/local/nvm/nvm.sh
test/externalTests.sh /tmp/workspace/soljson.js || test/externalTests.sh /tmp/workspace/soljson.js
build_x86:
build_x86_linux:
docker:
- image: buildpack-deps:artful
environment:
TERM: xterm
steps:
- checkout
- run:
name: Install build dependencies
command: |
apt-get -qq update
apt-get -qy install cmake libboost-regex-dev libboost-filesystem-dev libboost-test-dev libboost-system-dev libboost-program-options-dev libz3-dev
- run: *setup_prerelease_commit_hash
- run: *run_build
- store_artifacts: *solc_artifact
- persist_to_workspace: *all_artifacts

build_x86_mac:
macos:
xcode: "9.0"
environment:
TERM: xterm
steps:
- checkout
- run:
name: Store commit hash and prerelease
command: |
if [ "$CIRCLE_BRANCH" = release -o -n "$CIRCLE_TAG" ]; then echo -n > prerelease.txt; else date -u +"nightly.%Y.%-m.%-d" > prerelease.txt; fi
echo -n "$CIRCLE_SHA1" > commit_hash.txt
- run:
name: Build
name: Install build dependencies
command: |
mkdir -p build
cd build
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo
make -j4
- store_artifacts:
path: build/solc/solc
destination: solc
- persist_to_workspace:
root: build
paths:
- solc/solc
- test/soltest
- test/tools/solfuzzer
brew update
brew upgrade
brew unlink python
brew install z3
brew install boost
brew install cmake
- run: *setup_prerelease_commit_hash
- run: *run_build
- store_artifacts: *solc_artifact
- persist_to_workspace: *all_artifacts

test_x86:
test_x86_linux:
docker:
- image: buildpack-deps:artful
environment:
TERM: xterm
steps:
- checkout
- attach_workspace:
Expand All @@ -132,9 +170,28 @@ jobs:
apt-get -qq update
apt-get -qy install libz3-dev libleveldb1v5
- run: mkdir -p test_results
- run: *run_tests
- store_test_results:
path: test_results/

test_x86_mac:
macos:
xcode: "9.0"
environment:
TERM: xterm
steps:
- checkout
- attach_workspace:
at: build
- run:
name: Tests
command: scripts/tests.sh --junit_report test_results
name: Install dependencies
command: |
brew update
brew upgrade
brew unlink python
brew install z3
- run: mkdir -p test_results
- run: *run_tests
- store_test_results:
path: test_results/

Expand All @@ -148,11 +205,7 @@ jobs:
command: |
apt-get -qq update
apt-get -qy install python-sphinx
- run:
name: Store commit hash and prerelease
command: |
if [ "$CIRCLE_BRANCH" = release -o -n "$CIRCLE_TAG" ]; then echo -n > prerelease.txt; else date -u +"nightly.%Y.%-m.%-d" > prerelease.txt; fi
echo -n "$CIRCLE_SHA1" > commit_hash.txt
- run: *setup_prerelease_commit_hash
- run:
name: Build documentation
command: ./scripts/docs.sh
Expand All @@ -173,9 +226,14 @@ workflows:
<<: *build_on_tags
requires:
- build_emscripten
- build_x86: *build_on_tags
- test_x86:
- build_x86_linux: *build_on_tags
- build_x86_mac: *build_on_tags
- test_x86_linux:
<<: *build_on_tags
requires:
- build_x86_linux
- test_x86_mac:
<<: *build_on_tags
requires:
- build_x86
- build_x86_mac
- docs: *build_on_tags
5 changes: 3 additions & 2 deletions cmake/EthCompilerSettings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ if (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MA
# Additional Clang-specific compiler settings.
elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
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")
# Set stack size to 32MB - by default Apple's clang defines a stack size of 8MB.
# Normally 16MB is enough to run all tests, but it will exceed the stack, if -DSANITIZE=address is used.
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-stack_size -Wl,0x2000000")
endif()

# Some Linux-specific Clang settings. We don't want these for OS X.
Expand Down
22 changes: 10 additions & 12 deletions cmake/jsoncpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,15 @@ else()
set(JSONCPP_CMAKE_COMMAND ${CMAKE_COMMAND})
endif()

# Disable implicit fallthrough warning in jsoncpp for gcc >= 7 until the upstream handles it properly
if (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0)
set(JSONCCP_EXTRA_FLAGS -Wno-implicit-fallthrough)
else()
set(JSONCCP_EXTRA_FLAGS "")
endif()

include(GNUInstallDirs)
set(prefix "${CMAKE_BINARY_DIR}/deps")
set(JSONCPP_LIBRARY "${prefix}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}jsoncpp${CMAKE_STATIC_LIBRARY_SUFFIX}")
set(JSONCPP_LIBRARY "${prefix}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}jsoncpp${CMAKE_STATIC_LIBRARY_SUFFIX}")
set(JSONCPP_INCLUDE_DIR "${prefix}/include")

if(NOT MSVC)
set(JSONCPP_EXTRA_FLAGS "-std=c++11")
endif()

set(byproducts "")
if(CMAKE_VERSION VERSION_GREATER 3.1)
set(byproducts BUILD_BYPRODUCTS "${JSONCPP_LIBRARY}")
Expand All @@ -25,9 +23,9 @@ endif()
ExternalProject_Add(jsoncpp-project
PREFIX "${prefix}"
DOWNLOAD_DIR "${CMAKE_SOURCE_DIR}/deps/downloads"
DOWNLOAD_NAME jsoncpp-1.7.7.tar.gz
URL https://github.com/open-source-parsers/jsoncpp/archive/1.7.7.tar.gz
URL_HASH SHA256=087640ebcf7fbcfe8e2717a0b9528fff89c52fcf69fa2a18cc2b538008098f97
DOWNLOAD_NAME jsoncpp-1.8.4.tar.gz
URL https://github.com/open-source-parsers/jsoncpp/archive/1.8.4.tar.gz
URL_HASH SHA256=c49deac9e0933bcb7044f08516861a2d560988540b23de2ac1ad443b219afdb6
CMAKE_COMMAND ${JSONCPP_CMAKE_COMMAND}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
Expand All @@ -36,7 +34,7 @@ ExternalProject_Add(jsoncpp-project
-DCMAKE_POSITION_INDEPENDENT_CODE=${BUILD_SHARED_LIBS}
-DJSONCPP_WITH_TESTS=OFF
-DJSONCPP_WITH_PKGCONFIG_SUPPORT=OFF
-DCMAKE_CXX_FLAGS=${JSONCCP_EXTRA_FLAGS}
-DCMAKE_CXX_FLAGS=${JSONCPP_EXTRA_FLAGS}
# Overwrite build and install commands to force Release build on MSVC.
BUILD_COMMAND cmake --build <BINARY_DIR> --config Release
INSTALL_COMMAND cmake --build <BINARY_DIR> --config Release --target install
Expand Down
Loading

0 comments on commit e67f014

Please sign in to comment.