Merge remote-tracking branch 'origin/develop' into HEAD

This commit is contained in:
chriseth
2020-09-29 09:53:50 +02:00
509 changed files with 1813 additions and 932 deletions
+1 -1
View File
@@ -537,7 +537,7 @@ For example,
::
// SPDX-License-Identifier: GPL-3.0
pragma solidity >0.6.99 <0.9.0;
pragma solidity >=0.6.99 <0.9.0;
contract Test {
+1 -1
View File
@@ -140,7 +140,7 @@ Local Solidity variables are available for assignments, for example:
.. code::
// SPDX-License-Identifier: GPL-3.0
pragma solidity >0.6.99 <0.9.0;
pragma solidity >=0.7.0 <0.9.0;
contract C {
uint b;
+8
View File
@@ -1,4 +1,12 @@
[
{
"name": "FreeFunctionRedefinition",
"summary": "The compiler does not flag an error when two or more free functions with the same name and parameter types are defined in a source unit or when an imported free function alias shadows another free function with a different name but identical parameter types.",
"description": "In contrast to functions defined inside contracts, free functions with identical names and parameter types did not create an error. Both definition of free functions with identical name and parameter types and an imported free function with an alias that shadows another function with a different name but identical parameter types were permitted due to which a call to either the multiply defined free function or the imported free function alias within a contract led to the execution of that free function which was defined first within the source unit. Subsequently defined identical free function definitions were silently ignored and their code generation was skipped.",
"introduced": "0.7.1",
"fixed": "0.7.2",
"severity": "low"
},
{
"name": "UsingForCalldata",
"summary": "Function calls to internal library functions with calldata parameters called via ``using for`` can result in invalid data being read.",
+7 -1
View File
@@ -1187,7 +1187,13 @@
"released": "2020-07-28"
},
"0.7.1": {
"bugs": [],
"bugs": [
"FreeFunctionRedefinition"
],
"released": "2020-09-02"
},
"0.7.2": {
"bugs": [],
"released": "2020-09-28"
}
}
+2 -2
View File
@@ -28,7 +28,7 @@ you receive the funds of the person who is now the richest.
::
// SPDX-License-Identifier: GPL-3.0
pragma solidity >0.6.99 <0.9.0;
pragma solidity >=0.7.0 <0.9.0;
contract WithdrawalContract {
address public richest;
@@ -62,7 +62,7 @@ This is as opposed to the more intuitive sending pattern:
::
// SPDX-License-Identifier: GPL-3.0
pragma solidity >0.6.99 <0.9.0;
pragma solidity >=0.7.0 <0.9.0;
contract SendContract {
address payable public richest;
+1 -1
View File
@@ -26,7 +26,7 @@ Not all types for constants and immutables are implemented at this time. The onl
::
// SPDX-License-Identifier: GPL-3.0
pragma solidity >0.6.99 <0.9.0;
pragma solidity >=0.7.0 <0.9.0;
contract C {
uint constant X = 32**22 + 8;
+7 -7
View File
@@ -39,7 +39,7 @@ Details are given in the following example.
::
// SPDX-License-Identifier: GPL-3.0
pragma solidity >0.6.99 <0.9.0;
pragma solidity >=0.7.0 <0.9.0;
contract Owned {
@@ -127,7 +127,7 @@ destruction request. The way this is done is problematic, as
seen in the following example::
// SPDX-License-Identifier: GPL-3.0
pragma solidity >0.6.99 <0.9.0;
pragma solidity >=0.7.0 <0.9.0;
contract owned {
constructor() { owner = msg.sender; }
@@ -157,7 +157,7 @@ explicitly in the final override, but this function will bypass
``Base1.destroy``. The way around this is to use ``super``::
// SPDX-License-Identifier: GPL-3.0
pragma solidity >0.6.99 <0.9.0;
pragma solidity >=0.7.0 <0.9.0;
contract owned {
constructor() { owner = msg.sender; }
@@ -214,7 +214,7 @@ The following example demonstrates changing mutability and visibility:
::
// SPDX-License-Identifier: GPL-3.0
pragma solidity >0.6.99 <0.9.0;
pragma solidity >=0.7.0 <0.9.0;
contract Base
{
@@ -405,7 +405,7 @@ equivalent to ``constructor() {}``. For example:
::
// SPDX-License-Identifier: GPL-3.0
pragma solidity >0.6.99 <0.9.0;
pragma solidity >=0.7.0 <0.9.0;
abstract contract A {
uint public a;
@@ -442,7 +442,7 @@ linearization rules explained below. If the base constructors have arguments,
derived contracts need to specify all of them. This can be done in two ways::
// SPDX-License-Identifier: GPL-3.0
pragma solidity >0.6.99 <0.9.0;
pragma solidity >=0.7.0 <0.9.0;
contract Base {
uint x;
@@ -523,7 +523,7 @@ One area where inheritance linearization is especially important and perhaps not
::
// SPDX-License-Identifier: GPL-3.0
pragma solidity >0.6.99 <0.9.0;
pragma solidity >=0.7.0 <0.9.0;
contract Base1 {
constructor() {}
+2 -4
View File
@@ -192,8 +192,7 @@ is compiled so recursive creation-dependencies are not possible.
::
// SPDX-License-Identifier: GPL-3.0
pragma solidity >0.6.99 <0.9.0;
pragma solidity >=0.7.0 <0.9.0;
contract D {
uint public x;
constructor(uint a) payable {
@@ -248,8 +247,7 @@ which only need to be created if there is a dispute.
::
// SPDX-License-Identifier: GPL-3.0
pragma solidity >0.6.99 <0.9.0;
pragma solidity >=0.7.0 <0.9.0;
contract D {
uint public x;
constructor(uint a) {
+2 -4
View File
@@ -25,8 +25,7 @@ to receive their money - contracts cannot activate themselves.
::
// SPDX-License-Identifier: GPL-3.0
pragma solidity >0.6.99 <0.9.0;
pragma solidity >=0.7.0 <0.9.0;
contract SimpleAuction {
// Parameters of the auction. Times are either
// absolute unix timestamps (seconds since 1970-01-01)
@@ -186,8 +185,7 @@ invalid bids.
::
// SPDX-License-Identifier: GPL-3.0
pragma solidity >0.6.99 <0.9.0;
pragma solidity >=0.7.0 <0.9.0;
contract BlindAuction {
struct Bid {
bytes32 blindedBid;
+2 -4
View File
@@ -142,8 +142,7 @@ The full contract
::
// SPDX-License-Identifier: GPL-3.0
pragma solidity >0.6.99 <0.9.0;
pragma solidity >=0.7.0 <0.9.0;
contract ReceiverPays {
address owner = msg.sender;
@@ -339,8 +338,7 @@ The full contract
::
// SPDX-License-Identifier: GPL-3.0
pragma solidity >0.6.99 <0.9.0;
pragma solidity >=0.7.0 <0.9.0;
contract SimplePaymentChannel {
address payable public sender; // The account sending payments.
address payable public recipient; // The account receiving the payments.
+2 -3
View File
@@ -26,8 +26,7 @@ you can use state machine-like constructs inside a contract.
::
// SPDX-License-Identifier: GPL-3.0
pragma solidity >0.6.99 <0.9.0;
pragma solidity >=0.7.0 <0.9.0;
contract Purchase {
uint public value;
address payable public seller;
@@ -143,4 +142,4 @@ you can use state machine-like constructs inside a contract.
seller.transfer(3 * value);
}
}
}
+1 -2
View File
@@ -33,8 +33,7 @@ of votes.
::
// SPDX-License-Identifier: GPL-3.0
pragma solidity >0.6.99 <0.9.0;
pragma solidity >=0.7.0 <0.9.0;
/// @title Voting with delegation.
contract Ballot {
// This declares a new complex type which will
+2 -4
View File
@@ -201,8 +201,7 @@ Never use tx.origin for authorization. Let's say you have a wallet contract like
::
// SPDX-License-Identifier: GPL-3.0
pragma solidity >0.6.99 <0.9.0;
pragma solidity >=0.7.0 <0.9.0;
// THIS CONTRACT CONTAINS A BUG - DO NOT USE
contract TxUserWallet {
address owner;
@@ -222,8 +221,7 @@ Now someone tricks you into sending Ether to the address of this attack wallet:
::
// SPDX-License-Identifier: GPL-3.0
pragma solidity >0.6.99 <0.9.0;
pragma solidity >=0.7.0 <0.9.0;
interface TxUserWallet {
function transferTo(address payable dest, uint amount) external;
}
+6 -12
View File
@@ -300,8 +300,7 @@ Within a grouping, place the ``view`` and ``pure`` functions last.
Yes::
// SPDX-License-Identifier: GPL-3.0
pragma solidity >0.6.99 <0.9.0;
pragma solidity >=0.7.0 <0.9.0;
contract A {
constructor() {
// ...
@@ -337,8 +336,7 @@ Yes::
No::
// SPDX-License-Identifier: GPL-3.0
pragma solidity >0.6.99 <0.9.0;
pragma solidity >=0.7.0 <0.9.0;
contract A {
// External functions
@@ -758,8 +756,7 @@ manner as modifiers if the function declaration is long or hard to read.
Yes::
// SPDX-License-Identifier: GPL-3.0
pragma solidity >0.6.99 <0.9.0;
pragma solidity >=0.7.0 <0.9.0;
// Base contracts just to make this compile
contract B {
constructor(uint) {
@@ -790,8 +787,7 @@ Yes::
No::
// SPDX-License-Identifier: GPL-3.0
pragma solidity >0.6.99 <0.9.0;
pragma solidity >=0.7.0 <0.9.0;
// Base contracts just to make this compile
contract B {
@@ -1012,8 +1008,7 @@ As shown in the example below, if the contract name is ``Congress`` and the libr
Yes::
// SPDX-License-Identifier: GPL-3.0
pragma solidity >0.6.99 <0.9.0;
pragma solidity >=0.7.0 <0.9.0;
// Owned.sol
contract Owned {
@@ -1048,8 +1043,7 @@ and in ``Congress.sol``::
No::
// SPDX-License-Identifier: GPL-3.0
pragma solidity >0.6.99 <0.9.0;
pragma solidity >=0.7.0 <0.9.0;
// owned.sol
contract owned {
+1 -2
View File
@@ -434,8 +434,7 @@ Array slices are useful to ABI-decode secondary data passed in function paramete
::
// SPDX-License-Identifier: GPL-3.0
pragma solidity >0.6.99 <0.9.0;
pragma solidity >=0.7.0 <0.9.0;
contract Proxy {
/// @dev Address of the client contract managed by proxy i.e., this contract
address client;
+14 -1
View File
@@ -314,6 +314,7 @@ Input Description
// evm.bytecode.opcodes - Opcodes list
// evm.bytecode.sourceMap - Source mapping (useful for debugging)
// evm.bytecode.linkReferences - Link references (if unlinked object)
// evm.bytecode.generatedSources - Sources generated by the compiler
// evm.deployedBytecode* - Deployed bytecode (has all the options that evm.bytecode has)
// evm.deployedBytecode.immutableReferences - Map from AST ids to bytecode ranges that reference immutables
// evm.methodIdentifiers - The list of function hashes
@@ -427,6 +428,18 @@ Output Description
"opcodes": "",
// The source mapping as a string. See the source mapping definition.
"sourceMap": "",
// Array of sources generated by the compiler. Currently only
// contains a single Yul file.
"generatedSources": [{
// Yul AST
"ast": { ... }
// Source file in its text form (may contain comments)
"contents":"{ function abi_decode(start, end) -> data { data := calldataload(start) } }",
// Source file ID, used for source references, same "namespace" as the Solidity source files
"id": 2,
"language": "Yul",
"name": "#utility.yul"
}]
// If given, this is an unlinked object.
"linkReferences": {
"libraryFile.sol": {
@@ -693,8 +706,8 @@ have to be updated manually.)
.. code-block:: Solidity
pragma solidity >0.6.99 <0.9.0;
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
abstract contract C {
// FIXME: remove constructor visibility and make the contract abstract
constructor() {}