Skip to content

Commit

Permalink
Merge pull request ethereum#5836 from ethereum/develop
Browse files Browse the repository at this point in the history
Merge develop into release for 0.5.3.
  • Loading branch information
chriseth committed Jan 22, 2019
2 parents 1df8f40 + 0ecafe0 commit 10d17f2
Show file tree
Hide file tree
Showing 388 changed files with 10,085 additions and 5,733 deletions.
16 changes: 9 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ version: 2
jobs:
build_emscripten:
docker:
- image: trzeci/emscripten:sdk-tag-1.37.21-64bit
- image: trzeci/emscripten:sdk-tag-1.38.22-64bit
environment:
TERM: xterm
steps:
- checkout
- 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" }}
key: &boost-cache-key emscripten-boost-{{ checksum "scripts/travis-emscripten/install_deps.sh" }}{{ checksum "scripts/build_emscripten.sh" }}{{ checksum "scripts/travis-emscripten/build_emscripten.sh" }}
- run:
name: Bootstrap Boost
command: |
Expand All @@ -54,7 +54,7 @@ jobs:
name: Save Boost build
key: *boost-cache-key
paths:
- boost_1_67_0
- boost_1_68_0
- store_artifacts:
path: build/libsolc/soljson.js
destination: soljson.js
Expand Down Expand Up @@ -104,7 +104,7 @@ jobs:
test/externalTests.sh /tmp/workspace/soljson.js || test/externalTests.sh /tmp/workspace/soljson.js
build_x86_linux:
docker:
- image: buildpack-deps:artful
- image: buildpack-deps:bionic
environment:
TERM: xterm
COVERAGE: "ON"
Expand Down Expand Up @@ -212,7 +212,7 @@ jobs:

test_check_style:
docker:
- image: buildpack-deps:artful
- image: buildpack-deps:bionic
steps:
- checkout
- run:
Expand All @@ -238,7 +238,7 @@ jobs:

test_x86_linux:
docker:
- image: buildpack-deps:artful
- image: buildpack-deps:bionic
environment:
TERM: xterm
steps:
Expand Down Expand Up @@ -315,7 +315,9 @@ jobs:

docs:
docker:
- image: buildpack-deps:artful
- image: buildpack-deps:bionic
environment:
DEBIAN_FRONTEND: noninteractive
steps:
- checkout
- run:
Expand Down
14 changes: 12 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,24 @@ matrix:
before_install:
- nvm install 8
- nvm use 8
- docker pull trzeci/emscripten:sdk-tag-1.37.21-64bit
- docker pull trzeci/emscripten:sdk-tag-1.38.22-64bit
env:
- SOLC_EMSCRIPTEN=On
- SOLC_INSTALL_DEPS_TRAVIS=Off
- SOLC_RELEASE=Off
- SOLC_TESTS=Off
- ZIP_SUFFIX=emscripten
- SOLC_STOREBYTECODE=On
# Travis doesn't seem to support "dynamic" cache keys where we could include
# the hashes of certain files. Our CircleCI configuration contains the hash of
# relevant emscripten files.
#
# It is important to invalidate the cache with each emscripten update, because
# dependencies, such as boost, might be broken otherwise.
#
# This key here has no significant on anything, apart from caching. Please keep
# it in sync with the version above.
- EMSCRIPTEN_VERSION_KEY="1.38.22"

# OS X Mavericks (10.9)
# https://en.wikipedia.org/wiki/OS_X_Mavericks
Expand Down Expand Up @@ -177,7 +187,7 @@ git:
cache:
ccache: true
directories:
- boost_1_67_0
- boost_1_68_0
- $HOME/.local

install:
Expand Down
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ cmake_minimum_required(VERSION 3.0.0)
set(ETH_CMAKE_DIR "${CMAKE_CURRENT_LIST_DIR}/cmake" CACHE PATH "The the path to the cmake directory")
list(APPEND CMAKE_MODULE_PATH ${ETH_CMAKE_DIR})

include(EthToolchains)

# Set cmake_policies
include(EthPolicy)
eth_policy()

# project name and version should be set after cmake_policy CMP0048
set(PROJECT_VERSION "0.5.2")
project(solidity VERSION ${PROJECT_VERSION})
set(PROJECT_VERSION "0.5.3")
project(solidity VERSION ${PROJECT_VERSION} LANGUAGES CXX)

option(LLL "Build LLL" OFF)
option(SOLC_LINK_STATIC "Link solc executable statically on supported platforms" OFF)
Expand Down
25 changes: 25 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
### 0.5.3 (2019-01-22)

Language Features:
* Provide access to creation and runtime code of contracts via ``type(C).creationCode`` / ``type(C).runtimeCode``.


Compiler Features:
* Control Flow Graph: Warn about unreachable code.
* SMTChecker: Support basic typecasts without truncation.
* SMTChecker: Support external function calls and erase all knowledge regarding storage variables and references.


Bugfixes:
* Emscripten: Split simplification rule initialization up further to work around issues with soljson.js in some browsers.
* Type Checker: Disallow calldata structs until implemented.
* Type Checker: Return type error if fixed point encoding is attempted instead of throwing ``UnimplementedFeatureError``.
* Yul: Check that arguments to ``dataoffset`` and ``datasize`` are literals at parse time and properly take this into account in the optimizer.
* Yul: Parse number literals for detecting duplicate switch cases.
* Yul: Require switch cases to have the same type.


Build System:
* Emscripten: Upgrade to emscripten 1.38.8 on travis and circleci.


### 0.5.2 (2018-12-19)

Language Features:
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ that run on the Ethereum Virtual Machine. Smart contracts are programs that are
network where nobody has special authority over the execution and thus they allow to implement tokens of value,
ownership, voting and other kinds of logics.

When deploying contracts, you should use the latest released version of Solidity. This is because breaking changes as well as new features and bug fixes are introduced regularly. We currently use a 0.x version number [to indicate this fast pace of change](https://semver.org/#spec-item-4).

## Build and Install

Instructions about how to build and install the Solidity compiler can be found in the [Solidity documentation](https://solidity.readthedocs.io/en/latest/installing-solidity.html#building-from-source)
Expand All @@ -29,7 +31,7 @@ Instructions about how to build and install the Solidity compiler can be found i
A "Hello World" program in Solidity is of even less use than in other languages, but still:

```
pragma solidity ^0.4.16;
pragma solidity ^0.5.0;
contract HelloWorld {
function helloWorld() external pure returns (string memory) {
Expand Down
8 changes: 5 additions & 3 deletions ReleaseChecklist.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ Checklist for making a release:
- [ ] Check that all issues and pull requests from the Github project to be released are merged to ``develop``.
- [ ] Create a commit in ``develop`` that updates the ``Changelog`` to include a release date (run ``./scripts/tests.sh`` to update the bug list). Sort the changelog entries alphabetically and correct any errors you notice.
- [ ] Create a pull request and wait for the tests, merge it.
- [ ] Thank voluntary contributors in the Github release page (use ``git shortlog -s -n -e origin/release..origin/develop``).
- [ ] Create a pull request from ``develop`` to ``release``, wait for the tests, then merge it.
- [ ] Make a final check that there are no platform-dependency issues in the ``solc-test-bytecode`` repository.
- [ ] Make a final check that there are no platform-dependency issues in the ``solidity-test-bytecode`` repository.
- [ ] Wait for the tests for the commit on ``release``, create a release in Github, creating the tag.
- [ ] Thank voluntary contributors in the Github release page (use ``git shortlog -s -n -e origin/release..origin/develop``).
- [ ] Wait for the CI runs on the tag itself (they should push artifacts onto the Github release page).
- [ ] Run ``scripts/create_source_tarball.sh`` while being on the tag to create the source tarball.
- [ ] Upload the source tarball (in the upload directory) to the release page.
- [ ] Run ``scripts/release_ppa.sh release`` to create the PPA release (you need the relevant openssl key).
- [ ] Once the ``~ethereum/ubuntu/ethereum-static`` PPA build is finished and published for all platforms (make sure not to do this earlier), copy the static package to the ``~ethereum/ubuntu/ethereum`` PPA for the destination series ``Trusty`` while selecting ``Copy existing binaries``.
- [ ] Once the ``~ethereum/ubuntu/ethereum-static`` PPA build is finished and published for all platforms (make sure not to do this earlier), copy the static package to the ``~ethereum/ubuntu/ethereum`` PPA for the destination series ``Trusty`` and ``Xenial`` while selecting ``Copy existing binaries``.
- [ ] Check that the Docker release was pushed to Docker Hub (this still seems to have problems, run ``./scripts/docker_deploy_manual.sh release``).
- [ ] Update the homebrew realease in https://github.com/ethereum/homebrew-ethereum/blob/master/solidity.rb (version and hash)
- [ ] Update the default version on readthedocs.
Expand Down
19 changes: 9 additions & 10 deletions cmake/EthCompilerSettings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ endif()
eth_add_cxx_compiler_flag_if_supported(-Wimplicit-fallthrough)

if (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang"))

# Use ISO C++14 standard language.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")

# Enables all the warnings about constructions that some users consider questionable,
# and that are easy to avoid. Also enable some extra warning flags that are not
# enabled by -Wall. Finally, treat at warnings-as-errors, which forces developers
Expand Down Expand Up @@ -78,10 +74,8 @@ if (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MA
# into errors, which makes sense.
# http://stackoverflow.com/questions/21617158/how-to-silence-unused-command-line-argument-error-with-clang-without-disabling-i
add_compile_options(-Qunused-arguments)
endif()

if (EMSCRIPTEN)
# Do not emit a separate memory initialiser file
elseif(EMSCRIPTEN)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --memory-init-file 0")
# Leave only exported symbols as public and aggressively remove others
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdata-sections -ffunction-sections -Wl,--gc-sections -fvisibility=hidden")
Expand All @@ -104,7 +98,13 @@ if (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MA
# Abort if linking results in any undefined symbols
# Note: this is on by default in the CMake Emscripten module which we aren't using
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s ERROR_ON_UNDEFINED_SYMBOLS=1")
add_definitions(-DETH_EMSCRIPTEN=1)
# Disallow deprecated emscripten build options.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s STRICT=1")
# Export the Emscripten-generated auxiliary methods which are needed by solc-js.
# Which methods of libsolc itself are exported is specified in libsolc/CMakeLists.txt.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s EXTRA_EXPORTED_RUNTIME_METHODS=['cwrap','addFunction','removeFunction','Pointer_stringify','lengthBytesUTF8','_malloc','stringToUTF8','setValue']")
# Do not build as a WebAssembly target - we need an asm.js output.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s WASM=0")
endif()
endif()

Expand Down Expand Up @@ -166,9 +166,8 @@ option(USE_CVC4 "Allow compiling with CVC4 SMT solver integration" ON)
if (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang"))
option(USE_LD_GOLD "Use GNU gold linker" ON)
if (USE_LD_GOLD)
execute_process(COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -fuse-ld=gold -Wl,--version ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
if ("${LD_VERSION}" MATCHES "GNU gold")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fuse-ld=gold")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=gold")
endif ()
endif ()
Expand Down
5 changes: 4 additions & 1 deletion cmake/EthDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ function(eth_show_dependency DEP NAME)
get_property(DISPLAYED GLOBAL PROPERTY ETH_${DEP}_DISPLAYED)
if (NOT DISPLAYED)
set_property(GLOBAL PROPERTY ETH_${DEP}_DISPLAYED TRUE)
if (NOT("${${DEP}_VERSION}" STREQUAL ""))
message(STATUS "${NAME} version: ${${DEP}_VERSION}")
endif()
message(STATUS "${NAME} headers: ${${DEP}_INCLUDE_DIRS}")
message(STATUS "${NAME} lib : ${${DEP}_LIBRARIES}")
if (NOT("${${DEP}_DLLS}" STREQUAL ""))
Expand Down Expand Up @@ -38,6 +41,6 @@ set(ETH_SCRIPTS_DIR ${ETH_CMAKE_DIR}/scripts)
set(Boost_USE_MULTITHREADED ON)
option(Boost_USE_STATIC_LIBS "Link Boost statically" ON)

find_package(Boost 1.54.0 QUIET REQUIRED COMPONENTS regex filesystem unit_test_framework program_options system)
find_package(Boost 1.65.0 QUIET REQUIRED COMPONENTS regex filesystem unit_test_framework program_options system)

eth_show_dependency(Boost boost)
8 changes: 8 additions & 0 deletions cmake/EthToolchains.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
if(NOT CMAKE_TOOLCHAIN_FILE)
# Use default toolchain file if none is provided.
set(
CMAKE_TOOLCHAIN_FILE
"${CMAKE_CURRENT_LIST_DIR}/toolchains/default.cmake"
CACHE FILEPATH "The CMake toolchain file"
)
endif()
1 change: 0 additions & 1 deletion cmake/jsoncpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ ExternalProject_Add(jsoncpp-project
URL_HASH SHA256=c49deac9e0933bcb7044f08516861a2d560988540b23de2ac1ad443b219afdb6
CMAKE_COMMAND ${JSONCPP_CMAKE_COMMAND}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_INSTALL_LIBDIR=lib
# Build static lib but suitable to be included in a shared lib.
Expand Down
4 changes: 4 additions & 0 deletions cmake/toolchains/default.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Require C++14.
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
set(CMAKE_CXX_EXTENSIONS OFF)
2 changes: 2 additions & 0 deletions cmake/toolchains/emscripten.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include("${CMAKE_CURRENT_LIST_DIR}/default.cmake")
include("$ENV{EMSCRIPTEN}/cmake/Modules/Platform/Emscripten.cmake")
10 changes: 5 additions & 5 deletions docs/050-breaking-changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ Command Line and JSON Interfaces
the first 36 hex characters of the keccak256 hash of the fully qualified
library name, surrounded by ``$...$``. Previously,
just the fully qualified library name was used.
This recudes the chances of collisions, especially when long paths are used.
This reduces the chances of collisions, especially when long paths are used.
Binary files now also contain a list of mappings from these placeholders
to the fully qualified names.

Expand Down Expand Up @@ -308,7 +308,7 @@ This will no longer compile with Solidity v0.5.0. However, you can define a comp

::

pragma solidity >0.4.99 <0.6.0;
pragma solidity ^0.5.0;
interface OldContract {
function someOldFunction(uint8 a) external;
function anotherOldFunction() external returns (bool);
Expand All @@ -325,7 +325,7 @@ Given the interface defined above, you can now easily use the already deployed p

::

pragma solidity >0.4.99 <0.6.0;
pragma solidity ^0.5.0;

interface OldContract {
function someOldFunction(uint8 a) external;
Expand All @@ -345,7 +345,7 @@ commandline compiler for linking):

::

pragma solidity >0.4.99 <0.6.0;
pragma solidity ^0.5.0;

library OldLibrary {
function someFunction(uint8 a) public returns(bool);
Expand Down Expand Up @@ -430,7 +430,7 @@ New version:

::

pragma solidity >0.4.99 <0.6.0;
pragma solidity ^0.5.0;

contract OtherContract {
uint x;
Expand Down
34 changes: 21 additions & 13 deletions docs/abi-spec.rst
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ For example,

::

pragma solidity >0.4.99 <0.6.0;
pragma solidity ^0.5.0;

contract Test {
constructor() public { b = hex"12345678901234567890123456789012"; }
Expand Down Expand Up @@ -597,7 +597,7 @@ Strict encoding mode is the mode that leads to exactly the same encoding as defi
This means offsets have to be as small as possible while still not creating overlaps in the data areas and thus no gaps are
allowed.

Usually, ABI decoders are written in a straigthforward way just following offset pointers, but some decoders
Usually, ABI decoders are written in a straightforward way just following offset pointers, but some decoders
might enforce strict mode. The Solidity ABI decoder currently does not enforce strict mode, but the encoder
always creates data in strict mode.

Expand All @@ -609,22 +609,30 @@ Through ``abi.encodePacked()``, Solidity supports a non-standard packed mode whe
- types shorter than 32 bytes are neither zero padded nor sign extended and
- dynamic types are encoded in-place and without the length.

As an example encoding ``int8, bytes1, uint16, string`` with values ``-1, 0x42, 0x2424, "Hello, world!"`` results in:
This packed mode is mainly used for indexed event parameters.

As an example, the encoding of ``int16(-1), bytes1(0x42), uint16(0x03), string("Hello, world!")`` results in:

.. code-block:: none
0xff42242448656c6c6f2c20776f726c6421
^^ int8(-1)
^^ bytes1(0x42)
^^^^ uint16(0x2424)
^^^^^^^^^^^^^^^^^^^^^^^^^^ string("Hello, world!") without a length field
0xffff42000348656c6c6f2c20776f726c6421
^^^^ int16(-1)
^^ bytes1(0x42)
^^^^ uint16(0x03)
^^^^^^^^^^^^^^^^^^^^^^^^^^ string("Hello, world!") without a length field
More specifically:
- Each value type takes as many bytes as its range has.
- The encoding of a struct or fixed-size array is the concatenation of the
encoding of its members/elements without any separator or padding.
- Mapping members of structs are ignored as usual.
- Dynamically-sized types like ``string``, ``bytes`` or ``uint[]`` are encoded without
their length field.

More specifically, each statically-sized type takes as many bytes as its range has
and dynamically-sized types like ``string``, ``bytes`` or ``uint[]`` are encoded without
their length field. This means that the encoding is ambiguous as soon as there are two
dynamically-sized elements.
In general, the encoding is ambiguous as soon as there are two dynamically-sized elements,
because of the missing length field.

If padding is needed, explicit type conversions can be used: ``abi.encodePacked(uint16(0x12)) == hex"0012"``.

Since packed encoding is not used when calling functions, there is no special support
for prepending a function selector.
for prepending a function selector. Since the encoding is ambiguous, there is no decoding function.
2 changes: 1 addition & 1 deletion docs/bugs.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
{
"name": "DelegateCallReturnValue",
"summary": "The low-level .delegatecall() does not return the execution outcome, but converts the value returned by the functioned called to a boolean instead.",
"description": "The return value of the low-level .delegatecall() function is taken from a position in memory, where the call data or the return data resides. This value is interpreted as a boolean and put onto the stack. This means if the called function returns at least 32 zero bytes, .delegatecall() returns false even if the call was successuful.",
"description": "The return value of the low-level .delegatecall() function is taken from a position in memory, where the call data or the return data resides. This value is interpreted as a boolean and put onto the stack. This means if the called function returns at least 32 zero bytes, .delegatecall() returns false even if the call was successful.",
"introduced": "0.3.0",
"fixed": "0.4.15",
"severity": "low"
Expand Down
4 changes: 4 additions & 0 deletions docs/bugs_by_version.json
Original file line number Diff line number Diff line change
Expand Up @@ -620,5 +620,9 @@
"0.5.2": {
"bugs": [],
"released": "2018-12-19"
},
"0.5.3": {
"bugs": [],
"released": "2019-01-22"
}
}

0 comments on commit 10d17f2

Please sign in to comment.