Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into breaking
Browse files Browse the repository at this point in the history
  • Loading branch information
chriseth committed Nov 9, 2021
2 parents f0d671c + 19159b9 commit 88cc422
Show file tree
Hide file tree
Showing 409 changed files with 4,819 additions and 3,531 deletions.
431 changes: 230 additions & 201 deletions .circleci/config.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .circleci/soltest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ source "${REPODIR}/scripts/common.sh"
# Test result output directory (CircleCI is reading test results from here)
mkdir -p test_results

# in case we run with ASAN enabled, we must increase stck size.
# in case we run with ASAN enabled, we must increase stack size.
ulimit -s 16384

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

# project name and version should be set after cmake_policy CMP0048
set(PROJECT_VERSION "0.8.10")
set(PROJECT_VERSION "0.8.11")
# OSX target needed in order to support std::visit
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14")
project(solidity VERSION ${PROJECT_VERSION} LANGUAGES C CXX)
Expand Down
30 changes: 28 additions & 2 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,36 @@ Breaking changes:
* Commandline Interface: Remapping targets are not automatically added to allowed paths.


### 0.8.10 (unreleased)
### 0.8.11 (unreleased)

Language Features:


Compiler Features:


Bugfixes:


### 0.8.10 (2021-11-09)

Language Features:
* Inline Assembly: Support ``.address`` and ``.selector`` on external function pointers to access their address and function selector.


Compiler Features:
* Code Generator: Skip existence check for external contract if return data is expected. In this case, the ABI decoder will revert if the contract does not exist.
* Commandline Interface: Accept nested brackets in step sequences passed to ``--yul-optimizations``.
* Commandline Interface: Add ``--debug-info`` option for selecting how much extra debug information should be included in the produced EVM assembly and Yul code.
* Commandline Interface: Support ``--asm``, ``--bin``, ``--ir-optimized``, ``--ewasm`` and ``--ewasm-ir`` output selection options in assembler mode.
* Commandline Interface: Use different colors when printing errors, warnings and infos.
* JSON AST: Set absolute paths of imports earlier, in the ``parsing`` stage.
* SMTChecker: Output values for ``block.*``, ``msg.*`` and ``tx.*`` variables that are present in the called functions.
* SMTChecker: Report contract invariants and reentrancy properties. This can be enabled via the CLI option ``--model-checker-invariants`` or the Standard JSON option ``settings.modelChecker.invariants``.
* Standard JSON: Accept nested brackets in step sequences passed to ``settings.optimizer.details.yulDetails.optimizerSteps``.
* Standard JSON: Add ``settings.debug.debugInfo`` option for selecting how much extra debug information should be included in the produced EVM assembly and Yul code.
* Yul EVM Code Transform: Switch to new optimized code transform when compiling via Yul with enabled optimizer.
* Yul Optimizer: Take control-flow side-effects of user-defined functions into account in various optimizer steps.


Bugfixes:
Expand All @@ -31,13 +47,23 @@ Bugfixes:
* Commandline Interface: Report output selection options unsupported by the selected input mode instead of ignoring them.
* Commandline Interface: When linking only accept exact matches for library names passed to the ``--libraries`` option. Library names not prefixed with a file name used to match any library with that name.
* SMTChecker: Fix internal error in magic type access (``block``, ``msg``, ``tx``).
* TypeChecker: Fix internal error when using user defined value types in public library functions.
* SMTChecker: Fix internal error in the CHC engine when passing gas in the function options.
* TypeChecker: Fix internal error when using arrays and structs with user defined value types before declaration.
* TypeChecker: Fix internal error when using user defined value types in public library functions.
* TypeChecker: Improved error message for constant variables with (nested) mapping types.
* Yul Assembler: Fix internal error when function names are not unique.
* Yul IR Generator: Do not output empty switches/if-bodies for empty contracts.


Important Bugfixes in Experimental Features:
* Yul IR Generator: Changes to function return variables referenced in modifier invocation arguments were not properly forwarded if there was more than one return variable.


Build System:
* Pass linker-only emscripten options only when linking.
* Remove obsolete compatibility workaround for emscripten builds.
* Update emscripten to version 2.0.33.


### 0.8.9 (2021-09-29)

Expand Down
26 changes: 14 additions & 12 deletions cmake/EthCompilerSettings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -111,39 +111,41 @@ if (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MA
# http://stackoverflow.com/questions/21617158/how-to-silence-unused-command-line-argument-error-with-clang-without-disabling-i
add_compile_options(-Qunused-arguments)
elseif(EMSCRIPTEN)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --memory-init-file 0")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_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 -fvisibility=hidden")
# Optimisation level
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
# Re-enable exception catching (optimisations above -O1 disable it)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s DISABLE_EXCEPTION_CATCHING=0")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s DISABLE_EXCEPTION_CATCHING=0")
# Remove any code related to exit (such as atexit)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s EXIT_RUNTIME=0")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s EXIT_RUNTIME=0")
# Remove any code related to filesystem access
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s FILESYSTEM=0")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s FILESYSTEM=0")
# Allow memory growth, but disable some optimisations
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s ALLOW_MEMORY_GROWTH=1")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ALLOW_MEMORY_GROWTH=1")
# Disable eval()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s DYNAMIC_EXECUTION=0")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s DYNAMIC_EXECUTION=0")
# Disable greedy exception catcher
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s NODEJS_CATCH_EXIT=0")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s NODEJS_CATCH_EXIT=0")
# 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")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ERROR_ON_UNDEFINED_SYMBOLS=1")
# Disallow deprecated emscripten build options.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s STRICT=1")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_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','UTF8ToString','lengthBytesUTF8','stringToUTF8','setValue']")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s EXTRA_EXPORTED_RUNTIME_METHODS=['cwrap','addFunction','removeFunction','UTF8ToString','lengthBytesUTF8','stringToUTF8','setValue']")
# Build for webassembly target.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s WASM=1")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s WASM=1")
# Set webassembly build to synchronous loading.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s WASM_ASYNC_COMPILATION=0")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s WASM_ASYNC_COMPILATION=0")
# Output a single js file with the wasm binary embedded as base64 string.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s SINGLE_FILE=1")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s SINGLE_FILE=1")
# Allow new functions to be added to the wasm module via addFunction.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s ALLOW_TABLE_GROWTH=1")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ALLOW_TABLE_GROWTH=1")
# Disable warnings about not being pure asm.js due to memory growth.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-almost-asm")
endif()
Expand Down
25 changes: 25 additions & 0 deletions cmake/templates/license.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,34 @@ static std::string const otherLicenses{R"(Most of the code is licensed under GPL
parts are as follows:

libkeccak-tiny:
The file libsolutil/Keccak256.cpp incorporates libkeccak-tiny.

A single-file implementation of SHA-3 and SHAKE implemented by David Leon Gil
License: CC0, attribution kindly requested. Blame taken too, but not liability.

picosha2:
The file libsolutil/picosha2.h is imported.

Copyright (C) 2017 okdshin

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

jsoncpp:
The JsonCpp library's source code, including accompanying documentation,
tests and demonstration applications, are licensed under the following
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 @@ -1544,6 +1544,10 @@
],
"released": "2021-01-27"
},
"0.8.10": {
"bugs": [],
"released": "2021-11-09"
},
"0.8.2": {
"bugs": [
"SignedImmutables",
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def setup(sphinx):

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build', 'contracts', 'types', 'examples', 'grammar', 'ir']
exclude_patterns = ['_build', 'contracts', 'types', 'examples', 'grammar']

# The reST default role (used for this markup: `text`) to use for all
# documents.
Expand Down
3 changes: 3 additions & 0 deletions docs/contracts/functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,9 @@ Pure Functions
--------------

Functions can be declared ``pure`` in which case they promise not to read from or modify the state.
In particular, it should be possible to evaluate a ``pure`` function at compile-time given
only its inputs and ``msg.data``, but without any knowledge of the current blockchain state.
This means that reading from ``immutable`` variables can be a non-pure operation.

.. note::
If the compiler's EVM target is Byzantium or newer (default) the opcode ``STATICCALL`` is used,
Expand Down
11 changes: 10 additions & 1 deletion docs/control-structures.rst
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,19 @@ otherwise, the ``value`` option would not be available.
Due to the fact that the EVM considers a call to a non-existing contract to
always succeed, Solidity uses the ``extcodesize`` opcode to check that
the contract that is about to be called actually exists (it contains code)
and causes an exception if it does not.
and causes an exception if it does not. This check is skipped if the return
data will be decoded after the call and thus the ABI decoder will catch the
case of a non-existing contract.

Note that this check is not performed in case of :ref:`low-level calls <address_related>` which
operate on addresses rather than contract instances.

.. note::
Be careful when using high-level calls to
:ref:`precompiled contracts <precompiledContracts>`,
since the compiler considers them non-existing according to the
above logic even though they execute code and can return data.

Function calls also cause exceptions if the called contract itself
throws an exception or goes out of gas.

Expand Down
3 changes: 2 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ version of Solidity. Apart from exceptional cases, only the latest version recei
`security fixes <https://github.com/ethereum/solidity/security/policy#supported-versions>`_.
Furthermore, breaking changes as well as
new features are introduced regularly. We currently use
a 0.x version number `to indicate this fast pace of change <https://semver.org/#spec-item-4>`_.
a 0.y.z version number `to indicate this fast pace of change <https://semver.org/#spec-item-4>`_.

.. warning::

Expand Down Expand Up @@ -136,6 +136,7 @@ Contents

using-the-compiler.rst
analysing-compilation-output.rst
ir-breaking-changes.rst

.. toctree::
:maxdepth: 2
Expand Down
15 changes: 2 additions & 13 deletions docs/installing-solidity.rst
Original file line number Diff line number Diff line change
Expand Up @@ -411,24 +411,13 @@ in Visual Studio 2019 Build Tools or Visual Studio 2019:
.. _Visual Studio 2019: https://www.visualstudio.com/vs/
.. _Visual Studio 2019 Build Tools: https://www.visualstudio.com/downloads/#build-tools-for-visual-studio-2019

Dependencies Helper Script
--------------------------

We have a helper script which you can use to install all required external dependencies
on macOS, Windows and on numerous Linux distros.

.. code-block:: bash
./scripts/install_deps.sh
Or, on Windows:
We have a helper script which you can use to install all required external dependencies:

.. code-block:: bat
scripts\install_deps.ps1
Note that the latter command will install ``boost`` and ``cmake`` to the ``deps`` subdirectory, while the former command
will attempt to install the dependencies globally.
This will install ``boost`` and ``cmake`` to the ``deps`` subdirectory.

Clone the Repository
--------------------
Expand Down
8 changes: 3 additions & 5 deletions docs/internals/optimizer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -429,11 +429,9 @@ is transformed to

.. code-block:: text
{
Init...
for {} C { Post... } {
Body...
}
Init...
for {} C { Post... } {
Body...
}
This eases the rest of the optimization process because we can ignore
Expand Down
21 changes: 21 additions & 0 deletions docs/introduction-to-smart-contracts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -565,3 +565,24 @@ contracts, the Ether is forever lost.
If you want to deactivate your contracts, you should instead **disable** them
by changing some internal state which causes all functions to revert. This
makes it impossible to use the contract, as it returns Ether immediately.


.. index:: ! precompiled contracts, ! precompiles, ! contract;precompiled

.. _precompiledContracts:

Precompiled Contracts
=====================

There is a small set of contract addresses that are special:
The address range between ``1`` and (including) ``8`` contains
"precompiled contracts" that can be called as any other contract
but their behaviour (and their gas consumption) is not defined
by EVM code stored at that address (they do not contain code)
but instead is implemented in the EVM execution environment itself.

Different EVM-compatible chains might use a different set of
precompiled contracts. It might also be possible that new
precompiled contracts are added to the Ethereum main chain in the future,
but you can reasonabyly expect them to always be in the range between
``1`` and ``0xffff`` (inclusive).
Loading

0 comments on commit 88cc422

Please sign in to comment.