mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge remote-tracking branch 'origin/develop' into breaking
This commit is contained in:
@@ -1 +1 @@
|
||||
{"contracts":{"A":{"C":{"evm":{"bytecode":{"generatedSources":[],"linkReferences":{},"object":"<BYTECODE REMOVED>","opcodes":"<OPCODES REMOVED>","sourceMap":"<SOURCEMAP REMOVED>"}}}}},"sources":{"A":{"id":0}}}
|
||||
{"contracts":{"A":{"C":{"evm":{"bytecode":{"linkReferences":{},"object":"<BYTECODE REMOVED>"}}}}},"sources":{"A":{"id":0}}}
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"contracts":{"A\"B":{"C":{"evm":{"bytecode":{"generatedSources":[],"linkReferences":{},"object":"<BYTECODE REMOVED>","opcodes":"<OPCODES REMOVED>","sourceMap":"<SOURCEMAP REMOVED>"}}}}},"sources":{"A\"B":{"id":0}}}
|
||||
{"contracts":{"A\"B":{"C":{"evm":{"bytecode":{"linkReferences":{},"object":"<BYTECODE REMOVED>"}}}}},"sources":{"A\"B":{"id":0}}}
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"contracts":{"A":{"C":{"evm":{"bytecode":{"generatedSources":[],"linkReferences":{"A":{"L2":[{"length":20,"start":184},{"length":20,"start":368}]}},"object":"<BYTECODE REMOVED>__$622b2f540b6a16ff5db7bea656ad8fcf4f$__<BYTECODE REMOVED>__$622b2f540b6a16ff5db7bea656ad8fcf4f$__<BYTECODE REMOVED>","opcodes":"<OPCODES REMOVED>","sourceMap":"<SOURCEMAP REMOVED>"}}}}},"sources":{"A":{"id":0}}}
|
||||
{"contracts":{"A":{"C":{"evm":{"bytecode":{"linkReferences":{"A":{"L2":[{"length":20,"start":184},{"length":20,"start":368}]}},"object":"<BYTECODE REMOVED>__$622b2f540b6a16ff5db7bea656ad8fcf4f$__<BYTECODE REMOVED>__$622b2f540b6a16ff5db7bea656ad8fcf4f$__<BYTECODE REMOVED>"}}}}},"sources":{"A":{"id":0}}}
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"contracts":{"A":{"a":{"evm":{"bytecode":{"generatedSources":[],"linkReferences":{},"object":"<BYTECODE REMOVED>","opcodes":"<OPCODES REMOVED>","sourceMap":"<SOURCEMAP REMOVED>"}}}}},"errors":[{"component":"general","formattedMessage":"Yul is still experimental. Please use the output with care.","message":"Yul is still experimental. Please use the output with care.","severity":"warning","type":"Warning"}]}
|
||||
{"contracts":{"A":{"a":{"evm":{"bytecode":{"linkReferences":{},"object":"<BYTECODE REMOVED>"}}}}},"errors":[{"component":"general","formattedMessage":"Yul is still experimental. Please use the output with care.","message":"Yul is still experimental. Please use the output with care.","severity":"warning","type":"Warning"}]}
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"contracts":{"A":{"a":{"evm":{"bytecode":{"generatedSources":[],"linkReferences":{},"object":"<BYTECODE REMOVED>","opcodes":"<OPCODES REMOVED>","sourceMap":"<SOURCEMAP REMOVED>"}}}}},"errors":[{"component":"general","formattedMessage":"Yul is still experimental. Please use the output with care.","message":"Yul is still experimental. Please use the output with care.","severity":"warning","type":"Warning"}]}
|
||||
{"contracts":{"A":{"a":{"evm":{"bytecode":{"linkReferences":{},"object":"<BYTECODE REMOVED>"}}}}},"errors":[{"component":"general","formattedMessage":"Yul is still experimental. Please use the output with care.","message":"Yul is still experimental. Please use the output with care.","severity":"warning","type":"Warning"}]}
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"contracts":{"A":{"a":{"evm":{"bytecode":{"generatedSources":[],"linkReferences":{"contract/test.sol":{"L2":[{"length":20,"start":22}]}},"object":"<BYTECODE REMOVED>__$fb58009a6b1ecea3b9d99bedd645df4ec3$__<BYTECODE REMOVED>","opcodes":"<OPCODES REMOVED>","sourceMap":"<SOURCEMAP REMOVED>"}}}}},"errors":[{"component":"general","formattedMessage":"Yul is still experimental. Please use the output with care.","message":"Yul is still experimental. Please use the output with care.","severity":"warning","type":"Warning"}]}
|
||||
{"contracts":{"A":{"a":{"evm":{"bytecode":{"linkReferences":{"contract/test.sol":{"L2":[{"length":20,"start":22}]}},"object":"<BYTECODE REMOVED>__$fb58009a6b1ecea3b9d99bedd645df4ec3$__<BYTECODE REMOVED>"}}}}},"errors":[{"component":"general","formattedMessage":"Yul is still experimental. Please use the output with care.","message":"Yul is still experimental. Please use the output with care.","severity":"warning","type":"Warning"}]}
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"contracts":{"a.sol":{"A1":{"evm":{"bytecode":{"generatedSources":[],"linkReferences":{},"object":"<BYTECODE REMOVED>","opcodes":"<OPCODES REMOVED>","sourceMap":"<SOURCEMAP REMOVED>"}}}},"b.sol":{"A1":{"evm":{"bytecode":{"generatedSources":[],"linkReferences":{},"object":"<BYTECODE REMOVED>","opcodes":"<OPCODES REMOVED>","sourceMap":"<SOURCEMAP REMOVED>"}}}}},"sources":{"a.sol":{"id":0},"b.sol":{"id":1}}}
|
||||
{"contracts":{"a.sol":{"A1":{"evm":{"bytecode":{"object":"<BYTECODE REMOVED>"}}}},"b.sol":{"A1":{"evm":{"bytecode":{"object":"<BYTECODE REMOVED>"}}}}},"sources":{"a.sol":{"id":0},"b.sol":{"id":1}}}
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"contracts":{"a.sol":{"A2":{"evm":{"bytecode":{"generatedSources":[],"linkReferences":{},"object":"<BYTECODE REMOVED>","opcodes":"<OPCODES REMOVED>","sourceMap":"<SOURCEMAP REMOVED>"}}}}},"sources":{"a.sol":{"id":0},"b.sol":{"id":1}}}
|
||||
{"contracts":{"a.sol":{"A2":{"evm":{"bytecode":{"object":"<BYTECODE REMOVED>"}}}}},"sources":{"a.sol":{"id":0},"b.sol":{"id":1}}}
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"contracts":{"a.sol":{"A1":{"evm":{"bytecode":{"generatedSources":[],"linkReferences":{},"object":"<BYTECODE REMOVED>","opcodes":"<OPCODES REMOVED>","sourceMap":"<SOURCEMAP REMOVED>"}}},"A2":{"evm":{"bytecode":{"generatedSources":[],"linkReferences":{},"object":"<BYTECODE REMOVED>","opcodes":"<OPCODES REMOVED>","sourceMap":"<SOURCEMAP REMOVED>"}}}},"b.sol":{"A1":{"evm":{"bytecode":{"generatedSources":[],"linkReferences":{},"object":"<BYTECODE REMOVED>","opcodes":"<OPCODES REMOVED>","sourceMap":"<SOURCEMAP REMOVED>"}}},"B2":{"evm":{"bytecode":{"generatedSources":[],"linkReferences":{},"object":"<BYTECODE REMOVED>","opcodes":"<OPCODES REMOVED>","sourceMap":"<SOURCEMAP REMOVED>"}}}}},"sources":{"a.sol":{"id":0},"b.sol":{"id":1}}}
|
||||
{"contracts":{"a.sol":{"A1":{"evm":{"bytecode":{"object":"<BYTECODE REMOVED>"}}},"A2":{"evm":{"bytecode":{"object":"<BYTECODE REMOVED>"}}}},"b.sol":{"A1":{"evm":{"bytecode":{"object":"<BYTECODE REMOVED>"}}},"B2":{"evm":{"bytecode":{"object":"<BYTECODE REMOVED>"}}}}},"sources":{"a.sol":{"id":0},"b.sol":{"id":1}}}
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"contracts":{"a.sol":{"A1":{"evm":{"bytecode":{"generatedSources":[],"linkReferences":{},"object":"<BYTECODE REMOVED>","opcodes":"<OPCODES REMOVED>","sourceMap":"<SOURCEMAP REMOVED>"}}}}},"sources":{"a.sol":{"id":0},"b.sol":{"id":1}}}
|
||||
{"contracts":{"a.sol":{"A1":{"evm":{"bytecode":{"object":"<BYTECODE REMOVED>"}}}}},"sources":{"a.sol":{"id":0},"b.sol":{"id":1}}}
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"contracts":{"b.sol":{"B2":{"evm":{"bytecode":{"generatedSources":[],"linkReferences":{},"object":"<BYTECODE REMOVED>","opcodes":"<OPCODES REMOVED>","sourceMap":"<SOURCEMAP REMOVED>"}}}}},"sources":{"a.sol":{"id":0},"b.sol":{"id":1}}}
|
||||
{"contracts":{"b.sol":{"B2":{"evm":{"bytecode":{"object":"<BYTECODE REMOVED>"}}}}},"sources":{"a.sol":{"id":0},"b.sol":{"id":1}}}
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"contracts":{"a.sol":{"A1":{"evm":{"bytecode":{"generatedSources":[],"linkReferences":{},"object":"<BYTECODE REMOVED>","opcodes":"<OPCODES REMOVED>","sourceMap":"<SOURCEMAP REMOVED>"}}},"A2":{"evm":{"bytecode":{"generatedSources":[],"linkReferences":{},"object":"<BYTECODE REMOVED>","opcodes":"<OPCODES REMOVED>","sourceMap":"<SOURCEMAP REMOVED>"}}}}},"sources":{"a.sol":{"id":0},"b.sol":{"id":1}}}
|
||||
{"contracts":{"a.sol":{"A1":{"evm":{"bytecode":{"object":"<BYTECODE REMOVED>"}}},"A2":{"evm":{"bytecode":{"object":"<BYTECODE REMOVED>"}}}}},"sources":{"a.sol":{"id":0},"b.sol":{"id":1}}}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
{"contracts":{"a.sol":{"A":{"evm":{"deployedBytecode":{"generatedSources":[],"immutableReferences":{"6":[{"length":32,"start":77}]},"linkReferences":{},"object":"<BYTECODE REMOVED>","opcodes":"<OPCODES REMOVED>","sourceMap":"59:100:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;101:56;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;135:7;153:1;146:8;;101:56;:::o"}}}}},"sources":{"a.sol":{"id":0}}}
|
||||
{"contracts":{"a.sol":{"A":{"evm":{"deployedBytecode":{"immutableReferences":{"6":[{"length":32,"start":77}]}}}}}},"sources":{"a.sol":{"id":0}}}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,4 +1,4 @@
|
||||
{"contracts":{"A":{"C":{"evm":{"bytecode":{"generatedSources":[],"linkReferences":{},"object":"<BYTECODE REMOVED>","opcodes":"<OPCODES REMOVED>","sourceMap":""},"deployedBytecode":{"generatedSources":[],"immutableReferences":{},"linkReferences":{},"object":"","opcodes":"","sourceMap":""}},"ir":"/*******************************************************
|
||||
{"contracts":{"A":{"C":{"evm":{"bytecode":{"generatedSources":[],"object":"<BYTECODE REMOVED>"},"deployedBytecode":{"object":""}},"ir":"/*******************************************************
|
||||
* WARNING *
|
||||
* Solidity to Yul compilation is still EXPERIMENTAL *
|
||||
* It can result in LOSS OF FUNDS or worse *
|
||||
@@ -49,7 +49,7 @@ object \"C_2\" {
|
||||
|
||||
}
|
||||
|
||||
"},"D":{"evm":{"bytecode":{"generatedSources":[],"linkReferences":{},"object":"<BYTECODE REMOVED>","opcodes":"<OPCODES REMOVED>","sourceMap":""},"deployedBytecode":{"generatedSources":[],"immutableReferences":{},"linkReferences":{},"object":"","opcodes":"","sourceMap":""}},"ir":"/*******************************************************
|
||||
"},"D":{"evm":{"bytecode":{"generatedSources":[],"object":"<BYTECODE REMOVED>"},"deployedBytecode":{"object":""}},"ir":"/*******************************************************
|
||||
* WARNING *
|
||||
* Solidity to Yul compilation is still EXPERIMENTAL *
|
||||
* It can result in LOSS OF FUNDS or worse *
|
||||
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C {
|
||||
|
||||
uint x;
|
||||
|
||||
modifier check() {
|
||||
require(x == 0);
|
||||
_;
|
||||
assert(x == 1); // should fail;
|
||||
assert(x == 0); // should hold;
|
||||
}
|
||||
|
||||
modifier inc() {
|
||||
if (x == 0) {
|
||||
return;
|
||||
}
|
||||
x = x + 1;
|
||||
_;
|
||||
}
|
||||
|
||||
function test() check inc public {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (103-117): CHC: Assertion violation happens here.
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C {
|
||||
|
||||
uint x;
|
||||
|
||||
function reset_if_overflow() internal postinc {
|
||||
if (x < 10)
|
||||
return;
|
||||
x = 0;
|
||||
}
|
||||
|
||||
modifier postinc() {
|
||||
if (x == 0) {
|
||||
return;
|
||||
}
|
||||
_;
|
||||
x = x + 1;
|
||||
}
|
||||
|
||||
function test() public {
|
||||
if (x == 0) {
|
||||
reset_if_overflow();
|
||||
assert(x == 1); // should fail;
|
||||
assert(x == 0); // should hold;
|
||||
return;
|
||||
}
|
||||
if (x < 10) {
|
||||
uint oldx = x;
|
||||
reset_if_overflow();
|
||||
assert(oldx + 1 == x); // should hold;
|
||||
assert(oldx == x); // should fail;
|
||||
return;
|
||||
}
|
||||
reset_if_overflow();
|
||||
assert(x == 1); // should hold;
|
||||
assert(x == 0); // should fail;
|
||||
}
|
||||
|
||||
function set(uint _x) public {
|
||||
x = _x;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (384-398): CHC: Assertion violation happens here.
|
||||
// Warning 6328: (635-652): CHC: Assertion violation happens here.
|
||||
// Warning 6328: (781-795): CHC: Assertion violation happens here.
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract A {
|
||||
int x;
|
||||
constructor (int a) { x = a;}
|
||||
}
|
||||
|
||||
contract B is A {
|
||||
int y;
|
||||
constructor(int a) A(-a) {
|
||||
if (a > 0) {
|
||||
y = 2;
|
||||
return;
|
||||
}
|
||||
else {
|
||||
y = 3;
|
||||
}
|
||||
y = 4; // overwrites the else branch
|
||||
}
|
||||
}
|
||||
|
||||
contract C is B {
|
||||
constructor(int a) B(a) {
|
||||
assert(y != 3); // should hold
|
||||
assert(y == 4); // should fail
|
||||
if (a > 0) {
|
||||
assert(x < 0 && y == 2); // should hold
|
||||
assert(x < 0 && y == 4); // should fail
|
||||
}
|
||||
else {
|
||||
assert(x >= 0 && y == 4); // should hold
|
||||
assert(x >= 0 && y == 2); // should fail
|
||||
assert(x > 0); // should fail
|
||||
}
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (330-344): CHC: Assertion violation happens here.
|
||||
// Warning 6328: (422-445): CHC: Assertion violation happens here.
|
||||
// Warning 6328: (522-546): CHC: Assertion violation happens here.
|
||||
// Warning 6328: (566-579): CHC: Assertion violation happens here.
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract A {
|
||||
uint x = 1;
|
||||
}
|
||||
|
||||
contract B is A {
|
||||
constructor(int a) {
|
||||
if (a > 0) {
|
||||
x = 2;
|
||||
return;
|
||||
}
|
||||
x = 3;
|
||||
}
|
||||
}
|
||||
|
||||
abstract contract C is B {
|
||||
}
|
||||
|
||||
contract D is C {
|
||||
constructor(int a) B(a) {
|
||||
assert(a > 0 || x == 3); // should hold
|
||||
assert(a <= 0 || x == 2); // should hold
|
||||
assert(x == 1); // should fail
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (319-333): CHC: Assertion violation happens here.
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract A {
|
||||
int x;
|
||||
}
|
||||
|
||||
contract B is A {
|
||||
int y;
|
||||
constructor (int a) {
|
||||
if (a >= 0) {
|
||||
y = 1;
|
||||
return;
|
||||
}
|
||||
x = 1;
|
||||
y = 2;
|
||||
}
|
||||
}
|
||||
|
||||
contract C is A {
|
||||
int z;
|
||||
constructor (int a) {
|
||||
if (a >= 0) {
|
||||
z = 1;
|
||||
return;
|
||||
}
|
||||
x = -1;
|
||||
z = 2;
|
||||
}
|
||||
}
|
||||
|
||||
contract D1 is B, C {
|
||||
constructor() B(1) C(1) {
|
||||
assert(x == 0); // should hold
|
||||
assert(x == 1); // should fail
|
||||
assert(x == -1); // should fail
|
||||
}
|
||||
}
|
||||
|
||||
contract D2 is B, C {
|
||||
constructor() B(1) C(-1) {
|
||||
assert(x == 0); // should fail
|
||||
assert(x == 1); // should fail
|
||||
assert(x == -1); // should hold (constructor of C is executed AFTER constructor of B)
|
||||
}
|
||||
}
|
||||
|
||||
contract D3 is B, C {
|
||||
constructor() B(-1) C(1) {
|
||||
assert(x == 0); // should fail
|
||||
assert(x == 1); // should hold
|
||||
assert(x == -1); // should fail
|
||||
}
|
||||
}
|
||||
|
||||
contract D4 is B, C {
|
||||
constructor() B(-1) C(-1) {
|
||||
assert(x == 0); // should fail
|
||||
assert(x == 1); // should fail
|
||||
assert(x == -1); // should hold (constructor of C is executed AFTER constructor of B)
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (370-384): CHC: Assertion violation happens here.
|
||||
// Warning 6328: (403-418): CHC: Assertion violation happens here.
|
||||
// Warning 6328: (493-507): CHC: Assertion violation happens here.
|
||||
// Warning 6328: (526-540): CHC: Assertion violation happens here.
|
||||
// Warning 6328: (703-717): CHC: Assertion violation happens here.
|
||||
// Warning 6328: (769-784): CHC: Assertion violation happens here.
|
||||
// Warning 6328: (860-874): CHC: Assertion violation happens here.
|
||||
// Warning 6328: (893-907): CHC: Assertion violation happens here.
|
||||
@@ -0,0 +1,31 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract B {
|
||||
int x;
|
||||
constructor(int b) {
|
||||
if (b > 0) {
|
||||
x = 1;
|
||||
return;
|
||||
}
|
||||
else {
|
||||
x = 2;
|
||||
return;
|
||||
}
|
||||
x = 3; // dead code
|
||||
}
|
||||
}
|
||||
|
||||
contract C is B {
|
||||
constructor(int a) B(a) {
|
||||
assert(a > 0 || x == 2); // should hold
|
||||
assert(a <= 0 || x == 1); // should hold
|
||||
assert(x == 3); // should fail
|
||||
assert(x == 2); // should fail
|
||||
assert(x == 1); // should fail
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 5740: (152-157): Unreachable code.
|
||||
// Warning 6328: (310-324): CHC: Assertion violation happens here.
|
||||
// Warning 6328: (343-357): CHC: Assertion violation happens here.
|
||||
// Warning 6328: (376-390): CHC: Assertion violation happens here.
|
||||
@@ -0,0 +1,26 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C {
|
||||
|
||||
function test(uint256 a, uint256 b) public pure {
|
||||
assert(nested_if(a,b) != 42); // should hold
|
||||
assert(nested_if(a,b) == 1); // should fail
|
||||
}
|
||||
|
||||
function nested_if(uint256 a, uint256 b) internal pure returns (uint256) {
|
||||
if (a < 5) {
|
||||
if (b > 1) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (a == 2 && b == 2) {
|
||||
return 42; // unreachable
|
||||
}
|
||||
else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (147-174): CHC: Assertion violation happens here.
|
||||
// Warning 6838: (332-348): BMC: Condition is always false.
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C {
|
||||
|
||||
function test() public pure {
|
||||
assert(branches(0) == 0);
|
||||
assert(branches(1) == 42);
|
||||
}
|
||||
|
||||
function branches(uint256 a) internal pure returns (uint256) {
|
||||
if (a == 0) {
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
return 42;
|
||||
}
|
||||
return 1; // dead code
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 5740: (265-273): Unreachable code.
|
||||
@@ -0,0 +1,10 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C {
|
||||
function test(uint256 a, uint256 b) public pure returns (uint256) {
|
||||
if (a == 0) {
|
||||
return 0;
|
||||
}
|
||||
return b / a; // This division is safe because of the early return in if-block.
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C {
|
||||
|
||||
function test(uint256 a) public pure {
|
||||
assert(simple_if(a) == 1); // should fail for a == 0
|
||||
}
|
||||
|
||||
function simple_if(uint256 a) internal pure returns (uint256) {
|
||||
if (a == 0) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (89-114): CHC: Assertion violation happens here.
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C {
|
||||
|
||||
uint[] a;
|
||||
|
||||
constructor () {
|
||||
a.push();
|
||||
a.push();
|
||||
}
|
||||
|
||||
function check() public {
|
||||
require(a.length >= 2);
|
||||
require(a[1] == 0);
|
||||
conditional_store();
|
||||
assert(a[1] == 1); // should fail;
|
||||
assert(a[1] == 0); // should hold;
|
||||
}
|
||||
|
||||
function conditional_store() internal {
|
||||
if (a[1] == 0) {
|
||||
return;
|
||||
}
|
||||
a[1] = 1;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (205-222): CHC: Assertion violation happens here.
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C {
|
||||
|
||||
uint x;
|
||||
|
||||
function check() public {
|
||||
require(x == 0);
|
||||
conditional_increment();
|
||||
assert(x == 1); // should fail;
|
||||
assert(x == 0); // should hold;
|
||||
}
|
||||
|
||||
function conditional_increment() internal {
|
||||
if (x == 0) {
|
||||
return;
|
||||
}
|
||||
x = 1;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (132-146): CHC: Assertion violation happens here.
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C {
|
||||
|
||||
struct S {
|
||||
uint x;
|
||||
}
|
||||
S s;
|
||||
|
||||
function check() public {
|
||||
require(s.x == 0);
|
||||
conditional_increment();
|
||||
assert(s.x == 1); // should fail;
|
||||
assert(s.x == 0); // should hold;
|
||||
}
|
||||
|
||||
function conditional_increment() internal {
|
||||
if (s.x == 0) {
|
||||
return;
|
||||
}
|
||||
s.x = 1;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (156-172): CHC: Assertion violation happens here.
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C {
|
||||
|
||||
struct S {
|
||||
uint x;
|
||||
}
|
||||
S s;
|
||||
|
||||
function check() public {
|
||||
require(s.x == 0);
|
||||
conditional_increment();
|
||||
assert(s.x == 1); // should fail;
|
||||
assert(s.x == 0); // should hold;
|
||||
}
|
||||
|
||||
function conditional_increment() internal {
|
||||
if (s.x == 0) {
|
||||
return;
|
||||
}
|
||||
s = S(1);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (156-172): CHC: Assertion violation happens here.
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C {
|
||||
|
||||
uint x;
|
||||
uint y;
|
||||
|
||||
function check() public {
|
||||
require(x == 0);
|
||||
require(y == 0);
|
||||
conditional_increment();
|
||||
assert(x == 0); // should fail;
|
||||
assert(x == 1); // should fail;
|
||||
assert(x == 2); // should hold;
|
||||
}
|
||||
|
||||
function conditional_increment() internal {
|
||||
if (x == 0) {
|
||||
(x,y) = (2,2);
|
||||
return;
|
||||
}
|
||||
(x,y) = (1,1);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (160-174): CHC: Assertion violation happens here.
|
||||
// Warning 6328: (194-208): CHC: Assertion violation happens here.
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C {
|
||||
|
||||
uint a;
|
||||
uint b;
|
||||
uint c;
|
||||
|
||||
function test() public view {
|
||||
if (a == 0) {
|
||||
if (b == 0) {
|
||||
if (c == 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
assert(a != 0 || b != 0 || c != 0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C {
|
||||
function add(uint x, uint y) internal pure returns (uint) {
|
||||
if (y == 0)
|
||||
return x;
|
||||
if (y == 1)
|
||||
return ++x;
|
||||
if (y == 2)
|
||||
return x + 2;
|
||||
return x + y;
|
||||
}
|
||||
|
||||
function f() public pure {
|
||||
assert(add(100, 0) == 100);
|
||||
assert(add(100, 1) == 101);
|
||||
assert(add(100, 2) == 102);
|
||||
assert(add(100, 100) == 200);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 2661: (158-161): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.
|
||||
@@ -0,0 +1,26 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C {
|
||||
function add(uint x, uint y) internal pure returns (uint) {
|
||||
if (y == 0)
|
||||
return x;
|
||||
if (y == 1)
|
||||
return ++x;
|
||||
if (y == 2)
|
||||
return x + 2;
|
||||
return x + y;
|
||||
}
|
||||
|
||||
function f() public pure {
|
||||
assert(add(100, 0) != 100);
|
||||
assert(add(100, 1) != 101);
|
||||
assert(add(100, 2) != 102);
|
||||
assert(add(100, 100) != 200);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (244-270): CHC: Assertion violation happens here.
|
||||
// Warning 6328: (274-300): CHC: Assertion violation happens here.
|
||||
// Warning 6328: (304-330): CHC: Assertion violation happens here.
|
||||
// Warning 6328: (334-362): CHC: Assertion violation happens here.
|
||||
// Warning 2661: (158-161): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.
|
||||
@@ -0,0 +1,31 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C {
|
||||
uint c;
|
||||
function add(uint x, uint y) internal returns (uint) {
|
||||
c = 0xff;
|
||||
if (y == 0)
|
||||
return x;
|
||||
c = 0xffff;
|
||||
if (y == 1)
|
||||
return ++x;
|
||||
c = 0xffffff;
|
||||
if (y == 2)
|
||||
return x + 2;
|
||||
c = 0xffffffff;
|
||||
return x + y;
|
||||
}
|
||||
|
||||
function f() public {
|
||||
assert(add(100, 0) == 100);
|
||||
assert(c == 0xff);
|
||||
assert(add(100, 1) == 101);
|
||||
assert(c == 0xffff);
|
||||
assert(add(100, 2) == 102);
|
||||
assert(c == 0xffffff);
|
||||
assert(add(100, 100) == 200);
|
||||
assert(c == 0xffffffff);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 2661: (188-191): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.
|
||||
@@ -0,0 +1,39 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C {
|
||||
uint c;
|
||||
function add(uint x, uint y) internal returns (uint) {
|
||||
c = 0xff;
|
||||
if (y == 0)
|
||||
return x;
|
||||
c = 0xffff;
|
||||
if (y == 1)
|
||||
return ++x;
|
||||
c = 0xffffff;
|
||||
if (y == 2)
|
||||
return x + 2;
|
||||
c = 0xffffffff;
|
||||
return x + y;
|
||||
}
|
||||
|
||||
function f() public {
|
||||
assert(add(100, 0) != 100);
|
||||
assert(c != 0xff);
|
||||
assert(add(100, 1) != 101);
|
||||
assert(c != 0xffff);
|
||||
assert(add(100, 2) != 102);
|
||||
assert(c != 0xffffff);
|
||||
assert(add(100, 100) != 200);
|
||||
assert(c != 0xffffffff);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (303-329): CHC: Assertion violation happens here.
|
||||
// Warning 6328: (333-350): CHC: Assertion violation happens here.
|
||||
// Warning 6328: (354-380): CHC: Assertion violation happens here.
|
||||
// Warning 6328: (384-403): CHC: Assertion violation happens here.
|
||||
// Warning 6328: (407-433): CHC: Assertion violation happens here.
|
||||
// Warning 6328: (437-458): CHC: Assertion violation happens here.
|
||||
// Warning 6328: (462-490): CHC: Assertion violation happens here.
|
||||
// Warning 6328: (494-517): CHC: Assertion violation happens here.
|
||||
// Warning 2661: (188-191): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.
|
||||
@@ -1,7 +1,11 @@
|
||||
pragma experimental SMTChecker;
|
||||
contract C {
|
||||
function f() public pure returns (byte) {
|
||||
return (byte("") & (""));
|
||||
}
|
||||
function f() public pure {
|
||||
assert(byte("") & ("") == byte(0)); // should hold
|
||||
assert(byte(0xAA) & byte(0x55) == byte(0)); // should hold
|
||||
assert(byte(0xFF) & byte(0xAA) == byte(0xAA)); // should hold
|
||||
assert(byte(0xFF) & byte(0xAA) == byte(0)); // should fail
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (253-295): CHC: Assertion violation happens here.
|
||||
|
||||
@@ -9,4 +9,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (175-198): CHC: Assertion violation happens here.
|
||||
// Warning 6328: (133-156): CHC: Assertion violation happens here.
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
pragma experimental SMTChecker;
|
||||
contract C {
|
||||
function f() public pure returns (byte) {
|
||||
return (byte(0x0F) | (byte(0xF0)));
|
||||
}
|
||||
function f() public pure returns (byte) {
|
||||
byte b = (byte(0x0F) | (byte(0xF0)));
|
||||
assert(b == byte(0xFF)); // should hold
|
||||
assert(b == byte(0x00)); // should fail
|
||||
return b;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (172-195): CHC: Assertion violation happens here.
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
pragma experimental SMTChecker;
|
||||
contract Simp {
|
||||
function f3() public pure returns (byte) {
|
||||
bytes memory y = "def";
|
||||
return y[0] ^ "e";
|
||||
}
|
||||
function f3() public pure returns (byte) {
|
||||
bytes memory y = "def";
|
||||
assert(y[0] ^ "e" != byte(0)); // should hold
|
||||
assert(y[1] ^ "e" != byte(0)); // should fail
|
||||
return y[0];
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (168-197): CHC: Assertion violation happens here.
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C {
|
||||
function f(int a, uint b) public view {
|
||||
a >>= tx.gasprice;
|
||||
require(a == 16 && b == 2);
|
||||
a >>= b;
|
||||
assert(a == 4); // should hold
|
||||
}
|
||||
}
|
||||
// ----
|
||||
@@ -11,4 +11,3 @@ contract C {
|
||||
}
|
||||
// ----
|
||||
// Warning 4984: (160-165): CHC: Overflow (resulting value larger than 2**256 - 1) happens here.
|
||||
// Warning 4281: (177-182): CHC: Division by zero happens here.
|
||||
|
||||
@@ -5,8 +5,8 @@ contract C {
|
||||
require(b[10] == 0xff);
|
||||
assert(bytes(b[10:20]).length == 10);
|
||||
assert(bytes(b[10:20])[0] == 0xff);
|
||||
assert(bytes(b[10:20])[5] == 0xff);
|
||||
// Disabled because of Spacer nondeterminism
|
||||
//assert(bytes(b[10:20])[5] == 0xff);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (198-232): CHC: Assertion violation happens here.
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C {
|
||||
function f() public pure {
|
||||
bytes memory b = bytes(hex"ffff");
|
||||
assert(b.length == 2); // should hold
|
||||
assert(b[0] == byte(uint8(255))); // should hold
|
||||
assert(b[1] == byte(uint8(100))); // should fail
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (204-236): CHC: Assertion violation happens here.
|
||||
@@ -0,0 +1,10 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C {
|
||||
function f() public pure {
|
||||
assert(bytes4(hex"0000ffff") == bytes4(hex"ffff")); // should fail
|
||||
assert(bytes4(hex"ffff0000") == bytes4(hex"ffff")); // should hold
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (76-126): CHC: Assertion violation happens here.
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
This file is part of solidity.
|
||||
|
||||
solidity is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
solidity is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with solidity. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <test/tools/ossfuzz/abiV2FuzzerCommon.h>
|
||||
|
||||
#include <test/tools/ossfuzz/protoToAbiV2.h>
|
||||
|
||||
#include <src/libfuzzer/libfuzzer_macro.h>
|
||||
#include <abicoder.hpp>
|
||||
|
||||
using namespace solidity::test::abiv2fuzzer;
|
||||
using namespace solidity::test;
|
||||
using namespace std;
|
||||
|
||||
static constexpr size_t abiCoderHeapSize = 1024 * 512;
|
||||
|
||||
DEFINE_PROTO_FUZZER(Contract const&)
|
||||
{
|
||||
abicoder::ABICoder coder(abiCoderHeapSize);
|
||||
auto [encodeStatus, encodedData] = coder.encode("bool", "true");
|
||||
solAssert(encodeStatus, "Isabelle abicoder fuzzer: Encoding failed");
|
||||
return;
|
||||
}
|
||||
@@ -21,7 +21,7 @@ if (OSSFUZZ)
|
||||
)
|
||||
|
||||
add_custom_target(ossfuzz_abiv2)
|
||||
add_dependencies(ossfuzz_abiv2 abiv2_proto_ossfuzz)
|
||||
add_dependencies(ossfuzz_abiv2 abiv2_proto_ossfuzz abiv2_isabelle_ossfuzz)
|
||||
endif()
|
||||
|
||||
if (OSSFUZZ)
|
||||
@@ -135,6 +135,28 @@ if (OSSFUZZ)
|
||||
set_target_properties(abiv2_proto_ossfuzz PROPERTIES LINK_FLAGS ${LIB_FUZZING_ENGINE})
|
||||
target_compile_options(abiv2_proto_ossfuzz PUBLIC ${COMPILE_OPTIONS} -Wno-sign-conversion)
|
||||
|
||||
add_executable(abiv2_isabelle_ossfuzz
|
||||
../../EVMHost.cpp
|
||||
AbiV2IsabelleFuzzer.cpp
|
||||
abiV2FuzzerCommon.cpp
|
||||
protoToAbiV2.cpp
|
||||
abiV2Proto.pb.cc
|
||||
)
|
||||
target_include_directories(abiv2_isabelle_ossfuzz PRIVATE
|
||||
/usr/include/libprotobuf-mutator
|
||||
)
|
||||
target_link_libraries(abiv2_isabelle_ossfuzz PRIVATE solidity
|
||||
evmc
|
||||
evmone-standalone
|
||||
protobuf-mutator-libfuzzer.a
|
||||
protobuf-mutator.a
|
||||
protobuf.a
|
||||
abicoder
|
||||
gmp
|
||||
)
|
||||
set_target_properties(abiv2_isabelle_ossfuzz PROPERTIES LINK_FLAGS ${LIB_FUZZING_ENGINE})
|
||||
target_compile_options(abiv2_isabelle_ossfuzz PUBLIC ${COMPILE_OPTIONS} -Wno-sign-conversion)
|
||||
|
||||
add_executable(sol_proto_ossfuzz
|
||||
solProtoFuzzer.cpp
|
||||
protoToSol.cpp
|
||||
|
||||
Reference in New Issue
Block a user