Skip to content

Commit 9ea4576

Browse files
author
Leo Alt
committed
Update tests
1 parent d89d63b commit 9ea4576

18 files changed

+221
-13
lines changed

test/libsolidity/smtCheckerTests/complex/slither/external_function.sol

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,7 @@ contract InternalCall {
8484
// Warning 2018: (1179-1241): Function state mutability can be restricted to pure
8585
// Warning 2018: (1247-1309): Function state mutability can be restricted to pure
8686
// Warning 4588: (681-716): Assertion checker does not yet implement this type of function call.
87-
// Warning 4588: (727-782): Assertion checker does not yet implement this type of function call.
8887
// Warning 4588: (854-886): Assertion checker does not yet implement this type of function call.
8988
// Warning 4588: (681-716): Assertion checker does not yet implement this type of function call.
90-
// Warning 4588: (727-782): Assertion checker does not yet implement this type of function call.
9189
// Warning 4588: (854-886): Assertion checker does not yet implement this type of function call.
9290
// Warning 5729: (1370-1375): BMC does not yet implement this type of function call.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
contract C {
2+
uint x;
3+
constructor(address _a) {
4+
_a.call("aaaa");
5+
assert(x == 0); // should hold
6+
}
7+
}
8+
// ====
9+
// SMTEngine: all
10+
// ----
11+
// Warning 9302: (51-66): Return value of low-level calls not used.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
contract C {
2+
uint x;
3+
function f(uint _x) public {
4+
x = _x;
5+
}
6+
constructor(address _a) {
7+
_a.call("aaaa");
8+
assert(x == 0); // should hold
9+
}
10+
}
11+
// ====
12+
// SMTEngine: all
13+
// ----
14+
// Warning 9302: (94-109): Return value of low-level calls not used.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
contract C {
2+
uint x;
3+
4+
bool lock;
5+
modifier mutex {
6+
require(!lock);
7+
lock = true;
8+
_;
9+
lock = false;
10+
}
11+
12+
function set(uint _x) mutex public {
13+
x = _x;
14+
}
15+
16+
function f(address _a) mutex public {
17+
uint y = x;
18+
_a.call("aaaaa");
19+
assert(y == x); // should hold
20+
}
21+
}
22+
// ====
23+
// SMTEngine: all
24+
// ----
25+
// Warning 9302: (218-234): Return value of low-level calls not used.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
contract C {
2+
uint x;
3+
4+
bool lock;
5+
modifier mutex {
6+
require(!lock);
7+
lock = true;
8+
_;
9+
lock = false;
10+
}
11+
12+
function set(uint _x) mutex public {
13+
x = _x;
14+
}
15+
16+
function f(address _a) public {
17+
uint y = x;
18+
_a.call("aaaaa");
19+
assert(y == x); // should fail
20+
}
21+
}
22+
// ====
23+
// SMTEngine: all
24+
// ----
25+
// Warning 9302: (212-228): Return value of low-level calls not used.
26+
// Warning 6328: (232-246): CHC: Assertion violation happens here.\nCounterexample:\nx = 1, lock = false\n_a = 0\ny = 0\n\nTransaction trace:\nC.constructor()\nState: x = 0, lock = false\nC.f(0)\n _a.call("aaaaa") -- untrusted external call, synthesized as:\n C.set(1) -- reentrant call
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
contract C {
2+
uint x;
3+
function s(uint _x) public {
4+
x = _x;
5+
}
6+
function f(address a) public {
7+
(bool s, bytes memory data) = a.call("");
8+
assert(x == 0); // should fail
9+
}
10+
}
11+
// ====
12+
// SMTEngine: all
13+
// ----
14+
// Warning 2519: (100-106): This declaration shadows an existing declaration.
15+
// Warning 2072: (100-106): Unused local variable.
16+
// Warning 2072: (108-125): Unused local variable.
17+
// Warning 6328: (143-157): CHC: Assertion violation happens here.\nCounterexample:\nx = 1\na = 0\ns = false\ndata = [36, 5, 5, 5, 5, 5]\n\nTransaction trace:\nC.constructor()\nState: x = 0\nC.s(1)\nState: x = 1\nC.f(0)\n a.call("") -- untrusted external call
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
contract C {
2+
uint x;
3+
function s(uint _x) public view {
4+
x == _x;
5+
}
6+
function f(address a) public {
7+
(bool s, bytes memory data) = a.call("");
8+
assert(x == 0); // should hold
9+
}
10+
}
11+
// ====
12+
// SMTEngine: all
13+
// ----
14+
// Warning 2519: (106-112): This declaration shadows an existing declaration.
15+
// Warning 2072: (106-112): Unused local variable.
16+
// Warning 2072: (114-131): Unused local variable.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
contract C {
2+
uint x;
3+
function f(address a) public {
4+
(bool s, bytes memory data) = a.call("");
5+
assert(s); // should fail
6+
assert(!s); // should fail
7+
}
8+
}
9+
// ====
10+
// SMTEngine: all
11+
// SMTIgnoreCex: yes
12+
// ----
13+
// Warning 2072: (65-82): Unused local variable.
14+
// Warning 6328: (100-109): CHC: Assertion violation happens here.
15+
// Warning 6328: (128-138): CHC: Assertion violation happens here.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
contract C {
2+
uint x;
3+
function f(address a) public {
4+
(bool s, bytes memory data) = a.call("");
5+
assert(data.length > 10); // should fail
6+
}
7+
}
8+
// ====
9+
// SMTEngine: all
10+
// SMTIgnoreCex: yes
11+
// ----
12+
// Warning 2072: (57-63): Unused local variable.
13+
// Warning 6328: (100-124): CHC: Assertion violation happens here.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
contract C {
2+
uint x;
3+
function f(address a) public {
4+
(bool s, bytes memory data) = a.call("");
5+
assert(x == 0); // should hold
6+
}
7+
}
8+
// ====
9+
// SMTEngine: all
10+
// ----
11+
// Warning 2072: (57-63): Unused local variable.
12+
// Warning 2072: (65-82): Unused local variable.

0 commit comments

Comments
 (0)