\ No newline at end of file
diff --git a/docs/abi-spec.rst b/docs/abi-spec.rst
index 053b6dad4..eb344ea8a 100644
--- a/docs/abi-spec.rst
+++ b/docs/abi-spec.rst
@@ -202,7 +202,7 @@ on the type of ``X`` being
- ``uint``: ``enc(X)`` is the big-endian encoding of ``X``, padded on the higher-order
(left) side with zero-bytes such that the length is 32 bytes.
- ``address``: as in the ``uint160`` case
-- ``int``: ``enc(X)`` is the big-endian two's complement encoding of ``X``, padded on the higher-order (left) side with ``0xff`` for negative ``X`` and with zero bytes for positive ``X`` such that the length is 32 bytes.
+- ``int``: ``enc(X)`` is the big-endian two's complement encoding of ``X``, padded on the higher-order (left) side with ``0xff`` bytes for negative ``X`` and with zero-bytes for non-negative ``X`` such that the length is 32 bytes.
- ``bool``: as in the ``uint8`` case, where ``1`` is used for ``true`` and ``0`` for ``false``
- ``fixedx``: ``enc(X)`` is ``enc(X * 10**N)`` where ``X * 10**N`` is interpreted as a ``int256``.
- ``fixed``: as in the ``fixed128x18`` case
diff --git a/docs/bugs.json b/docs/bugs.json
index 066e17e93..42a5277b1 100644
--- a/docs/bugs.json
+++ b/docs/bugs.json
@@ -1,4 +1,12 @@
[
+ {
+ "name": "TupleAssignmentMultiStackSlotComponents",
+ "summary": "Tuple assignments with components that occupy several stack slots, i.e. nested tuples, pointers to external functions or references to dynamically sized calldata arrays, can result in invalid values.",
+ "description": "Tuple assignments did not correctly account for tuple components that occupy multiple stack slots in case the number of stack slots differs between left-hand-side and right-hand-side. This can either happen in the presence of nested tuples or if the right-hand-side contains external function pointers or references to dynamic calldata arrays, while the left-hand-side contains an omission.",
+ "introduced": "0.1.6",
+ "fixed": "0.6.6",
+ "severity": "very low"
+ },
{
"name": "MemoryArrayCreationOverflow",
"summary": "The creation of very large memory arrays can result in overlapping memory regions and thus memory corruption.",
diff --git a/docs/bugs_by_version.json b/docs/bugs_by_version.json
index b12393016..7ccd0c66a 100644
--- a/docs/bugs_by_version.json
+++ b/docs/bugs_by_version.json
@@ -111,6 +111,7 @@
},
"0.1.6": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"ExpExponentCleanup",
"NestedArrayFunctionCallDecoder",
"ZeroFunctionSelector",
@@ -131,6 +132,7 @@
},
"0.1.7": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"ExpExponentCleanup",
"NestedArrayFunctionCallDecoder",
"ZeroFunctionSelector",
@@ -151,6 +153,7 @@
},
"0.2.0": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"ExpExponentCleanup",
"NestedArrayFunctionCallDecoder",
@@ -172,6 +175,7 @@
},
"0.2.1": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"ExpExponentCleanup",
"NestedArrayFunctionCallDecoder",
@@ -193,6 +197,7 @@
},
"0.2.2": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"ExpExponentCleanup",
"NestedArrayFunctionCallDecoder",
@@ -214,6 +219,7 @@
},
"0.3.0": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"IncorrectEventSignatureInLibraries_0.4.x",
@@ -237,6 +243,7 @@
},
"0.3.1": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"IncorrectEventSignatureInLibraries_0.4.x",
@@ -259,6 +266,7 @@
},
"0.3.2": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"IncorrectEventSignatureInLibraries_0.4.x",
@@ -281,6 +289,7 @@
},
"0.3.3": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"IncorrectEventSignatureInLibraries_0.4.x",
@@ -302,6 +311,7 @@
},
"0.3.4": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"IncorrectEventSignatureInLibraries_0.4.x",
@@ -323,6 +333,7 @@
},
"0.3.5": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"IncorrectEventSignatureInLibraries_0.4.x",
@@ -344,6 +355,7 @@
},
"0.3.6": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"IncorrectEventSignatureInLibraries_0.4.x",
@@ -363,6 +375,7 @@
},
"0.4.0": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"IncorrectEventSignatureInLibraries_0.4.x",
@@ -382,6 +395,7 @@
},
"0.4.1": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"IncorrectEventSignatureInLibraries_0.4.x",
@@ -401,6 +415,7 @@
},
"0.4.10": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"SignedArrayStorageCopy",
@@ -418,6 +433,7 @@
},
"0.4.11": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"SignedArrayStorageCopy",
@@ -434,6 +450,7 @@
},
"0.4.12": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"SignedArrayStorageCopy",
@@ -449,6 +466,7 @@
},
"0.4.13": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"SignedArrayStorageCopy",
@@ -464,6 +482,7 @@
},
"0.4.14": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"SignedArrayStorageCopy",
@@ -478,6 +497,7 @@
},
"0.4.15": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"SignedArrayStorageCopy",
@@ -491,6 +511,7 @@
},
"0.4.16": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"SignedArrayStorageCopy",
@@ -506,6 +527,7 @@
},
"0.4.17": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"SignedArrayStorageCopy",
@@ -522,6 +544,7 @@
},
"0.4.18": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"SignedArrayStorageCopy",
@@ -537,6 +560,7 @@
},
"0.4.19": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"SignedArrayStorageCopy",
@@ -553,6 +577,7 @@
},
"0.4.2": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"IncorrectEventSignatureInLibraries_0.4.x",
@@ -571,6 +596,7 @@
},
"0.4.20": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"SignedArrayStorageCopy",
@@ -587,6 +613,7 @@
},
"0.4.21": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"SignedArrayStorageCopy",
@@ -603,6 +630,7 @@
},
"0.4.22": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"SignedArrayStorageCopy",
@@ -619,6 +647,7 @@
},
"0.4.23": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"SignedArrayStorageCopy",
@@ -634,6 +663,7 @@
},
"0.4.24": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"SignedArrayStorageCopy",
@@ -649,6 +679,7 @@
},
"0.4.25": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"SignedArrayStorageCopy",
@@ -662,6 +693,7 @@
},
"0.4.26": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"SignedArrayStorageCopy",
@@ -672,6 +704,7 @@
},
"0.4.3": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"IncorrectEventSignatureInLibraries_0.4.x",
@@ -689,6 +722,7 @@
},
"0.4.4": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"IncorrectEventSignatureInLibraries_0.4.x",
@@ -705,6 +739,7 @@
},
"0.4.5": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"UninitializedFunctionPointerInConstructor_0.4.x",
@@ -723,6 +758,7 @@
},
"0.4.6": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"UninitializedFunctionPointerInConstructor_0.4.x",
@@ -740,6 +776,7 @@
},
"0.4.7": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"SignedArrayStorageCopy",
@@ -757,6 +794,7 @@
},
"0.4.8": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"SignedArrayStorageCopy",
@@ -774,6 +812,7 @@
},
"0.4.9": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"SignedArrayStorageCopy",
@@ -791,6 +830,7 @@
},
"0.5.0": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"SignedArrayStorageCopy",
@@ -804,6 +844,7 @@
},
"0.5.1": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"SignedArrayStorageCopy",
@@ -817,6 +858,7 @@
},
"0.5.10": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"YulOptimizerRedundantAssignmentBreakContinue0.5",
@@ -826,6 +868,7 @@
},
"0.5.11": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"YulOptimizerRedundantAssignmentBreakContinue0.5"
@@ -834,6 +877,7 @@
},
"0.5.12": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"YulOptimizerRedundantAssignmentBreakContinue0.5"
@@ -842,6 +886,7 @@
},
"0.5.13": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"YulOptimizerRedundantAssignmentBreakContinue0.5"
@@ -850,6 +895,7 @@
},
"0.5.14": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"YulOptimizerRedundantAssignmentBreakContinue0.5",
@@ -859,6 +905,7 @@
},
"0.5.15": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"YulOptimizerRedundantAssignmentBreakContinue0.5"
@@ -867,6 +914,7 @@
},
"0.5.16": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden"
],
@@ -874,12 +922,14 @@
},
"0.5.17": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow"
],
"released": "2020-03-17"
},
"0.5.2": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"SignedArrayStorageCopy",
@@ -893,6 +943,7 @@
},
"0.5.3": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"SignedArrayStorageCopy",
@@ -906,6 +957,7 @@
},
"0.5.4": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"SignedArrayStorageCopy",
@@ -919,6 +971,7 @@
},
"0.5.5": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"SignedArrayStorageCopy",
@@ -934,6 +987,7 @@
},
"0.5.6": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"ABIEncoderV2CalldataStructsWithStaticallySizedAndDynamicallyEncodedMembers",
@@ -949,6 +1003,7 @@
},
"0.5.7": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"ABIEncoderV2CalldataStructsWithStaticallySizedAndDynamicallyEncodedMembers",
@@ -962,6 +1017,7 @@
},
"0.5.8": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"YulOptimizerRedundantAssignmentBreakContinue0.5",
@@ -974,6 +1030,7 @@
},
"0.5.9": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"privateCanBeOverridden",
"YulOptimizerRedundantAssignmentBreakContinue0.5",
@@ -985,6 +1042,7 @@
},
"0.6.0": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow",
"YulOptimizerRedundantAssignmentBreakContinue"
],
@@ -992,30 +1050,40 @@
},
"0.6.1": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow"
],
"released": "2020-01-02"
},
"0.6.2": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow"
],
"released": "2020-01-27"
},
"0.6.3": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow"
],
"released": "2020-02-18"
},
"0.6.4": {
"bugs": [
+ "TupleAssignmentMultiStackSlotComponents",
"MemoryArrayCreationOverflow"
],
"released": "2020-03-10"
},
"0.6.5": {
- "bugs": [],
+ "bugs": [
+ "TupleAssignmentMultiStackSlotComponents"
+ ],
"released": "2020-04-06"
+ },
+ "0.6.6": {
+ "bugs": [],
+ "released": "2020-04-09"
}
}
\ No newline at end of file
diff --git a/docs/conf.py b/docs/conf.py
index c8d60690b..9a9d574fc 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -146,10 +146,14 @@ html_theme = 'sphinx_rtd_theme'
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
+html_css_files = ["css/toggle.css"]
+
+html_js_files = ["js/toggle.js"]
+
# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
# directly to the root of the documentation.
-#html_extra_path = []
+html_extra_path = ["_static/css"]
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
diff --git a/docs/contracts/functions.rst b/docs/contracts/functions.rst
index 3195b5a40..5557aea87 100644
--- a/docs/contracts/functions.rst
+++ b/docs/contracts/functions.rst
@@ -195,7 +195,7 @@ In addition to the list of state modifying statements explained above, the follo
}
}
-Pure functions are able to use the `revert()` and `require()` functions to revert
+Pure functions are able to use the ``revert()`` and ``require()`` functions to revert
potential state changes when an :ref:`error occurs `.
Reverting a state change is not considered a "state modification", as only changes to the
@@ -235,9 +235,9 @@ A contract can have at most one ``receive`` function, declared using
``receive() external payable { ... }``
(without the ``function`` keyword).
This function cannot have arguments, cannot return anything and must have
-``external`` visibility and ``payable`` state mutability. It is executed on a
+``external`` visibility and ``payable`` state mutability. It is executed on a
call to the contract with empty calldata. This is the function that is executed
-on plain Ether transfers (e.g. via `.send()` or `.transfer()`). If no such
+on plain Ether transfers (e.g. via ``.send()`` or ``.transfer()``). If no such
function exists, but a payable :ref:`fallback function `
exists, the fallback function will be called on a plain Ether transfer. If
neither a receive Ether nor a payable fallback function is present, the
@@ -245,7 +245,7 @@ contract cannot receive Ether through regular transactions and throws an
exception.
In the worst case, the fallback function can only rely on 2300 gas being
-available (for example when `send` or `transfer` is used), leaving little
+available (for example when ``send`` or ``transfer`` is used), leaving little
room to perform other operations except basic logging. The following operations
will consume more gas than the 2300 gas stipend:
@@ -265,7 +265,7 @@ will consume more gas than the 2300 gas stipend:
.. warning::
A contract without a receive Ether function can receive Ether as a
- recipient of a `coinbase transaction` (aka `miner block reward`)
+ recipient of a *coinbase transaction* (aka *miner block reward*)
or as a destination of a ``selfdestruct``.
A contract cannot react to such Ether transfers and thus also
diff --git a/docs/contracts/visibility-and-getters.rst b/docs/contracts/visibility-and-getters.rst
index 2a6869adf..fda4e5055 100644
--- a/docs/contracts/visibility-and-getters.rst
+++ b/docs/contracts/visibility-and-getters.rst
@@ -16,7 +16,7 @@ Functions have to be specified as being ``external``,
``public``, ``internal`` or ``private``.
For state variables, ``external`` is not possible.
-``external``:
+``external``
External functions are part of the contract interface,
which means they can be called from other contracts and
via transactions. An external function ``f`` cannot be called
@@ -25,18 +25,18 @@ For state variables, ``external`` is not possible.
they receive large arrays of data, because the data
is not copied from calldata to memory.
-``public``:
+``public``
Public functions are part of the contract interface
and can be either called internally or via
messages. For public state variables, an automatic getter
function (see below) is generated.
-``internal``:
+``internal``
Those functions and state variables can only be
accessed internally (i.e. from within the current contract
or contracts deriving from it), without using ``this``.
-``private``:
+``private``
Private functions and state variables are only
visible for the contract they are defined in and not in
derived contracts.
diff --git a/docs/contributing.rst b/docs/contributing.rst
index 34b2db383..ce9cd97c4 100644
--- a/docs/contributing.rst
+++ b/docs/contributing.rst
@@ -81,26 +81,55 @@ Thank you for your help!
Running the compiler tests
==========================
-The ``./scripts/tests.sh`` script executes most Solidity tests automatically,
-but for quicker feedback, you might want to run specific tests.
+Prerequisites
+-------------
+
+Some tests require the `evmone `_
+library, others require `libz3 `_. The test script
+tries to discover the location of the ``evmone`` library, which can be located
+in the current directory, installed on the system level, or the ``deps`` folder
+in the project top level. The required file is called ``libevmone.so`` on Linux
+systems, ``evmone.dll`` on Windows systems and ``libevmone.dylib`` on macOS.
+
+Running the tests
+-----------------
Solidity includes different types of tests, most of them bundled into the
`Boost C++ Test Framework `_ application ``soltest``.
Running ``build/test/soltest`` or its wrapper ``scripts/soltest.sh`` is sufficient for most changes.
-Some tests require the ``evmone`` library, others require ``libz3``.
+The ``./scripts/tests.sh`` script executes most Solidity tests automatically,
+including those bundled into the `Boost C++ Test Framework `_ application ``soltest`` (or its wrapper ``scripts/soltest.sh``),
+as well as command line tests and compilation tests.
-The test system will automatically try to discover the location of the ``evmone`` library
+The test system automatically tries try to discover the location of the ``evmone`` library
starting from the current directory. The required file is called ``libevmone.so`` on Linux systems,
-``evmone.dll`` on Windows systems and ``libevmone.dylib`` on MacOS. If it is not found, the relevant tests
-are skipped. To run all tests, download the library from
-`Github `_
-and either place it in the project root path or inside the ``deps`` folder.
+``evmone.dll`` on Windows systems and ``libevmone.dylib`` on macOS. If it is not found, tests that
+use it are skipped. These tests are ``libsolididty/semanticTests``, ``libsolidity/GasCosts``,
+``libsolidity/SolidityEndToEndTest``, part of the soltest suite. To run all tests, download the library from
+`GitHub `_
+and place it in the project root path or inside the ``deps`` folder.
-If you do not have libz3 installed on your system, you should disable the SMT tests:
-``./scripts/soltest.sh --no-smt``.
+If the ``libz3`` library is not installed on your system, you should disable the
+SMT tests by exporting ``SMT_FLAGS=--no-smt`` before running ``./scripts/tests.sh`` or
+running ``./scripts/soltest.sh --no-smt``.
+These tests are ``libsolidity/smtCheckerTests`` and ``libsolidity/smtCheckerTestsJSON``.
+
+.. note ::
+
+ To get a list of all unit tests run by Soltest, run ``./build/test/soltest --list_content=HRF``.
+
+For quicker results you can run a subset of, or specific tests.
+
+To run a subset of tests, you can use filters:
+``./scripts/soltest.sh -t TestSuite/TestName``,
+where ``TestName`` can be a wildcard ``*``.
+
+Or, for example, to run all the tests for the yul disambiguator:
+``./scripts/soltest.sh -t "yulOptimizerTests/disambiguator/*" --no-smt``.
``./build/test/soltest --help`` has extensive help on all of the options available.
+
See especially:
- `show_progress (-p) `_ to show test completion,
@@ -109,20 +138,10 @@ See especially:
.. note ::
- Those working in a Windows environment wanting to run the above basic sets without libz3 in Git Bash, you would have to do: ``./build/test/Release/soltest.exe -- --no-smt``.
+ Those working in a Windows environment wanting to run the above basic sets
+ without libz3. Using Git Bash, you use: ``./build/test/Release/soltest.exe -- --no-smt``.
If you are running this in plain Command Prompt, use ``.\build\test\Release\soltest.exe -- --no-smt``.
-To run a subset of tests, you can use filters:
-``./scripts/soltest.sh -t TestSuite/TestName``,
-where ``TestName`` can be a wildcard ``*``.
-
-For example, here is an example test you might run;
-``./scripts/soltest.sh -t "yulOptimizerTests/disambiguator/*" --no-smt``.
-This will test all the tests for the disambiguator.
-
-To get a list of all tests, use
-``./build/test/soltest --list_content=HRF``.
-
If you want to debug using GDB, make sure you build differently than the "usual".
For example, you could run the following command in your ``build`` folder:
::
@@ -130,14 +149,11 @@ For example, you could run the following command in your ``build`` folder:
cmake -DCMAKE_BUILD_TYPE=Debug ..
make
-This will create symbols such that when you debug a test using the ``--debug`` flag, you will have access to functions and variables in which you can break or print with.
-
-
-The script ``./scripts/tests.sh`` also runs commandline tests and compilation tests
-in addition to those found in ``soltest``.
-
-The CI runs additional tests (including ``solc-js`` and testing third party Solidity frameworks) that require compiling the Emscripten target.
+This creates symbols so that when you debug a test using the ``--debug`` flag,
+you have access to functions and variables in which you can break or print with.
+The CI runs additional tests (including ``solc-js`` and testing third party Solidity
+frameworks) that require compiling the Emscripten target.
Writing and running syntax tests
--------------------------------
diff --git a/docs/examples/micropayment.rst b/docs/examples/micropayment.rst
index 8d3b2e1f3..477246e0e 100644
--- a/docs/examples/micropayment.rst
+++ b/docs/examples/micropayment.rst
@@ -433,7 +433,7 @@ The full contract
.. note::
The function ``splitSignature`` does not use all security
checks. A real implementation should use a more rigorously tested library,
- such as openzepplin's `version `_ of this code.
+ such as openzepplin's `version `_ of this code.
Verifying Payments
------------------
@@ -454,7 +454,7 @@ The recipient should verify each message using the following process:
We'll use the `ethereumjs-util `_
library to write this verification. The final step can be done a number of ways,
-and we use JavaScript. The following code borrows the `constructMessage` function from the signing **JavaScript code** above:
+and we use JavaScript. The following code borrows the ``constructMessage`` function from the signing **JavaScript code** above:
::
diff --git a/docs/installing-solidity.rst b/docs/installing-solidity.rst
index d02651a2e..27a20b3bc 100644
--- a/docs/installing-solidity.rst
+++ b/docs/installing-solidity.rst
@@ -35,11 +35,11 @@ or if you require more compilation options.
npm / Node.js
=============
-Use `npm` for a convenient and portable way to install `solcjs`, a Solidity compiler. The
+Use ``npm`` for a convenient and portable way to install ``solcjs``, a Solidity compiler. The
`solcjs` program has fewer features than the ways to access the compiler described
further down this page. The
:ref:`commandline-compiler` documentation assumes you are using
-the full-featured compiler, `solc`. The usage of `solcjs` is documented inside its own
+the full-featured compiler, ``solc``. The usage of ``solcjs`` is documented inside its own
`repository `_.
Note: The solc-js project is derived from the C++
@@ -53,10 +53,10 @@ Please refer to the solc-js repository for instructions.
.. note::
- The commandline executable is named `solcjs`.
+ The commandline executable is named ``solcjs``.
- The comandline options of `solcjs` are not compatible with `solc` and tools (such as `geth`)
- expecting the behaviour of `solc` will not work with `solcjs`.
+ The comandline options of ``solcjs`` are not compatible with ``solc`` and tools (such as ``geth``)
+ expecting the behaviour of ``solc`` will not work with ``solcjs``.
Docker
======
diff --git a/docs/introduction-to-smart-contracts.rst b/docs/introduction-to-smart-contracts.rst
index 17740fcda..b051a97f8 100644
--- a/docs/introduction-to-smart-contracts.rst
+++ b/docs/introduction-to-smart-contracts.rst
@@ -323,7 +323,7 @@ Every account has a persistent key-value store mapping 256-bit words to 256-bit
words called **storage**.
Furthermore, every account has a **balance** in
-Ether (in "Wei" to be exact, `1 ether` is `10**18 wei`) which can be modified by sending transactions that
+Ether (in "Wei" to be exact, ``1 ether`` is ``10**18 wei``) which can be modified by sending transactions that
include Ether.
.. index:: ! transaction
@@ -520,9 +520,9 @@ idea, but it is potentially dangerous, as if someone sends Ether to removed
contracts, the Ether is forever lost.
.. warning::
- Even if a contract is removed by "selfdestruct", it is still part of the
+ Even if a contract is removed by ``selfdestruct``, it is still part of the
history of the blockchain and probably retained by most Ethereum nodes.
- So using "selfdestruct" is not the same as deleting data from a hard disk.
+ So using ``selfdestruct`` is not the same as deleting data from a hard disk.
.. note::
Even if a contract's code does not contain a call to ``selfdestruct``,
diff --git a/docs/natspec-format.rst b/docs/natspec-format.rst
index 6f241eda3..ed9705117 100644
--- a/docs/natspec-format.rst
+++ b/docs/natspec-format.rst
@@ -73,8 +73,8 @@ Tags
All tags are optional. The following table explains the purpose of each
NatSpec tag and where it may be used. As a special case, if no tags are
-used then the Solidity compiler will interpret a `///` or `/**` comment
-in the same way as if it were tagged with `@notice`.
+used then the Solidity compiler will interpret a ``///`` or ``/**`` comment
+in the same way as if it were tagged with ``@notice``.
=========== =============================================================================== =============================
Tag Context
diff --git a/docs/style-guide.rst b/docs/style-guide.rst
index 2b0bfee34..2dd7ef877 100644
--- a/docs/style-guide.rst
+++ b/docs/style-guide.rst
@@ -24,8 +24,11 @@ solidity code. The goal of this guide is *consistency*. A quote from python's
`pep8 `_
captures this concept well.
+.. note::
+
A style guide is about consistency. Consistency with this style guide is important. Consistency within a project is more important. Consistency within one module or function is most important.
- But most importantly: know when to be inconsistent -- sometimes the style guide just doesn't apply. When in doubt, use your best judgement. Look at other examples and decide what looks best. And don't hesitate to ask!
+
+ But most importantly: **know when to be inconsistent** -- sometimes the style guide just doesn't apply. When in doubt, use your best judgement. Look at other examples and decide what looks best. And don't hesitate to ask!
***********
@@ -383,8 +386,7 @@ No::
function spam(uint i , Coin coin) public ;
-More than one space around an assignment or other operator to align with
- another:
+More than one space around an assignment or other operator to align with another:
Yes::
@@ -996,7 +998,7 @@ Contract and Library Names
* Contract and library names should also match their filenames.
* If a contract file includes multiple contracts and/or libraries, then the filename should match the *core contract*. This is not recommended however if it can be avoided.
-As shown in the example below, if the contract name is `Congress` and the library name is `Owned`, then their associated filenames should be `Congress.sol` and `Owned.sol`.
+As shown in the example below, if the contract name is ``Congress`` and the library name is ``Owned``, then their associated filenames should be ``Congress.sol`` and ``Owned.sol``.
Yes::
@@ -1132,8 +1134,8 @@ Solidity contracts can have a form of comments that are the basis of the
Ethereum Natural Language Specification Format.
Add comments above functions or contracts following `doxygen `_ notation
-of one or multiple lines starting with `///` or a
-multiline comment starting with `/**` and ending with `*/`.
+of one or multiple lines starting with ``///`` or a
+multiline comment starting with ``/**`` and ending with ``*/``.
For example, the contract from `a simple smart contract `_ with the comments
added looks like the one below::
diff --git a/docs/types.rst b/docs/types.rst
index b9c06f6c8..d929a274f 100644
--- a/docs/types.rst
+++ b/docs/types.rst
@@ -16,7 +16,7 @@ operators. For a quick reference of the various operators, see :ref:`order`.
The concept of "undefined" or "null" values does not exist in Solidity, but newly
declared variables always have a :ref:`default value` dependent
on its type. To handle any unexpected values, you should use the :ref:`revert function` to revert the whole transaction, or return a
-tuple with a second `bool` value denoting success.
+tuple with a second ``bool`` value denoting success.
.. include:: types/value-types.rst
@@ -26,4 +26,4 @@ tuple with a second `bool` value denoting success.
.. include:: types/operators.rst
-.. include:: types/conversion.rst
\ No newline at end of file
+.. include:: types/conversion.rst
diff --git a/docs/types/value-types.rst b/docs/types/value-types.rst
index 98c3336c4..ba79adcb7 100644
--- a/docs/types/value-types.rst
+++ b/docs/types/value-types.rst
@@ -332,7 +332,7 @@ the :ref:`address type`.
Before version 0.5.0, contracts directly derived from the address type
and there was no distinction between ``address`` and ``address payable``.
-If you declare a local variable of contract type (`MyContract c`), you can call
+If you declare a local variable of contract type (``MyContract c``), you can call
functions on that contract. Take care to assign it from somewhere that is the
same contract type.
diff --git a/docs/units-and-global-variables.rst b/docs/units-and-global-variables.rst
index 6c625e997..75ed7546f 100644
--- a/docs/units-and-global-variables.rst
+++ b/docs/units-and-global-variables.rst
@@ -140,15 +140,19 @@ Error Handling
See the dedicated section on :ref:`assert and require` for
more details on error handling and when to use which function.
-``assert(bool condition)``:
+``assert(bool condition)``
causes an invalid opcode and thus state change reversion if the condition is not met - to be used for internal errors.
-``require(bool condition)``:
+
+``require(bool condition)``
reverts if the condition is not met - to be used for errors in inputs or external components.
-``require(bool condition, string memory message)``:
+
+``require(bool condition, string memory message)``
reverts if the condition is not met - to be used for errors in inputs or external components. Also provides an error message.
-``revert()``:
+
+``revert()``
abort execution and revert state changes
-``revert(string memory reason)``:
+
+``revert(string memory reason)``
abort execution and revert state changes, providing an explanatory string
.. index:: keccak256, ripemd160, sha256, ecrecover, addmod, mulmod, cryptography,
@@ -156,32 +160,32 @@ more details on error handling and when to use which function.
Mathematical and Cryptographic Functions
----------------------------------------
-``addmod(uint x, uint y, uint k) returns (uint)``:
+``addmod(uint x, uint y, uint k) returns (uint)``
compute ``(x + y) % k`` where the addition is performed with arbitrary precision and does not wrap around at ``2**256``. Assert that ``k != 0`` starting from version 0.5.0.
-``mulmod(uint x, uint y, uint k) returns (uint)``:
+``mulmod(uint x, uint y, uint k) returns (uint)``
compute ``(x * y) % k`` where the multiplication is performed with arbitrary precision and does not wrap around at ``2**256``. Assert that ``k != 0`` starting from version 0.5.0.
-``keccak256(bytes memory) returns (bytes32)``:
+``keccak256(bytes memory) returns (bytes32)``
compute the Keccak-256 hash of the input
.. note::
There used to be an alias for ``keccak256`` called ``sha3``, which was removed in version 0.5.0.
-``sha256(bytes memory) returns (bytes32)``:
+``sha256(bytes memory) returns (bytes32)``
compute the SHA-256 hash of the input
-``ripemd160(bytes memory) returns (bytes20)``:
+``ripemd160(bytes memory) returns (bytes20)``
compute RIPEMD-160 hash of the input
-``ecrecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) returns (address)``:
+``ecrecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) returns (address)``
recover the address associated with the public key from elliptic curve signature or return zero on error.
The function parameters correspond to ECDSA values of the signature:
- ``r`` = first 32 bytes of signature
- ``s`` = second 32 bytes of signature
- ``v`` = final 1 byte of signature
+ * ``r`` = first 32 bytes of signature
+ * ``s`` = second 32 bytes of signature
+ * ``v`` = final 1 byte of signature
``ecrecover`` returns an ``address``, and not an ``address payable``. See :ref:`address payable` for
conversion, in case you need to transfer funds to the recovered address.
@@ -209,17 +213,22 @@ Mathematical and Cryptographic Functions
Members of Address Types
------------------------
-``.balance`` (``uint256``):
+``.balance`` (``uint256``)
balance of the :ref:`address` in Wei
-``.transfer(uint256 amount)``:
+
+``.transfer(uint256 amount)``
send given amount of Wei to :ref:`address`, reverts on failure, forwards 2300 gas stipend, not adjustable
-``.send(uint256 amount) returns (bool)``:
+
+``.send(uint256 amount) returns (bool)``
send given amount of Wei to :ref:`address`, returns ``false`` on failure, forwards 2300 gas stipend, not adjustable
-``.call(bytes memory) returns (bool, bytes memory)``:
+
+``.call(bytes memory) returns (bool, bytes memory)``
issue low-level ``CALL`` with the given payload, returns success condition and return data, forwards all available gas, adjustable
-``.delegatecall(bytes memory) returns (bool, bytes memory)``:
+
+``.delegatecall(bytes memory) returns (bool, bytes memory)``
issue low-level ``DELEGATECALL`` with the given payload, returns success condition and return data, forwards all available gas, adjustable
-``.staticcall(bytes memory) returns (bool, bytes memory)``:
+
+``.staticcall(bytes memory) returns (bool, bytes memory)``
issue low-level ``STATICCALL`` with the given payload, returns success condition and return data, forwards all available gas, adjustable
For more information, see the section on :ref:`address`.
@@ -258,10 +267,10 @@ For more information, see the section on :ref:`address`.
Contract Related
----------------
-``this`` (current contract's type):
+``this`` (current contract's type)
the current contract, explicitly convertible to :ref:`address`
-``selfdestruct(address payable recipient)``:
+``selfdestruct(address payable recipient)``
Destroy the current contract, sending its funds to the given :ref:`address`
and end execution.
Note that ``selfdestruct`` has some peculiarities inherited from the EVM:
@@ -290,10 +299,10 @@ type ``X``. Currently, there is limited support for this feature, but
it might be expanded in the future. The following properties are
available for a contract type ``C``:
-``type(C).name``:
+``type(C).name``
The name of the contract.
-``type(C).creationCode``:
+``type(C).creationCode``
Memory byte array that contains the creation bytecode of the contract.
This can be used in inline assembly to build custom creation routines,
especially by using the ``create2`` opcode.
@@ -301,7 +310,7 @@ available for a contract type ``C``:
derived contract. It causes the bytecode to be included in the bytecode
of the call site and thus circular references like that are not possible.
-``type(C).runtimeCode``:
+``type(C).runtimeCode``
Memory byte array that contains the runtime bytecode of the contract.
This is the code that is usually deployed by the constructor of ``C``.
If ``C`` has a constructor that uses inline assembly, this might be
diff --git a/docs/using-the-compiler.rst b/docs/using-the-compiler.rst
index acf3a416e..3151480c3 100644
--- a/docs/using-the-compiler.rst
+++ b/docs/using-the-compiler.rst
@@ -106,7 +106,8 @@ Target options
Below is a list of target EVM versions and the compiler-relevant changes introduced
at each version. Backward compatibility is not guaranteed between each version.
-- ``homestead`` (oldest version)
+- ``homestead``
+ - (oldest version)
- ``tangerineWhistle``
- Gas cost for access to other accounts increased, relevant for gas estimation and the optimizer.
- All gas sent by default for external calls, previously a certain amount had to be retained.
@@ -692,7 +693,7 @@ Review changes
The command above applies all changes as shown below. Please review them carefully.
-.. code-block:: none
+.. code-block:: solidity
pragma solidity >=0.6.0 <0.8.0;
diff --git a/libevmasm/ExpressionClasses.cpp b/libevmasm/ExpressionClasses.cpp
index 644f4a274..62780b19f 100644
--- a/libevmasm/ExpressionClasses.cpp
+++ b/libevmasm/ExpressionClasses.cpp
@@ -22,15 +22,17 @@
*/
#include
-#include
-#include
-#include
-#include
-#include
#include
#include
#include
+#include
+#include
+
+#include
+#include
+#include
+
using namespace std;
using namespace solidity;
using namespace solidity::evmasm;
diff --git a/libevmasm/GasMeter.h b/libevmasm/GasMeter.h
index 64b772c6e..a6c0f29d9 100644
--- a/libevmasm/GasMeter.h
+++ b/libevmasm/GasMeter.h
@@ -28,6 +28,7 @@
#include
#include
+#include
namespace solidity::evmasm
{
@@ -119,7 +120,7 @@ public:
struct GasConsumption
{
GasConsumption(unsigned _value = 0, bool _infinite = false): value(_value), isInfinite(_infinite) {}
- GasConsumption(u256 _value, bool _infinite = false): value(_value), isInfinite(_infinite) {}
+ GasConsumption(u256 _value, bool _infinite = false): value(std::move(_value)), isInfinite(_infinite) {}
static GasConsumption infinite() { return GasConsumption(0, true); }
GasConsumption& operator+=(GasConsumption const& _other);
@@ -133,8 +134,8 @@ public:
};
/// Constructs a new gas meter given the current state.
- GasMeter(std::shared_ptr const& _state, langutil::EVMVersion _evmVersion, u256 const& _largestMemoryAccess = 0):
- m_state(_state), m_evmVersion(_evmVersion), m_largestMemoryAccess(_largestMemoryAccess) {}
+ GasMeter(std::shared_ptr _state, langutil::EVMVersion _evmVersion, u256 _largestMemoryAccess = 0):
+ m_state(std::move(_state)), m_evmVersion(_evmVersion), m_largestMemoryAccess(std::move(_largestMemoryAccess)) {}
/// @returns an upper bound on the gas consumed by the given instruction and updates
/// the state.
diff --git a/libevmasm/KnownState.h b/libevmasm/KnownState.h
index a9cc4f201..b19585036 100644
--- a/libevmasm/KnownState.h
+++ b/libevmasm/KnownState.h
@@ -23,6 +23,7 @@
#pragma once
+#include
#include
#include