Skip to content

Commit 0755d65

Browse files
committed
Merge remote-tracking branch 'origin/develop' into breaking
2 parents 9fedf7f + ccdc11e commit 0755d65

File tree

217 files changed

+2000
-912
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

217 files changed

+2000
-912
lines changed

.circleci/soltest_all.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ set -e
2828

2929
REPODIR="$(realpath "$(dirname "$0")"/..)"
3030

31-
EVM_VALUES=(homestead byzantium constantinople petersburg istanbul berlin)
32-
DEFAULT_EVM=berlin
31+
EVM_VALUES=(homestead byzantium constantinople petersburg istanbul berlin london)
32+
DEFAULT_EVM=london
3333
[[ " ${EVM_VALUES[*]} " =~ $DEFAULT_EVM ]]
3434
OPTIMIZE_VALUES=(0 1)
3535
STEPS=$(( 1 + ${#EVM_VALUES[@]} * ${#OPTIMIZE_VALUES[@]} ))

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ include(EthPolicy)
2121
eth_policy()
2222

2323
# project name and version should be set after cmake_policy CMP0048
24-
set(PROJECT_VERSION "0.8.7")
24+
set(PROJECT_VERSION "0.8.8")
2525
# OSX target needed in order to support std::visit
2626
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14")
2727
project(solidity VERSION ${PROJECT_VERSION} LANGUAGES C CXX)

Changelog.md

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,49 @@ Breaking changes:
44
* `error` is now a keyword that can only be used for defining errors.
55

66

7-
### 0.8.7 (unreleased)
7+
### 0.8.8 (unreleased)
88

99
Language Features:
1010

1111

12+
Compiler Features:
13+
14+
15+
Bugfixes:
16+
17+
18+
19+
### 0.8.7 (2021-08-11)
20+
21+
Language Features:
22+
* Introduce global ``block.basefee`` for retrieving the base fee of the current block.
23+
* Yul: Introduce builtin ``basefee()`` for retrieving the base fee of the current block.
24+
25+
1226
Compiler Features:
1327
* AssemblyStack: Also run opcode-based optimizer when compiling Yul code.
14-
* Yul EVM Code Transform: Do not reuse stack slots that immediately become unreachable.
15-
* Yul EVM Code Transform: Also pop unused argument slots for functions without return variables (under the same restrictions as for functions with return variables).
16-
* Yul Optimizer: Move function arguments and return variables to memory with the experimental Stack Limit Evader (which is not enabled by default).
1728
* Commandline Interface: option ``--pretty-json`` works also with ``--standard--json``.
29+
* EVM: Set the default EVM version to "London".
30+
* SMTChecker: Do not check underflow and overflow by default.
1831
* SMTChecker: Unproved targets are hidden by default, and the SMTChecker only states how many unproved targets there are. They can be listed using the command line option ``--model-checker-show-unproved`` or the JSON option ``settings.modelChecker.showUnproved``.
32+
* SMTChecker: new setting to enable/disable encoding of division and modulo with slack variables. The command line option is ``--model-checker-div-mod-slacks`` and the JSON option is ``settings.modelChecker.divModWithSlacks``.
33+
* Yul EVM Code Transform: Also pop unused argument slots for functions without return variables (under the same restrictions as for functions with return variables).
34+
* Yul EVM Code Transform: Do not reuse stack slots that immediately become unreachable.
35+
* Yul Optimizer: Move function arguments and return variables to memory with the experimental Stack Limit Evader (which is not enabled by default).
1936

2037

2138
Bugfixes:
2239
* Code Generator: Fix crash when passing an empty string literal to ``bytes.concat()``.
2340
* Code Generator: Fix internal compiler error when calling functions bound to calldata structs and arrays.
2441
* Code Generator: Fix internal compiler error when passing a 32-byte hex literal or a zero literal to ``bytes.concat()`` by disallowing such literals.
42+
* Commandline Interface: Apply ``--optimizer-runs`` option in assembly / yul mode.
2543
* Commandline Interface: Fix crash when a directory path is passed to ``--standard-json``.
2644
* Commandline Interface: Read JSON from standard input when ``--standard-json`` gets ``-`` as a file name.
2745
* Standard JSON: Include source location for errors in files with empty name.
2846
* Type Checker: Fix internal error and prevent static calls to unimplemented modifiers.
2947
* Yul Code Generator: Fix internal compiler error when using a long literal with bitwise negation.
3048
* Yul Code Generator: Fix source location references for calls to builtin functions.
3149
* Yul Parser: Fix source location references for ``if`` statements.
32-
* Commandline Interface: Apply ``--optimizer-runs`` option in assembly / yul mode.
3350

3451

3552
### 0.8.6 (2021-06-22)

docs/bugs_by_version.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1551,5 +1551,9 @@
15511551
"0.8.6": {
15521552
"bugs": [],
15531553
"released": "2021-06-22"
1554+
},
1555+
"0.8.7": {
1556+
"bugs": [],
1557+
"released": "2021-08-11"
15541558
}
15551559
}

docs/cheatsheet.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ Global Variables
8484
to ``abi.encodeWithSelector(bytes4(keccak256(bytes(signature)), ...)```
8585
- ``bytes.concat(...) returns (bytes memory)``: :ref:`Concatenates variable number of
8686
arguments to one byte array<bytes-concat>`
87+
- ``block.basefee`` (``uint``): current block's base fee (`EIP-3198 <https://eips.ethereum.org/EIPS/eip-3198>`_ and `EIP-1559 <https://eips.ethereum.org/EIPS/eip-1559>`_)
8788
- ``block.chainid`` (``uint``): current chain id
8889
- ``block.coinbase`` (``address payable``): current block miner's address
8990
- ``block.difficulty`` (``uint``): current block difficulty

docs/grammar/SolidityLexer.g4

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,8 @@ YulEVMBuiltin:
284284
| 'returndatacopy' | 'extcodehash' | 'create' | 'create2' | 'call' | 'callcode'
285285
| 'delegatecall' | 'staticcall' | 'return' | 'revert' | 'selfdestruct' | 'invalid'
286286
| 'log0' | 'log1' | 'log2' | 'log3' | 'log4' | 'chainid' | 'origin' | 'gasprice'
287-
| 'blockhash' | 'coinbase' | 'timestamp' | 'number' | 'difficulty' | 'gaslimit';
287+
| 'blockhash' | 'coinbase' | 'timestamp' | 'number' | 'difficulty' | 'gaslimit'
288+
| 'basefee';
288289
289290
YulLBrace: '{' -> pushMode(YulMode);
290291
YulRBrace: '}' -> popMode;

docs/resources.rst

Lines changed: 50 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,49 @@
1+
#########
12
Resources
2-
---------
3+
#########
34

4-
General
5-
~~~~~~~
5+
General Resources
6+
=================
67

7-
* `Ethereum <https://ethereum.org>`_
8+
* `Ethereum.org Developer Portal <https://ethereum.org/en/developers/>`_
9+
* `Ethereum StackExchange <https://ethereum.stackexchange.com/>`_
10+
* `Solidity Portal <https://soliditylang.org/>`_
11+
* `Solidity Changelog <https://github.com/ethereum/solidity/blob/develop/Changelog.md>`_
12+
* `Solidity Source Code on GitHub <https://github.com/ethereum/solidity/>`_
13+
* `Solidity Language Users Chat <https://matrix.to/#/#ethereum_solidity:gitter.im>`_
14+
* `Solidity Compiler Developers Chat <https://matrix.to/#/#ethereum_solidity-dev:gitter.im>`_
15+
* `Awesome Solidity <https://github.com/bkrem/awesome-solidity>`_
16+
* `Solidity by Example <https://solidity-by-example.org/>`_
817

9-
* `Changelog <https://github.com/ethereum/solidity/blob/develop/Changelog.md>`_
1018

11-
* `Source Code <https://github.com/ethereum/solidity/>`_
19+
Integrated (Ethereum) Development Environments
20+
==============================================
1221

13-
* `Ethereum Stackexchange <https://ethereum.stackexchange.com/>`_
22+
* `Brownie <https://eth-brownie.readthedocs.io/en/stable/>`_
23+
Python-based development and testing framework for smart contracts targeting the Ethereum Virtual Machine.
1424

15-
* `Language Users Chat <https://gitter.im/ethereum/solidity/>`_
25+
* `Dapp <https://dapp.tools/>`_
26+
Tool for building, testing and deploying smart contracts from the command line.
1627

17-
* `Compiler Developers Chat <https://gitter.im/ethereum/solidity-dev/>`_
28+
* `Embark <https://framework.embarklabs.io/>`_
29+
Developer platform for building and deploying decentralized applications.
1830

19-
Solidity Integrations
20-
~~~~~~~~~~~~~~~~~~~~~
21-
22-
* Generic:
23-
24-
* `EthFiddle <https://ethfiddle.com/>`_
25-
Solidity IDE in the Browser. Write and share your Solidity code. Uses server-side components.
31+
* `Hardhat <https://hardhat.org/>`_
32+
Ethereum development environment with local Ethereum network, debugging features and plugin ecosystem.
2633

2734
* `Remix <https://remix.ethereum.org/>`_
2835
Browser-based IDE with integrated compiler and Solidity runtime environment without server-side components.
2936

30-
* `Solhint <https://github.com/protofire/solhint>`_
31-
Solidity linter that provides security, style guide and best practice rules for smart contract validation.
37+
* `Scaffold-ETH <https://github.com/austintgriffith/scaffold-eth>`_
38+
Ethereum development stack focused on fast product iterations.
3239

33-
* `Solidity IDE <https://github.com/System-Glitch/Solidity-IDE>`_
34-
Browser-based IDE with integrated compiler, Ganache and local file system support.
40+
* `Truffle <https://www.trufflesuite.com/truffle>`_
41+
Ethereum development framework.
3542

36-
* `Ethlint <https://github.com/duaraghav8/Ethlint>`_
37-
Linter to identify and fix style and security issues in Solidity.
43+
Editor Integrations
44+
===================
3845

39-
* `Superblocks Lab <https://lab.superblocks.com/>`_
40-
Browser-based IDE. Built-in browser-based VM and Metamask integration (one click deployment to Testnet/Mainnet).
41-
42-
* Atom:
46+
* Atom
4347

4448
* `Etheratom <https://github.com/0mkara/etheratom>`_
4549
Plugin for the Atom editor that features syntax highlighting, compilation and a runtime environment (Backend node & VM compatible).
@@ -50,63 +54,67 @@ Solidity Integrations
5054
* `Atom Solium Linter <https://atom.io/packages/linter-solium>`_
5155
Configurable Solidity linter for Atom using Solium (now Ethlint) as a base.
5256

53-
* Eclipse:
54-
55-
* `YAKINDU Solidity Tools <https://yakindu.github.io/solidity-ide/>`_
56-
Eclipse based IDE. Features context sensitive code completion and help, code navigation, syntax coloring, built in compiler, quick fixes and templates.
57-
58-
* Emacs:
57+
* Emacs
5958

6059
* `Emacs Solidity <https://github.com/ethereum/emacs-solidity/>`_
6160
Plugin for the Emacs editor providing syntax highlighting and compilation error reporting.
6261

63-
* IntelliJ:
62+
* IntelliJ
6463

6564
* `IntelliJ IDEA plugin <https://plugins.jetbrains.com/plugin/9475-intellij-solidity>`_
6665
Solidity plugin for IntelliJ IDEA (and all other JetBrains IDEs)
6766

68-
* Sublime:
67+
* Sublime
6968

7069
* `Package for SublimeText - Solidity language syntax <https://packagecontrol.io/packages/Ethereum/>`_
7170
Solidity syntax highlighting for SublimeText editor.
7271

73-
* Vim:
72+
* Vim
7473

7574
* `Vim Solidity <https://github.com/tomlion/vim-solidity/>`_
7675
Plugin for the Vim editor providing syntax highlighting.
7776

7877
* `Vim Syntastic <https://github.com/vim-syntastic/syntastic>`_
7978
Plugin for the Vim editor providing compile checking.
8079

81-
* Visual Studio Code:
80+
* Visual Studio Code
8281

8382
* `Visual Studio Code extension <https://juan.blanco.ws/solidity-contracts-in-visual-studio-code/>`_
8483
Solidity plugin for Microsoft Visual Studio Code that includes syntax highlighting and the Solidity compiler.
8584

8685
Solidity Tools
87-
~~~~~~~~~~~~~~
86+
==============
8887

8988
* `ABI to Solidity interface converter <https://gist.github.com/chriseth/8f533d133fa0c15b0d6eaf3ec502c82b>`_
9089
A script for generating contract interfaces from the ABI of a smart contract.
9190

92-
* `Dapp <https://dapp.tools/dapp/>`_
93-
Build tool, package manager, and deployment assistant for Solidity.
91+
* `abi-to-sol <https://github.com/gnidan/abi-to-sol>`_
92+
Tool to generate Solidity interface source from a given ABI JSON.
9493

9594
* `Doxity <https://github.com/DigixGlobal/doxity>`_
9695
Documentation Generator for Solidity.
9796

97+
* `Ethlint <https://github.com/duaraghav8/Ethlint>`_
98+
Linter to identify and fix style and security issues in Solidity.
99+
98100
* `evmdis <https://github.com/Arachnid/evmdis>`_
99101
EVM Disassembler that performs static analysis on the bytecode to provide a higher level of abstraction than raw EVM operations.
100102

101103
* `EVM Lab <https://github.com/ethereum/evmlab/>`_
102104
Rich tool package to interact with the EVM. Includes a VM, Etherchain API, and a trace-viewer with gas cost display.
103105

106+
* `hevm <https://github.com/dapphub/dapptools/tree/master/src/hevm#readme>`_
107+
EVM debugger and symbolic execution engine.
108+
104109
* `leafleth <https://github.com/clemlak/leafleth>`_
105110
A documentation generator for Solidity smart-contracts.
106111

107112
* `PIET <https://piet.slock.it/>`_
108113
A tool to develop, audit and use Solidity smart contracts through a simple graphical interface.
109114

115+
* `sol2uml <https://www.npmjs.com/package/sol2uml>`_
116+
Unified Modeling Language (UML) class diagram generator for Solidity contracts.
117+
110118
* `solc-select <https://github.com/crytic/solc-select>`_
111119
A script to quickly switch between Solidity compiler versions.
112120

@@ -119,8 +127,8 @@ Solidity Tools
119127
* `solgraph <https://github.com/raineorshine/solgraph>`_
120128
Visualize Solidity control flow and highlight potential security vulnerabilities.
121129

122-
* `Securify <https://securify.ch/>`_
123-
Fully automated online static analyzer for smart contracts, providing a security report based on vulnerability patterns.
130+
* `Solhint <https://github.com/protofire/solhint>`_
131+
Solidity linter that provides security, style guide and best practice rules for smart contract validation.
124132

125133
* `Sūrya <https://github.com/ConsenSys/surya/>`_
126134
Utility tool for smart contract systems, offering a number of visual outputs and information about the contracts' structure. Also supports querying the function call graph.
@@ -129,7 +137,7 @@ Solidity Tools
129137
A tool for mutation generation, with configurable rules and support for Solidity and Vyper.
130138

131139
Third-Party Solidity Parsers and Grammars
132-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
140+
=========================================
133141

134142
* `Solidity Parser for JavaScript <https://github.com/solidity-parser/parser>`_
135143
A Solidity parser for JS built on top of a robust ANTLR4 grammar.

docs/smtchecker.rst

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ The other verification targets that the SMTChecker checks at compile time are:
3434
- Out of bounds index access.
3535
- Insufficient funds for a transfer.
3636

37+
All the targets above are automatically checked by default if all engines are
38+
enabled, except underflow and overflow for Solidity >=0.8.7.
39+
3740
The potential warnings that the SMTChecker reports are:
3841

3942
- ``<failing property> happens here.``. This means that the SMTChecker proved that a certain property fails. A counterexample may be given, however in complex situations it may also not show a counterexample. This result may also be a false positive in certain cases, when the SMT encoding adds abstractions for Solidity code that is either hard or impossible to express.
@@ -93,8 +96,10 @@ Overflow
9396
}
9497
9598
The contract above shows an overflow check example.
96-
The SMTChecker will, by default, check every reachable arithmetic operation
97-
in the contract for potential underflow and overflow.
99+
The SMTChecker does not check underflow and overflow by default for Solidity >=0.8.7,
100+
so we need to use the command line option ``--model-checker-targets "underflow,overflow"``
101+
or the JSON option ``settings.modelChecker.targets = ["underflow", "overflow"]``.
102+
See :ref:`this section for targets configuration<smtchecker_targets>`.
98103
Here, it reports the following:
99104

100105
.. code-block:: text
@@ -447,6 +452,8 @@ If the SMTChecker does not manage to solve the contract properties with the defa
447452
a timeout can be given in milliseconds via the CLI option ``--model-checker-timeout <time>`` or
448453
the JSON option ``settings.modelChecker.timeout=<time>``, where 0 means no timeout.
449454

455+
.. _smtchecker_targets:
456+
450457
Verification Targets
451458
====================
452459

@@ -471,6 +478,8 @@ The keywords that represent the targets are:
471478
A common subset of targets might be, for example:
472479
``--model-checker-targets assert,overflow``.
473480

481+
All targets are checked by default, except underflow and overflow for Solidity >=0.8.7.
482+
474483
There is no precise heuristic on how and when to split verification targets,
475484
but it can be useful especially when dealing with large contracts.
476485

@@ -479,7 +488,7 @@ Unproved Targets
479488

480489
If there are any unproved targets, the SMTChecker issues one warning stating
481490
how many unproved targets there are. If the user wishes to see all the specific
482-
unproved targets, the CLI option ``--model-checker-show-unproved true`` and
491+
unproved targets, the CLI option ``--model-checker-show-unproved`` and
483492
the JSON option ``settings.modelChecker.showUnproved = true`` can be used.
484493

485494
Verified Contracts
@@ -509,7 +518,17 @@ which has the following form:
509518
"source2.sol": ["contract2", "contract3"]
510519
}
511520
512-
.. _smtchecker_engines:
521+
Division and Modulo With Slack Variables
522+
========================================
523+
524+
Spacer, the default Horn solver used by the SMTChecker, often dislikes division
525+
and modulo operations inside Horn rules. Because of that, by default the
526+
Solidity division and modulo operations are encoded using the constraint
527+
``a = b * d + m`` where ``d = a / b`` and ``m = a % b``.
528+
However, other solvers, such as Eldarica, prefer the syntactically precise operations.
529+
The command line flag ``--model-checker-div-mod-no-slacks`` and the JSON option
530+
``settings.modelChecker.divModNoSlacks`` can be used to toggle the encoding
531+
depending on the used solver preferences.
513532

514533
Natspec Function Abstraction
515534
============================
@@ -523,6 +542,8 @@ body of the function is not used, and when called, the function will:
523542
- Return a nondeterministic value, and either keep the state variables unchanged if the abstracted function is view/pure, or also set the state variables to nondeterministic values otherwise. This can be used via the annotation ``/// @custom:smtchecker abstract-function-nondet``.
524543
- Act as an uninterpreted function. This means that the semantics of the function (given by the body) are ignored, and the only property this function has is that given the same input it guarantees the same output. This is currently under development and will be available via the annotation ``/// @custom:smtchecker abstract-function-uf``.
525544

545+
.. _smtchecker_engines:
546+
526547
Model Checking Engines
527548
======================
528549

docs/units-and-global-variables.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ Block and Transaction Properties
7272
--------------------------------
7373

7474
- ``blockhash(uint blockNumber) returns (bytes32)``: hash of the given block when ``blocknumber`` is one of the 256 most recent blocks; otherwise returns zero
75+
- ``block.basefee`` (``uint``): current block's base fee (`EIP-3198 <https://eips.ethereum.org/EIPS/eip-3198>`_ and `EIP-1559 <https://eips.ethereum.org/EIPS/eip-1559>`_)
7576
- ``block.chainid`` (``uint``): current chain id
7677
- ``block.coinbase`` (``address payable``): current block miner's address
7778
- ``block.difficulty`` (``uint``): current block difficulty

0 commit comments

Comments
 (0)