Merge pull request #9862 from ethereum/develop

Merge develop into breaking
This commit is contained in:
chriseth
2020-09-23 12:22:32 +02:00
committed by GitHub
126 changed files with 2962 additions and 320 deletions
@@ -16,7 +16,6 @@
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"fullyImplemented": true,
"id": 8,
"linearizedBaseContracts":
[
@@ -25,7 +25,6 @@
null
],
"contractKind": "contract",
"fullyImplemented": true,
"linearizedBaseContracts":
[
8
@@ -16,7 +16,6 @@
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"fullyImplemented": true,
"id": 6,
"linearizedBaseContracts":
[
@@ -25,7 +25,6 @@
null
],
"contractKind": "contract",
"fullyImplemented": true,
"linearizedBaseContracts":
[
6
@@ -52,7 +52,7 @@ BOOST_AUTO_TEST_CASE(function_no_implementation)
std::vector<ASTPointer<ASTNode>> nodes = sourceUnit->nodes();
ContractDefinition* contract = dynamic_cast<ContractDefinition*>(nodes[1].get());
BOOST_REQUIRE(contract);
BOOST_CHECK(!contract->annotation().unimplementedDeclarations.empty());
BOOST_CHECK(!contract->annotation().unimplementedDeclarations->empty());
BOOST_CHECK(!contract->definedFunctions()[0]->isImplemented());
}
@@ -68,10 +68,10 @@ BOOST_AUTO_TEST_CASE(abstract_contract)
ContractDefinition* base = dynamic_cast<ContractDefinition*>(nodes[1].get());
ContractDefinition* derived = dynamic_cast<ContractDefinition*>(nodes[2].get());
BOOST_REQUIRE(base);
BOOST_CHECK(!base->annotation().unimplementedDeclarations.empty());
BOOST_CHECK(!base->annotation().unimplementedDeclarations->empty());
BOOST_CHECK(!base->definedFunctions()[0]->isImplemented());
BOOST_REQUIRE(derived);
BOOST_CHECK(derived->annotation().unimplementedDeclarations.empty());
BOOST_CHECK(derived->annotation().unimplementedDeclarations->empty());
BOOST_CHECK(derived->definedFunctions()[0]->isImplemented());
}
@@ -87,9 +87,9 @@ BOOST_AUTO_TEST_CASE(abstract_contract_with_overload)
ContractDefinition* base = dynamic_cast<ContractDefinition*>(nodes[1].get());
ContractDefinition* derived = dynamic_cast<ContractDefinition*>(nodes[2].get());
BOOST_REQUIRE(base);
BOOST_CHECK(!base->annotation().unimplementedDeclarations.empty());
BOOST_CHECK(!base->annotation().unimplementedDeclarations->empty());
BOOST_REQUIRE(derived);
BOOST_CHECK(!derived->annotation().unimplementedDeclarations.empty());
BOOST_CHECK(!derived->annotation().unimplementedDeclarations->empty());
}
BOOST_AUTO_TEST_CASE(implement_abstract_via_constructor)
@@ -104,7 +104,7 @@ BOOST_AUTO_TEST_CASE(implement_abstract_via_constructor)
BOOST_CHECK_EQUAL(nodes.size(), 3);
ContractDefinition* derived = dynamic_cast<ContractDefinition*>(nodes[2].get());
BOOST_REQUIRE(derived);
BOOST_CHECK(!derived->annotation().unimplementedDeclarations.empty());
BOOST_CHECK(!derived->annotation().unimplementedDeclarations->empty());
}
BOOST_AUTO_TEST_CASE(function_canonical_signature)
@@ -0,0 +1,53 @@
contract C {
uint256[1024] s;
function f() public returns (uint256 x) {
x = 42;
uint256 x0 = s[0];
uint256 x1 = s[1];
uint256 x2 = s[2];
uint256 x3 = s[3];
uint256 x4 = s[4];
uint256 x5 = s[5];
uint256 x6 = s[6];
uint256 x7 = s[7];
uint256 x8 = s[8];
uint256 x9 = s[9];
uint256 x10 = s[10];
uint256 x11 = s[11];
uint256 x12 = s[12];
uint256 x13 = s[13];
uint256 x14 = s[14];
uint256 x15 = s[15];
uint256 x16 = s[16];
uint256 x17 = s[17];
uint256 x18 = s[18];
s[1000] = x0 + 2;
s[118] = x18;
s[117] = x17;
s[116] = x16;
s[115] = x15;
s[114] = x14;
s[113] = x13;
s[112] = x12;
s[111] = x11;
s[110] = x10;
s[109] = x9;
s[108] = x8;
s[107] = x7;
s[106] = x6;
s[105] = x5;
s[104] = x4;
s[103] = x3;
s[102] = x2;
s[101] = x1;
s[100] = x0;
}
function test() public view returns(uint256) {
return s[1000];
}
}
// ====
// compileViaYul: true
// ----
// f() -> 0x2a
// test() -> 2
@@ -0,0 +1,57 @@
contract C {
uint256[1024] s;
function g() public returns (uint256) {
// try to prevent inlining
return f() + f() + f() + f() + f();
}
function f() public returns (uint256 x) {
x = 42;
uint256 x0 = s[0];
uint256 x1 = s[1];
uint256 x2 = s[2];
uint256 x3 = s[3];
uint256 x4 = s[4];
uint256 x5 = s[5];
uint256 x6 = s[6];
uint256 x7 = s[7];
uint256 x8 = s[8];
uint256 x9 = s[9];
uint256 x10 = s[10];
uint256 x11 = s[11];
uint256 x12 = s[12];
uint256 x13 = s[13];
uint256 x14 = s[14];
uint256 x15 = s[15];
uint256 x16 = s[16];
uint256 x17 = s[17];
uint256 x18 = s[18];
s[1000] = x0 + 2;
s[118] = x18;
s[117] = x17;
s[116] = x16;
s[115] = x15;
s[114] = x14;
s[113] = x13;
s[112] = x12;
s[111] = x11;
s[110] = x10;
s[109] = x9;
s[108] = x8;
s[107] = x7;
s[106] = x6;
s[105] = x5;
s[104] = x4;
s[103] = x3;
s[102] = x2;
s[101] = x1;
s[100] = x0;
}
function test() public view returns(uint256) {
return s[1000];
}
}
// ====
// compileViaYul: true
// ----
// f() -> 0x2a
// test() -> 2
@@ -15,6 +15,3 @@ contract C
}
}
// ----
// Warning 5084: (208-218): Type conversion is not yet fully supported and might yield false positives.
// Warning 5084: (123-133): Type conversion is not yet fully supported and might yield false positives.
// Warning 5084: (208-218): Type conversion is not yet fully supported and might yield false positives.
@@ -20,8 +20,3 @@ contract C
}
}
// ----
// Warning 5084: (271-281): Type conversion is not yet fully supported and might yield false positives.
// Warning 5084: (123-133): Type conversion is not yet fully supported and might yield false positives.
// Warning 5084: (271-281): Type conversion is not yet fully supported and might yield false positives.
// Warning 5084: (186-196): Type conversion is not yet fully supported and might yield false positives.
// Warning 5084: (271-281): Type conversion is not yet fully supported and might yield false positives.
@@ -20,8 +20,3 @@ contract C
}
}
// ----
// Warning 5084: (275-285): Type conversion is not yet fully supported and might yield false positives.
// Warning 5084: (123-133): Type conversion is not yet fully supported and might yield false positives.
// Warning 5084: (275-285): Type conversion is not yet fully supported and might yield false positives.
// Warning 5084: (189-199): Type conversion is not yet fully supported and might yield false positives.
// Warning 5084: (275-285): Type conversion is not yet fully supported and might yield false positives.
@@ -25,7 +25,3 @@ contract C
}
// ----
// Warning 5084: (275-285): Type conversion is not yet fully supported and might yield false positives.
// Warning 5084: (123-133): Type conversion is not yet fully supported and might yield false positives.
// Warning 5084: (189-199): Type conversion is not yet fully supported and might yield false positives.
// Warning 5084: (275-285): Type conversion is not yet fully supported and might yield false positives.
@@ -16,6 +16,3 @@ contract C
}
}
// ----
// Warning 5084: (219-229): Type conversion is not yet fully supported and might yield false positives.
// Warning 5084: (134-144): Type conversion is not yet fully supported and might yield false positives.
// Warning 5084: (219-229): Type conversion is not yet fully supported and might yield false positives.
@@ -19,6 +19,3 @@ contract C
}
}
// ----
// Warning 5084: (249-259): Type conversion is not yet fully supported and might yield false positives.
// Warning 5084: (118-128): Type conversion is not yet fully supported and might yield false positives.
// Warning 5084: (249-259): Type conversion is not yet fully supported and might yield false positives.
@@ -20,6 +20,3 @@ contract C
}
}
// ----
// Warning 5084: (247-257): Type conversion is not yet fully supported and might yield false positives.
// Warning 5084: (162-172): Type conversion is not yet fully supported and might yield false positives.
// Warning 5084: (247-257): Type conversion is not yet fully supported and might yield false positives.
@@ -35,4 +35,3 @@ contract C {
}
// ----
// Warning 6328: (528-565): Assertion violation happens here.
// Warning 5084: (544-554): Type conversion is not yet fully supported and might yield false positives.
@@ -44,4 +44,3 @@ contract C {
// ----
// Warning 6328: (452-466): Assertion violation happens here.
// Warning 6328: (470-496): Assertion violation happens here.
// Warning 5084: (92-102): Type conversion is not yet fully supported and might yield false positives.
@@ -36,4 +36,3 @@ contract C {
// ----
// Warning 6328: (381-395): Assertion violation happens here.
// Warning 6328: (399-425): Assertion violation happens here.
// Warning 5084: (116-126): Type conversion is not yet fully supported and might yield false positives.
@@ -40,4 +40,3 @@ contract C {
// ----
// Warning 6328: (435-461): Assertion violation happens here.
// Warning 6328: (594-631): Assertion violation happens here.
// Warning 5084: (610-620): Type conversion is not yet fully supported and might yield false positives.
@@ -13,4 +13,3 @@ contract C {
}
}
// ----
// Warning 5084: (198-208): Type conversion is not yet fully supported and might yield false positives.
@@ -13,4 +13,3 @@ contract C {
}
}
// ----
// Warning 5084: (107-117): Type conversion is not yet fully supported and might yield false positives.
@@ -17,5 +17,3 @@ contract C
}
}
// ----
// Warning 5084: (205-215): Type conversion is not yet fully supported and might yield false positives.
// Warning 5084: (205-215): Type conversion is not yet fully supported and might yield false positives.
@@ -10,4 +10,3 @@ contract C
}
}
// ----
// Warning 5084: (98-108): Type conversion is not yet fully supported and might yield false positives.
@@ -0,0 +1,25 @@
pragma experimental SMTChecker;
contract C {
address x; // We know that this is "zero initialised".
function f() public view {
address a = address(0);
assert(x == address(0));
assert(x == a);
}
function g() public pure {
address a = address(0);
address b = address(1);
address c = address(0);
address d = a;
address e = address(0x12345678);
assert(c == d);
assert(a == c);
assert(e == address(305419896));
// This is untrue.
assert(a == b);
}
}
// ----
// Warning 6328: (487-501): Assertion violation happens here.
@@ -8,5 +8,3 @@ contract C
}
}
// ----
// Warning 5084: (98-108): Type conversion is not yet fully supported and might yield false positives.
// Warning 5084: (125-135): Type conversion is not yet fully supported and might yield false positives.
@@ -11,4 +11,3 @@ contract C {
}
}
// ----
// Warning 5084: (142-152): Type conversion is not yet fully supported and might yield false positives.
@@ -0,0 +1,13 @@
contract test {
function f(uint a, bool b, bytes memory c, uint d, bool e) public returns (uint r) {
if (b && !e)
r = a + d;
else
r = c.length;
}
function g() public returns (uint r) {
r = f({c: "abc", x: 1, e: 2, a: 11, b: 12});
}
}
// ----
// TypeError 4974: (249-288): Named argument "x" does not match function declaration.
@@ -13,6 +13,8 @@ contract b {
}
// ----
// Warning 7325: (66-67): Type struct b.c covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction.
// Warning 7325: (66-67): Type uint256[14474011154664524427946373126085988481658748083205070504932198000989141204992] covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction.
// Warning 7325: (111-112): Type struct b.c covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction.
// Warning 7325: (111-112): Type uint256[14474011154664524427946373126085988481658748083205070504932198000989141204992] covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction.
// Warning 7325: (152-169): Type function ()[984770902183611232881] covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction.
// Warning 2072: (152-180): Unused local variable.
@@ -56,13 +56,19 @@ contract C {
}
// ----
// Warning 7325: (106-108): Type struct C.S0 covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction.
// Warning 7325: (106-108): Type struct C.P[101] covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction.
// Warning 7325: (171-173): Type struct C.S1 covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction.
// Warning 7325: (171-173): Type struct C.P[102] covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction.
// Warning 7325: (341-343): Type struct C.P[103] covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction.
// Warning 7325: (341-343): Type struct C.P[104] covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction.
// Warning 7325: (505-507): Type uint256[100000000000000000002] covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction.
// Warning 7325: (505-507): Type uint256[100000000000000000004] covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction.
// Warning 7325: (505-507): Type struct C.Q0 covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction.
// Warning 7325: (505-507): Type uint256[1][][100000000000000000001] covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction.
// Warning 7325: (505-507): Type uint256[][100000000000000000003] covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction.
// Warning 7325: (505-507): Type uint256[100000000000000000004] covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction.
// Warning 7325: (505-507): Type uint256[100000000000000000002] covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction.
// Warning 7325: (576-578): Type struct C.Q1 covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction.
// Warning 7325: (576-578): Type uint256[1][][100000000000000000005] covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction.
// Warning 7325: (647-649): Type uint256[100000000000000000006] covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction.
// Warning 7325: (715-717): Type struct C.Q3 covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction.
// Warning 7325: (715-717): Type uint256[][100000000000000000007] covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction.
// Warning 7325: (783-785): Type uint256[100000000000000000008] covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction.
@@ -4,5 +4,5 @@ contract C {
uint[2**255][2] a;
}
// ----
// TypeError 7676: (60-97): Contract too large for storage.
// TypeError 7676: (60-97): Contract requires too much storage.
// TypeError 1534: (77-94): Type too large for storage.
@@ -5,4 +5,4 @@ contract C {
uint[2**255] b;
}
// ----
// TypeError 7676: (60-114): Contract too large for storage.
// TypeError 7676: (60-114): Contract requires too much storage.
@@ -7,4 +7,4 @@ contract D is C {
uint[2**255] b;
}
// ----
// TypeError 7676: (95-134): Contract too large for storage.
// TypeError 7676: (95-134): Contract requires too much storage.
@@ -8,5 +8,5 @@ contract C {
S s;
}
// ----
// TypeError 7676: (60-152): Contract too large for storage.
// TypeError 7676: (60-152): Contract requires too much storage.
// TypeError 1534: (146-149): Type too large for storage.
@@ -4,3 +4,4 @@ contract C {
}
// ----
// Warning 7325: (64-65): Type struct C.S covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction.
// Warning 7325: (64-65): Type uint256[57896044618658097711785492504343953926634992332820282019728792003956564819968] covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction.
@@ -1,11 +0,0 @@
contract test {
function a(uint a, uint b) public returns (uint r) {
r = a + b;
}
function b() public returns (uint r) {
r = a({a: 1, c: 2});
}
}
// ----
// Warning 2519: (31-37): This declaration shadows an existing declaration.
// TypeError 4974: (153-168): Named argument "c" does not match function declaration.
@@ -0,0 +1,7 @@
contract C {
function f() public pure {
abi.encodePacked([new uint[](5), new uint[](7)]);
}
}
// ----
// TypeError 9578: (69-99): Type not supported in packed mode.
@@ -0,0 +1,9 @@
pragma experimental ABIEncoderV2;
contract C {
function f() public pure {
abi.encodePacked([new uint[](5), new uint[](7)]);
}
}
// ----
// TypeError 9578: (104-134): Type not supported in packed mode.
@@ -0,0 +1,7 @@
contract C {
function test() public pure {
abi.encode([new uint[](5), new uint[](7)]);
}
}
// ----
// TypeError 2056: (66-96): This type cannot be encoded.
@@ -0,0 +1,9 @@
pragma experimental ABIEncoderV2;
contract C {
function f() public pure {
abi.encode([new uint[](5), new uint[](7)]);
}
}
// ----
// Warning 6133: (87-129): Statement has no effect.
@@ -0,0 +1,7 @@
contract C {
function f() public pure {
abi.decode("1234", (uint[][3]));
}
}
// ----
// TypeError 9611: (72-81): Decoding type uint256[] memory[3] memory not supported.
@@ -0,0 +1,9 @@
pragma experimental ABIEncoderV2;
contract C {
function f() public pure {
abi.decode("1234", (uint[][3]));
}
}
// ----
// Warning 6133: (87-118): Statement has no effect.
@@ -0,0 +1,11 @@
struct S {
uint x;
}
contract C {
function f() public pure {
abi.decode("1234", (S));
}
}
// ----
// TypeError 9611: (98-99): Decoding type struct S memory not supported.
@@ -0,0 +1,13 @@
pragma experimental ABIEncoderV2;
struct S {
uint x;
}
contract C {
function f() public pure {
abi.decode("1234", (S));
}
}
// ----
// Warning 6133: (113-136): Statement has no effect.