diff --git a/.circleci/soltest_all.sh b/.circleci/soltest_all.sh index a79228637..353d81cd6 100755 --- a/.circleci/soltest_all.sh +++ b/.circleci/soltest_all.sh @@ -28,8 +28,8 @@ set -e REPODIR="$(realpath "$(dirname "$0")"/..)" -EVM_VALUES=(homestead byzantium constantinople petersburg istanbul berlin) -DEFAULT_EVM=berlin +EVM_VALUES=(homestead byzantium constantinople petersburg istanbul berlin london) +DEFAULT_EVM=london [[ " ${EVM_VALUES[*]} " =~ $DEFAULT_EVM ]] OPTIMIZE_VALUES=(0 1) STEPS=$(( 1 + ${#EVM_VALUES[@]} * ${#OPTIMIZE_VALUES[@]} )) diff --git a/CMakeLists.txt b/CMakeLists.txt index c35426f7d..e835a66ff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ include(EthPolicy) eth_policy() # project name and version should be set after cmake_policy CMP0048 -set(PROJECT_VERSION "0.8.7") +set(PROJECT_VERSION "0.8.8") # OSX target needed in order to support std::visit set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14") project(solidity VERSION ${PROJECT_VERSION} LANGUAGES C CXX) diff --git a/Changelog.md b/Changelog.md index 583da3cbb..42af34693 100644 --- a/Changelog.md +++ b/Changelog.md @@ -4,24 +4,42 @@ Breaking changes: * `error` is now a keyword that can only be used for defining errors. -### 0.8.7 (unreleased) +### 0.8.8 (unreleased) Language Features: +Compiler Features: + + +Bugfixes: + + + +### 0.8.7 (2021-08-11) + +Language Features: + * Introduce global ``block.basefee`` for retrieving the base fee of the current block. + * Yul: Introduce builtin ``basefee()`` for retrieving the base fee of the current block. + + Compiler Features: * AssemblyStack: Also run opcode-based optimizer when compiling Yul code. - * Yul EVM Code Transform: Do not reuse stack slots that immediately become unreachable. - * Yul EVM Code Transform: Also pop unused argument slots for functions without return variables (under the same restrictions as for functions with return variables). - * Yul Optimizer: Move function arguments and return variables to memory with the experimental Stack Limit Evader (which is not enabled by default). * Commandline Interface: option ``--pretty-json`` works also with ``--standard--json``. + * EVM: Set the default EVM version to "London". + * SMTChecker: Do not check underflow and overflow by default. * 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``. + * 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``. + * Yul EVM Code Transform: Also pop unused argument slots for functions without return variables (under the same restrictions as for functions with return variables). + * Yul EVM Code Transform: Do not reuse stack slots that immediately become unreachable. + * Yul Optimizer: Move function arguments and return variables to memory with the experimental Stack Limit Evader (which is not enabled by default). Bugfixes: * Code Generator: Fix crash when passing an empty string literal to ``bytes.concat()``. * Code Generator: Fix internal compiler error when calling functions bound to calldata structs and arrays. * Code Generator: Fix internal compiler error when passing a 32-byte hex literal or a zero literal to ``bytes.concat()`` by disallowing such literals. + * Commandline Interface: Apply ``--optimizer-runs`` option in assembly / yul mode. * Commandline Interface: Fix crash when a directory path is passed to ``--standard-json``. * Commandline Interface: Read JSON from standard input when ``--standard-json`` gets ``-`` as a file name. * Standard JSON: Include source location for errors in files with empty name. @@ -29,7 +47,6 @@ Bugfixes: * Yul Code Generator: Fix internal compiler error when using a long literal with bitwise negation. * Yul Code Generator: Fix source location references for calls to builtin functions. * Yul Parser: Fix source location references for ``if`` statements. - * Commandline Interface: Apply ``--optimizer-runs`` option in assembly / yul mode. ### 0.8.6 (2021-06-22) diff --git a/docs/bugs_by_version.json b/docs/bugs_by_version.json index 9f708595d..0c1dbbc18 100644 --- a/docs/bugs_by_version.json +++ b/docs/bugs_by_version.json @@ -1551,5 +1551,9 @@ "0.8.6": { "bugs": [], "released": "2021-06-22" + }, + "0.8.7": { + "bugs": [], + "released": "2021-08-11" } } \ No newline at end of file diff --git a/docs/cheatsheet.rst b/docs/cheatsheet.rst index c39209e37..4ff9118bc 100644 --- a/docs/cheatsheet.rst +++ b/docs/cheatsheet.rst @@ -84,6 +84,7 @@ Global Variables to ``abi.encodeWithSelector(bytes4(keccak256(bytes(signature)), ...)``` - ``bytes.concat(...) returns (bytes memory)``: :ref:`Concatenates variable number of arguments to one byte array` +- ``block.basefee`` (``uint``): current block's base fee (`EIP-3198 `_ and `EIP-1559 `_) - ``block.chainid`` (``uint``): current chain id - ``block.coinbase`` (``address payable``): current block miner's address - ``block.difficulty`` (``uint``): current block difficulty diff --git a/docs/grammar/SolidityLexer.g4 b/docs/grammar/SolidityLexer.g4 index 018df681a..77856857c 100644 --- a/docs/grammar/SolidityLexer.g4 +++ b/docs/grammar/SolidityLexer.g4 @@ -284,7 +284,8 @@ YulEVMBuiltin: | 'returndatacopy' | 'extcodehash' | 'create' | 'create2' | 'call' | 'callcode' | 'delegatecall' | 'staticcall' | 'return' | 'revert' | 'selfdestruct' | 'invalid' | 'log0' | 'log1' | 'log2' | 'log3' | 'log4' | 'chainid' | 'origin' | 'gasprice' - | 'blockhash' | 'coinbase' | 'timestamp' | 'number' | 'difficulty' | 'gaslimit'; + | 'blockhash' | 'coinbase' | 'timestamp' | 'number' | 'difficulty' | 'gaslimit' + | 'basefee'; YulLBrace: '{' -> pushMode(YulMode); YulRBrace: '}' -> popMode; diff --git a/docs/resources.rst b/docs/resources.rst index 01c4715a1..5b8d0013a 100644 --- a/docs/resources.rst +++ b/docs/resources.rst @@ -1,45 +1,49 @@ +######### Resources ---------- +######### -General -~~~~~~~ +General Resources +================= -* `Ethereum `_ +* `Ethereum.org Developer Portal `_ +* `Ethereum StackExchange `_ +* `Solidity Portal `_ +* `Solidity Changelog `_ +* `Solidity Source Code on GitHub `_ +* `Solidity Language Users Chat `_ +* `Solidity Compiler Developers Chat `_ +* `Awesome Solidity `_ +* `Solidity by Example `_ -* `Changelog `_ -* `Source Code `_ +Integrated (Ethereum) Development Environments +============================================== -* `Ethereum Stackexchange `_ + * `Brownie `_ + Python-based development and testing framework for smart contracts targeting the Ethereum Virtual Machine. -* `Language Users Chat `_ + * `Dapp `_ + Tool for building, testing and deploying smart contracts from the command line. -* `Compiler Developers Chat `_ + * `Embark `_ + Developer platform for building and deploying decentralized applications. -Solidity Integrations -~~~~~~~~~~~~~~~~~~~~~ - -* Generic: - - * `EthFiddle `_ - Solidity IDE in the Browser. Write and share your Solidity code. Uses server-side components. + * `Hardhat `_ + Ethereum development environment with local Ethereum network, debugging features and plugin ecosystem. * `Remix `_ Browser-based IDE with integrated compiler and Solidity runtime environment without server-side components. - * `Solhint `_ - Solidity linter that provides security, style guide and best practice rules for smart contract validation. + * `Scaffold-ETH `_ + Ethereum development stack focused on fast product iterations. - * `Solidity IDE `_ - Browser-based IDE with integrated compiler, Ganache and local file system support. + * `Truffle `_ + Ethereum development framework. - * `Ethlint `_ - Linter to identify and fix style and security issues in Solidity. +Editor Integrations +=================== - * `Superblocks Lab `_ - Browser-based IDE. Built-in browser-based VM and Metamask integration (one click deployment to Testnet/Mainnet). - -* Atom: +* Atom * `Etheratom `_ Plugin for the Atom editor that features syntax highlighting, compilation and a runtime environment (Backend node & VM compatible). @@ -50,27 +54,22 @@ Solidity Integrations * `Atom Solium Linter `_ Configurable Solidity linter for Atom using Solium (now Ethlint) as a base. -* Eclipse: - - * `YAKINDU Solidity Tools `_ - Eclipse based IDE. Features context sensitive code completion and help, code navigation, syntax coloring, built in compiler, quick fixes and templates. - -* Emacs: +* Emacs * `Emacs Solidity `_ Plugin for the Emacs editor providing syntax highlighting and compilation error reporting. -* IntelliJ: +* IntelliJ * `IntelliJ IDEA plugin `_ Solidity plugin for IntelliJ IDEA (and all other JetBrains IDEs) -* Sublime: +* Sublime * `Package for SublimeText - Solidity language syntax `_ Solidity syntax highlighting for SublimeText editor. -* Vim: +* Vim * `Vim Solidity `_ Plugin for the Vim editor providing syntax highlighting. @@ -78,35 +77,44 @@ Solidity Integrations * `Vim Syntastic `_ Plugin for the Vim editor providing compile checking. -* Visual Studio Code: +* Visual Studio Code * `Visual Studio Code extension `_ Solidity plugin for Microsoft Visual Studio Code that includes syntax highlighting and the Solidity compiler. Solidity Tools -~~~~~~~~~~~~~~ +============== * `ABI to Solidity interface converter `_ A script for generating contract interfaces from the ABI of a smart contract. -* `Dapp `_ - Build tool, package manager, and deployment assistant for Solidity. +* `abi-to-sol `_ + Tool to generate Solidity interface source from a given ABI JSON. * `Doxity `_ Documentation Generator for Solidity. +* `Ethlint `_ + Linter to identify and fix style and security issues in Solidity. + * `evmdis `_ EVM Disassembler that performs static analysis on the bytecode to provide a higher level of abstraction than raw EVM operations. * `EVM Lab `_ Rich tool package to interact with the EVM. Includes a VM, Etherchain API, and a trace-viewer with gas cost display. +* `hevm `_ + EVM debugger and symbolic execution engine. + * `leafleth `_ A documentation generator for Solidity smart-contracts. * `PIET `_ A tool to develop, audit and use Solidity smart contracts through a simple graphical interface. +* `sol2uml `_ + Unified Modeling Language (UML) class diagram generator for Solidity contracts. + * `solc-select `_ A script to quickly switch between Solidity compiler versions. @@ -119,8 +127,8 @@ Solidity Tools * `solgraph `_ Visualize Solidity control flow and highlight potential security vulnerabilities. -* `Securify `_ - Fully automated online static analyzer for smart contracts, providing a security report based on vulnerability patterns. +* `Solhint `_ + Solidity linter that provides security, style guide and best practice rules for smart contract validation. * `Sūrya `_ 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 A tool for mutation generation, with configurable rules and support for Solidity and Vyper. Third-Party Solidity Parsers and Grammars -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +========================================= * `Solidity Parser for JavaScript `_ A Solidity parser for JS built on top of a robust ANTLR4 grammar. diff --git a/docs/smtchecker.rst b/docs/smtchecker.rst index e2b61cf35..d1e8f6c81 100644 --- a/docs/smtchecker.rst +++ b/docs/smtchecker.rst @@ -34,6 +34,9 @@ The other verification targets that the SMTChecker checks at compile time are: - Out of bounds index access. - Insufficient funds for a transfer. +All the targets above are automatically checked by default if all engines are +enabled, except underflow and overflow for Solidity >=0.8.7. + The potential warnings that the SMTChecker reports are: - `` 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 } The contract above shows an overflow check example. -The SMTChecker will, by default, check every reachable arithmetic operation -in the contract for potential underflow and overflow. +The SMTChecker does not check underflow and overflow by default for Solidity >=0.8.7, +so we need to use the command line option ``--model-checker-targets "underflow,overflow"`` +or the JSON option ``settings.modelChecker.targets = ["underflow", "overflow"]``. +See :ref:`this section for targets configuration`. Here, it reports the following: .. code-block:: text @@ -447,6 +452,8 @@ If the SMTChecker does not manage to solve the contract properties with the defa a timeout can be given in milliseconds via the CLI option ``--model-checker-timeout