mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #6507 from ethereum/smt_address_members
[SMTChecker] Address members
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C
|
||||
{
|
||||
function f(address a, address b) public view {
|
||||
uint x = b.balance + 1000 ether;
|
||||
assert(a.balance > b.balance);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (96-102): Unused local variable.
|
||||
// Warning: (131-160): Assertion violation happens here
|
||||
// Warning: (105-127): Overflow (resulting value larger than 2**256 - 1) happens here
|
||||
@@ -0,0 +1,23 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C
|
||||
{
|
||||
uint x;
|
||||
mapping (uint => uint) map;
|
||||
function f(address a, bytes memory data) public {
|
||||
x = 0;
|
||||
map[0] = 0;
|
||||
mapping (uint => uint) storage localMap = map;
|
||||
(bool success, bytes memory ret) = a.call(data);
|
||||
assert(success);
|
||||
assert(x == 0);
|
||||
assert(map[0] == 0);
|
||||
assert(localMap[0] == 0);
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: >spuriousDragon
|
||||
// ----
|
||||
// Warning: (224-240): Unused local variable.
|
||||
// Warning: (209-256): Assertion checker does not yet support such variable declarations.
|
||||
// Warning: (260-275): Assertion violation happens here
|
||||
@@ -0,0 +1,23 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C
|
||||
{
|
||||
uint x;
|
||||
mapping (uint => uint) map;
|
||||
function f(address a, bytes memory data) public {
|
||||
x = 0;
|
||||
map[0] = 0;
|
||||
mapping (uint => uint) storage localMap = map;
|
||||
(bool success, bytes memory ret) = a.delegatecall(data);
|
||||
assert(success);
|
||||
assert(x == 0);
|
||||
assert(map[0] == 0);
|
||||
assert(localMap[0] == 0);
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: >spuriousDragon
|
||||
// ----
|
||||
// Warning: (224-240): Unused local variable.
|
||||
// Warning: (209-264): Assertion checker does not yet support such variable declarations.
|
||||
// Warning: (268-283): Assertion violation happens here
|
||||
@@ -0,0 +1,23 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C
|
||||
{
|
||||
uint x;
|
||||
mapping (uint => uint) map;
|
||||
function f(address a, bytes memory data) public {
|
||||
x = 0;
|
||||
map[0] = 0;
|
||||
mapping (uint => uint) storage localMap = map;
|
||||
(bool success, bytes memory ret) = a.staticcall(data);
|
||||
assert(success);
|
||||
assert(x == 0);
|
||||
assert(map[0] == 0);
|
||||
assert(localMap[0] == 0);
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: >spuriousDragon
|
||||
// ----
|
||||
// Warning: (224-240): Unused local variable.
|
||||
// Warning: (209-262): Assertion checker does not yet support such variable declarations.
|
||||
// Warning: (266-281): Assertion violation happens here
|
||||
@@ -0,0 +1,16 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C
|
||||
{
|
||||
function f(address payable a) public {
|
||||
uint x = 100;
|
||||
require(x == a.balance);
|
||||
a.transfer(600);
|
||||
// This fails since a == this is possible.
|
||||
assert(a.balance == 700);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (131-146): Insufficient funds happens here
|
||||
// Warning: (131-146): Assertion checker does not yet implement this type.
|
||||
// Warning: (195-219): Assertion violation happens here
|
||||
@@ -0,0 +1,21 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C
|
||||
{
|
||||
function f(uint x, address payable a, address payable b) public {
|
||||
require(a != b);
|
||||
require(x == 100);
|
||||
require(x == a.balance);
|
||||
require(a.balance == b.balance);
|
||||
a.transfer(600);
|
||||
b.transfer(100);
|
||||
// Fails since a == this is possible.
|
||||
assert(a.balance > b.balance);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (217-232): Insufficient funds happens here
|
||||
// Warning: (217-232): Assertion checker does not yet implement this type.
|
||||
// Warning: (236-251): Insufficient funds happens here
|
||||
// Warning: (236-251): Assertion checker does not yet implement this type.
|
||||
// Warning: (295-324): Assertion violation happens here
|
||||
@@ -0,0 +1,18 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C
|
||||
{
|
||||
function f(address payable a, address payable b) public {
|
||||
require(a.balance == 0);
|
||||
a.transfer(600);
|
||||
b.transfer(1000);
|
||||
// Fails since a == this is possible.
|
||||
assert(a.balance == 600);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (134-149): Insufficient funds happens here
|
||||
// Warning: (134-149): Assertion checker does not yet implement this type.
|
||||
// Warning: (153-169): Insufficient funds happens here
|
||||
// Warning: (153-169): Assertion checker does not yet implement this type.
|
||||
// Warning: (213-237): Assertion violation happens here
|
||||
@@ -3,9 +3,9 @@
|
||||
{
|
||||
"smtlib2responses":
|
||||
{
|
||||
"0x47826ec8b83cfec30171b34f944aed6c33ecd12f02b9ad522ca45317c9bd5f45": "sat\n((|EVALEXPR_0| 1))",
|
||||
"0x734c058efe9d6ec224de3cf2bdfa6c936a1c9c159c040c128d631145b2fed195": "unsat\n",
|
||||
"0xa0c072acdbe5181dd56cbad8960cb5bb0b9e97fd598cfd895467bd73bbcca028": "sat\n((|EVALEXPR_0| 0))"
|
||||
"0x47a038dd9021ecb218726ea6bf1f75c215a50b1981bae4341e89c9f2b7ac5db7": "sat\n((|EVALEXPR_0| 1))",
|
||||
"0xf057b272f2ceb99a2f714cb132960babdeedfb84ff8ffb96106a58bc0c2060cb": "sat\n((|EVALEXPR_0| 0))",
|
||||
"0xf49b9d0eb7b6d2f2ac9e1604288e52ee1a08cda57058e26d7843ed109ca6d7c9": "unsat\n"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
{
|
||||
"smtlib2responses":
|
||||
{
|
||||
"0xa0c072acdbe5181dd56cbad8960cb5bb0b9e97fd598cfd895467bd73bbcca028": "sat\n((|EVALEXPR_0| 0))\n"
|
||||
"0xf057b272f2ceb99a2f714cb132960babdeedfb84ff8ffb96106a58bc0c2060cb": "sat\n((|EVALEXPR_0| 0))\n"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user