Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
9aad8d6
common.sh: printStackTrace() and assertFail()
cameel Oct 14, 2021
b85172b
common.sh: Print the source code from locations indicated in the stac…
cameel Oct 14, 2021
3b1b9a0
common.sh: Adjust formatting in msg_on_error() and add stack trace
cameel Oct 14, 2021
0280c8d
Use fail and assertFail where appropriate in command-line tests
cameel Oct 14, 2021
d846410
yul.rst: Clarify that linkersymbol() accepts but does not require a f…
cameel Oct 14, 2021
b28e5c8
Disallowed --error-recovery in Standard json, Assembly and Linker inp…
Midhun07 Aug 31, 2021
9f48b74
Do not use named function labels if function names are not unique.
chriseth Oct 14, 2021
816d802
Remove linking to unqualified library name
soroosh-sdi Oct 1, 2021
2b0fbc3
Merge pull request #12073 from soroosh-sdi/unqualified-lib-name-bug
cameel Oct 20, 2021
2278673
Fix formatting
fulldecent Oct 19, 2021
72b88da
Merge pull request #11909 from Midhun07/develop
cameel Oct 20, 2021
ef21e43
Merge pull request #12162 from fulldecent/patch-24
cameel Oct 20, 2021
92f3d74
CI: Store yul-phaser as an artifact too
cameel Oct 21, 2021
921d044
Fix typo in ir-breaking-changes.rst
Gyeonghun-Park Oct 22, 2021
ab31437
Add a PR check that runs hardhat tests using the built compiler binary
cameel Oct 20, 2021
3774955
Merge pull request #12178 from Gyeonghun-Park/develop
cameel Oct 22, 2021
0e71c12
CI: Refactor the gitter notification templates into a reusable command
cameel Oct 22, 2021
a4fce30
CI: Use markdown link syntax in gitter messages
cameel Oct 22, 2021
3387e13
Fix typo compiler->constructor.
abliss Oct 24, 2021
ec52908
Merge pull request #12184 from abliss/patch-1
hrkrshnn Oct 25, 2021
cf00536
Added different colors for warning & error
shikharvashistha Sep 24, 2021
d8d2c49
Merge pull request #12172 from ethereum/circleci-yul-phaser-artifact
Marenz Oct 25, 2021
ae0db91
Merge pull request #12165 from ethereum/hardhat-tests-in-ci
hrkrshnn Oct 25, 2021
8460a65
Merge pull request #12182 from ethereum/circleci-gitter-notification-…
hrkrshnn Oct 25, 2021
1da57d5
Merge pull request #11970 from shikharvashistha/colors
hrkrshnn Oct 25, 2021
e6e30f8
Merge pull request #12139 from ethereum/nonamedlabelsifnotunique
chriseth Oct 25, 2021
2162039
Merge pull request #12142 from ethereum/bash-assert-and-stack-traces
cameel Oct 26, 2021
cc80f5e
Add missing condition to gitter_notify command
cameel Oct 26, 2021
ed091d0
Merge pull request #12190 from ethereum/fix-circleci-notification-con…
chriseth Oct 26, 2021
719b708
Merge pull request #12144 from ethereum/clarify-linkersymbol-docs-reg…
chriseth Oct 26, 2021
fa48abf
Add new info functions
Oct 6, 2021
9a87680
Add invariant to the solver results
Oct 6, 2021
1d65977
Adjust Z3Interface::fromZ3 for the extra cases
Oct 6, 2021
ce72d7c
Add ExpressionFormatter which translates an smtutil::Expression into …
Oct 6, 2021
9bcd2c1
Add expression substitution to Predicate
Oct 6, 2021
d554824
Add Invariants which traverses the proof and collects invariants for …
Oct 6, 2021
bc90533
Add invariants to ModelCheckerSettings
Oct 6, 2021
49e7627
Use invariants in CHC
Oct 6, 2021
d419c30
Add errorCode list to invariants report
Oct 13, 2021
3118fb3
Add invariants option to CLI and JSON
Oct 6, 2021
37215ff
Add SMTCheckerTest isoltest option to ignore invariants
Oct 6, 2021
a104443
Adjust errors script to also look for infos
Oct 6, 2021
2cbd496
Adjust ModelCheckerSettings in tools tests
Oct 6, 2021
38b0cf7
SMTChecker tests
Oct 6, 2021
4f823c6
CLI and JSON tests
Oct 6, 2021
d04ad57
Docs
Oct 6, 2021
902a2e2
Changelog
Oct 6, 2021
401dd43
Merge pull request #11451 from ethereum/smt_report_invariants
hrkrshnn Oct 26, 2021
f588dd3
Sort bugfixes in changelog
Marenz Oct 26, 2021
453f404
Merge pull request #12194 from ethereum/sort-changelog
chriseth Oct 26, 2021
9428dbc
Moved storage size assert to TypeChecker from DeclarationTypeChecker
hrkrshnn Oct 25, 2021
51009c0
Moved a canBeStored assert for struct members to TypeChecker
hrkrshnn Oct 26, 2021
8815d6f
Moved a check related to constants to TypeChecker
hrkrshnn Oct 26, 2021
61519da
Fix wrong path to isoltest in docs
Marenz Oct 27, 2021
dce13fb
Fix use-after-free bug.
chriseth Oct 25, 2021
9be882c
Merge pull request #12186 from ethereum/fix-userdefined-ice
chriseth Oct 27, 2021
e4a94b6
Merge pull request #12201 from ethereum/docs-path-fix
chriseth Oct 27, 2021
7ebf71f
Merge pull request #12203 from ethereum/fixuseafterfreeside
chriseth Oct 27, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 82 additions & 32 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,45 @@ parameters:
orbs:
win: circleci/windows@2.2.0

commands:
gitter_notify:
description: "Posts a notification to the main room on Gitter (if not running on a PR)."
parameters:
event:
type: enum
enum: ["failure", "success"]
condition:
type: string
steps:
- run:
name: "Gitter notification"
when: << parameters.condition >>
command: |
[[ "<< parameters.event >>" == "failure" ]] && message=" ❌ Nightly job **${CIRCLE_JOB}** failed on **${CIRCLE_BRANCH}**. Please see [build #${CIRCLE_BUILD_NUM}](${CIRCLE_BUILD_URL}) for details."
[[ "<< parameters.event >>" == "success" ]] && message=" ✅ Nightly job **${CIRCLE_JOB}** succeeded on **${CIRCLE_BRANCH}**. Please see [build #${CIRCLE_BUILD_NUM}](${CIRCLE_BUILD_URL}) for details."

curl "https://api.gitter.im/v1/rooms/${GITTER_NOTIFY_ROOM_ID}/chatMessages" \
--request POST \
--include \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "Authorization: Bearer ${GITTER_API_TOKEN}" \
--data "{\"text\":\"${message}\"}"

gitter_notify_failure:
description: "Posts a failure notification to the main room on Gitter (if not running on a PR)."
steps:
- gitter_notify:
event: failure
condition: on_fail

gitter_notify_success:
description: "Posts a success notification to the main room on Gitter (if not running on a PR)."
steps:
- gitter_notify:
event: success
condition: on_success

defaults:

# --------------------------------------------------------------------------
Expand Down Expand Up @@ -91,10 +130,14 @@ defaults:
path: upload/

# compiled tool executable target
- artifacts_tools: &artifacts_tools
- artifact_solidity_upgrade: &artifact_solidity_upgrade
path: build/tools/solidity-upgrade
destination: solidity-upgrade

- artifact_yul_phaser: &artifact_yul_phaser
path: build/tools/yul-phaser
destination: yul-phaser

# compiled executable targets
- artifacts_executables: &artifacts_executables
root: build
Expand Down Expand Up @@ -263,28 +306,6 @@ defaults:
requires:
- b_win_release

# --------------------------------------------------------------------------
# Notification Templates
- gitter_notify_failure: &gitter_notify_failure
name: Gitter notify failure
command: >-
curl -X POST -i
-i -H "Content-Type: application/json"
-H "Accept: application/json"
-H "Authorization: Bearer $GITTER_API_TOKEN" "https://api.gitter.im/v1/rooms/$GITTER_NOTIFY_ROOM_ID/chatMessages"
-d '{"text":" ❌ Nightly job **'$CIRCLE_JOB'** failed on **'$CIRCLE_BRANCH'**. Please see '$CIRCLE_BUILD_URL' for details."}'
when: on_fail

- gitter_notify_success: &gitter_notify_success
name: Gitter notify success
command: >-
curl -X POST -i
-i -H "Content-Type: application/json"
-H "Accept: application/json"
-H "Authorization: Bearer $GITTER_API_TOKEN" "https://api.gitter.im/v1/rooms/$GITTER_NOTIFY_ROOM_ID/chatMessages"
-d '{"text":" ✅ Nightly job **'$CIRCLE_JOB'** succeeded on **'$CIRCLE_BRANCH'**. Please see '$CIRCLE_BUILD_URL' for details."}'
when: on_success

# -----------------------------------------------------------------------------------------------
jobs:

Expand Down Expand Up @@ -447,7 +468,8 @@ jobs:
- checkout
- run: *run_build
- store_artifacts: *artifacts_solc
- store_artifacts: *artifacts_tools
- store_artifacts: *artifact_solidity_upgrade
- store_artifacts: *artifact_yul_phaser
- persist_to_workspace: *artifacts_executables

# x64 ASAN build, for testing for memory related bugs
Expand Down Expand Up @@ -502,7 +524,7 @@ jobs:
steps:
- checkout
- run: *run_build
- run: *gitter_notify_failure
- gitter_notify_failure
- store_artifacts: *artifacts_solc
- persist_to_workspace: *artifacts_executables

Expand Down Expand Up @@ -595,8 +617,8 @@ jobs:
git clone https://github.com/ethereum/solidity-fuzzing-corpus /tmp/solidity-fuzzing-corpus
mkdir -p test_results
scripts/regressions.py -o test_results
- run: *gitter_notify_failure
- run: *gitter_notify_success
- gitter_notify_failure
- gitter_notify_success
- store_test_results: *store_test_results
- store_artifacts: *artifacts_test_results

Expand Down Expand Up @@ -644,7 +666,8 @@ jobs:
- /usr/local/Homebrew
- run: *run_build
- store_artifacts: *artifacts_solc
- store_artifacts: *artifacts_tools
- store_artifacts: *artifact_solidity_upgrade
- store_artifacts: *artifact_yul_phaser
- persist_to_workspace:
root: .
paths:
Expand Down Expand Up @@ -807,7 +830,7 @@ jobs:
- when:
condition: true
<<: *steps_soltest
- run: *gitter_notify_failure
- gitter_notify_failure

t_ubu_ubsan_clang_cli:
docker:
Expand All @@ -816,7 +839,7 @@ jobs:
- when:
condition: true
<<: *steps_cmdline_tests
- run: *gitter_notify_failure
- gitter_notify_failure

t_ems_solcjs:
docker:
Expand All @@ -840,6 +863,32 @@ jobs:
npm --version
test/externalTests/solc-js/solc-js.sh /tmp/workspace/soljson.js $(cat /tmp/workspace/version.txt)

t_ems_ext_hardhat:
docker:
- image: circleci/node
environment:
TERM: xterm
HARDHAT_TESTS_SOLC_PATH: /tmp/workspace/soljson.js
steps:
- checkout
- attach_workspace:
at: /tmp/workspace
- run: git clone --depth 1 https://github.com/nomiclabs/hardhat.git
- run:
name: Install dependencies
command: |
cd hardhat
yarn
- run:
name: Run hardhat-core test suite
command: |
HARDHAT_TESTS_SOLC_VERSION=$(scripts/get_version.sh)
export HARDHAT_TESTS_SOLC_VERSION

# NOTE: This is expected to work without running `yarn build` first.
cd hardhat/packages/hardhat-core
yarn test

t_ems_ext:
parameters:
project:
Expand Down Expand Up @@ -874,8 +923,8 @@ jobs:
- when:
condition: <<parameters.gitter_notify>>
steps:
- run: *gitter_notify_failure
- run: *gitter_notify_success
- gitter_notify_failure
- gitter_notify_success

b_win: &b_win
executor:
Expand Down Expand Up @@ -1110,6 +1159,7 @@ workflows:
# Emscripten build and tests that take 15 minutes or less
- b_ems: *workflow_trigger_on_tags
- t_ems_solcjs: *workflow_emscripten
- t_ems_ext_hardhat: *workflow_emscripten

- t_ems_ext:
<<: *workflow_emscripten
Expand Down
10 changes: 8 additions & 2 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,29 @@ Language Features:
Compiler Features:
* 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: Use different colors when printing errors, warnings and infos.
* 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.


Bugfixes:
* Code Generator: Fix constructor source mappings for immutables.
* Commandline Interface: Disallow ``--error-recovery`` option outside of the compiler mode.
* Commandline Interface: Don't return zero exit code when writing linked files to disk fails.
* Commandline Interface: Fix extra newline character being appended to sources passed through standard input, affecting their hashes.
* Commandline Interface: Report output selection options unsupported by the selected input mode instead of ignoring them.
* Commandline Interface: Don't return zero exit code when writing linked files to disk fails.
* 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.
* TypeChecker: Fix internal error when using arrays and structs with user defined value types before declaration.
* 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.




### 0.8.9 (2021-09-29)

Important Bugfixes:
Expand Down
2 changes: 1 addition & 1 deletion docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ editing of failing contracts using your preferred text editor. Let's try to brea
// ----
// DeclarationError: (36-52): Identifier already declared.

Running ``./build/test/isoltest`` again results in a test failure:
Running ``./build/test/tools/isoltest`` again results in a test failure:

.. code-block:: text

Expand Down
2 changes: 1 addition & 1 deletion docs/control-structures.rst
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ which only need to be created if there is a dispute.
re-created at the same address after having been destroyed. Yet, it is possible
for that newly created contract to have a different deployed bytecode even
though the creation bytecode has been the same (which is a requirement because
otherwise the address would change). This is due to the fact that the compiler
otherwise the address would change). This is due to the fact that the constructor
can query external state that might have changed between the two creations
and incorporate that into the deployed bytecode before it is stored.

Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ and multi-signature wallets.

When deploying contracts, you should use the latest released
version of Solidity. Apart from exceptional cases, only the latest version receives
`security fixes<https://github.com/ethereum/solidity/security/policy#supported-versions>`.
`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>`_.
Expand Down
2 changes: 1 addition & 1 deletion docs/ir/ir-breaking-changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ In the new code generator, function pointers use the AST IDs of the functions as
calls through function pointers always have to use an internal dispatch function that uses the ``switch`` statement to select
the right function.

The ID ``0`` is reserved for uninitialized function pointers which then cause a panic in the disptach function when called.
The ID ``0`` is reserved for uninitialized function pointers which then cause a panic in the dispatch function when called.

In the old code generator, internal function pointers are initialized with a special function that always causes a panic.
This causes a storage write at construction time for internal function pointers in storage.
Expand Down
19 changes: 18 additions & 1 deletion docs/smtchecker.rst
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ is already "locked", so it would not be possible to change the value of ``x``,
regardless of what the unknown called code does.

If we "forget" to use the ``mutex`` modifier on function ``set``, the
SMTChecker is able to synthesize the behavior of the externally called code so
SMTChecker is able to synthesize the behaviour of the externally called code so
that the assertion fails:

.. code-block:: text
Expand Down Expand Up @@ -518,6 +518,23 @@ which has the following form:
"source2.sol": ["contract2", "contract3"]
}

Reported Inferred Inductive Invariants
======================================

For properties that were proved safe with the CHC engine,
the SMTChecker can retrieve inductive invariants that were inferred by the Horn
solver as part of the proof.
Currently two types of invariants can be reported to the user:

- Contract Invariants: these are properties over the contract's state variables
that are true before and after every possible transaction that the contract may ever run. For example, ``x >= y``, where ``x`` and ``y`` are a contract's state variables.
- Reentrancy Properties: they represent the behavior of the contract
in the presence of external calls to unknown code. These properties can express a relation
between the value of the state variables before and after the external call, where the external call is free to do anything, including making reentrant calls to the analyzed contract. Primed variables represent the state variables' values after said external call. Example: ``lock -> x = x'``.

The user can choose the type of invariants to be reported using the CLI option ``--model-checker-invariants "contract,reentrancy"`` or as an array in the field ``settings.modelChecker.invariants`` in the :ref:`JSON input<compiler-api>`.
By default the SMTChecker does not report invariants.

Division and Modulo With Slack Variables
========================================

Expand Down
2 changes: 2 additions & 0 deletions docs/using-the-compiler.rst
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,8 @@ Input Description
"divModWithSlacks": true,
// Choose which model checker engine to use: all (default), bmc, chc, none.
"engine": "chc",
// Choose which types of invariants should be reported to the user: contract, reentrancy.
"invariants": ["contract", "reentrancy"],
// Choose whether to output all unproved targets. The default is `false`.
"showUnproved": true,
// Choose which solvers should be used, if available.
Expand Down
11 changes: 7 additions & 4 deletions docs/yul.rst
Original file line number Diff line number Diff line change
Expand Up @@ -959,10 +959,13 @@ to ``loadimmutable("name")`` in the runtime code.

linkersymbol
^^^^^^^^^^^^

The function ``linkersymbol("fq_library_name")`` is a placeholder for an address literal to be
substituted by the linker. Its first and only argument must be a string literal and represents the
fully qualified library name used with the ``--libraries`` option.
The function ``linkersymbol("library_id")`` is a placeholder for an address literal to be substituted
by the linker.
Its first and only argument must be a string literal and uniquely represents the address to be inserted.
Identifiers can be arbitrary but when the compiler produces Yul code from Solidity sources,
it uses a library name qualified with the name of the source unit that defines that library.
To link the code with a particular library address, the same identifier must be provided to the
``--libraries`` option on the command line.

For example this code

Expand Down
8 changes: 0 additions & 8 deletions libevmasm/LinkerObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,6 @@ LinkerObject::matchLibrary(
)
{
auto it = _libraryAddresses.find(_linkRefName);
if (it != _libraryAddresses.end())
return &it->second;
// If the user did not supply a fully qualified library name,
// try to match only the simple library name
size_t colon = _linkRefName.find(':');
if (colon == string::npos)
return nullptr;
it = _libraryAddresses.find(_linkRefName.substr(colon + 1));
if (it != _libraryAddresses.end())
return &it->second;
return nullptr;
Expand Down
5 changes: 5 additions & 0 deletions liblangutil/ErrorReporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,3 +261,8 @@ void ErrorReporter::info(
{
error(_error, Error::Type::Info, _location, _description);
}

void ErrorReporter::info(ErrorId _error, string const& _description)
{
error(_error, Error::Type::Info, SourceLocation(), _description);
}
2 changes: 2 additions & 0 deletions liblangutil/ErrorReporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ class ErrorReporter
std::string const& _description
);

void info(ErrorId _error, std::string const& _description);

void declarationError(
ErrorId _error,
SourceLocation const& _location,
Expand Down
15 changes: 15 additions & 0 deletions liblangutil/Exceptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@

#include <liblangutil/Exceptions.h>

#include <boost/algorithm/string/case_conv.hpp>
#include <boost/algorithm/string/trim.hpp>

using namespace std;
using namespace solidity;
using namespace solidity::langutil;
Expand Down Expand Up @@ -71,3 +74,15 @@ Error::Error(
if (!_description.empty())
*this << util::errinfo_comment(_description);
}

optional<Error::Severity> Error::severityFromString(string _input)
{
boost::algorithm::to_lower(_input);
boost::algorithm::trim(_input);

for (Severity severity: {Severity::Error, Severity::Warning, Severity::Info})
if (_input == formatErrorSeverityLowercase(severity))
return severity;

return nullopt;
}
2 changes: 2 additions & 0 deletions liblangutil/Exceptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,8 @@ class Error: virtual public util::Exception
solAssert(false, "");
}

static std::optional<Severity> severityFromString(std::string _input);

private:
ErrorId m_errorId;
Type m_type;
Expand Down
Loading