Skip to content

Commit 4913b7d

Browse files
Add tests
1 parent c8a708f commit 4913b7d

File tree

12 files changed

+502
-0
lines changed

12 files changed

+502
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--revert-strings strip --debug-info none --asm --optimize
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
pragma solidity >=0.0;
2+
// SPDX-License-Identifier: GPL-3.0
3+
contract C {
4+
error MyError(uint errorCode, string errorMsg, bool flag);
5+
function flag() pure public returns (bool) { return false; }
6+
function f() pure external {
7+
uint code = 8;
8+
string memory eMsg = "error";
9+
require(false, MyError(code, eMsg, flag()));
10+
}
11+
}
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
2+
======= input.sol:C =======
3+
EVM assembly:
4+
mstore(0x40, 0x80)
5+
callvalue
6+
dup1
7+
iszero
8+
tag_1
9+
jumpi
10+
revert(0x00, 0x00)
11+
tag_1:
12+
pop
13+
dataSize(sub_0)
14+
dup1
15+
dataOffset(sub_0)
16+
0x00
17+
codecopy
18+
0x00
19+
return
20+
stop
21+
22+
sub_0: assembly {
23+
mstore(0x40, 0x80)
24+
callvalue
25+
dup1
26+
iszero
27+
tag_1
28+
jumpi
29+
revert(0x00, 0x00)
30+
tag_1:
31+
pop
32+
jumpi(tag_2, lt(calldatasize, 0x04))
33+
shr(0xe0, calldataload(0x00))
34+
dup1
35+
0x26121ff0
36+
eq
37+
tag_3
38+
jumpi
39+
dup1
40+
0x890eba68
41+
eq
42+
tag_4
43+
jumpi
44+
tag_2:
45+
revert(0x00, 0x00)
46+
tag_3:
47+
tag_5
48+
tag_6
49+
jump // in
50+
tag_5:
51+
stop
52+
tag_4:
53+
0x40
54+
dup1
55+
mload
56+
0x00
57+
dup2
58+
mstore
59+
swap1
60+
mload
61+
swap1
62+
dup2
63+
swap1
64+
sub
65+
0x20
66+
add
67+
swap1
68+
return
69+
tag_6:
70+
0x40
71+
dup1
72+
mload
73+
dup1
74+
dup3
75+
add
76+
swap1
77+
swap2
78+
mstore
79+
0x05
80+
dup2
81+
mstore
82+
shl(0xd9, 0x32b93937b9)
83+
0x20
84+
dup3
85+
add
86+
mstore
87+
revert(0x00, 0x00)
88+
89+
auxdata: <AUXDATA REMOVED>
90+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--revert-strings strip --debug-info none --asm --optimize
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
pragma solidity >=0.0;
2+
// SPDX-License-Identifier: GPL-3.0
3+
contract C {
4+
error MyError(uint errorCode, string errorMsg);
5+
uint public counter = 0;
6+
function genCode() public returns (uint) { return ++counter; }
7+
function f() external {
8+
string memory eMsg = "error";
9+
require(false, MyError(genCode(), eMsg));
10+
counter += 2;
11+
}
12+
}
Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
2+
======= input.sol:C =======
3+
EVM assembly:
4+
mstore(0x40, 0x80)
5+
0x00
6+
0x00
7+
sstore
8+
callvalue
9+
dup1
10+
iszero
11+
tag_1
12+
jumpi
13+
revert(0x00, 0x00)
14+
tag_1:
15+
pop
16+
dataSize(sub_0)
17+
dup1
18+
dataOffset(sub_0)
19+
0x00
20+
codecopy
21+
0x00
22+
return
23+
stop
24+
25+
sub_0: assembly {
26+
mstore(0x40, 0x80)
27+
callvalue
28+
dup1
29+
iszero
30+
tag_1
31+
jumpi
32+
revert(0x00, 0x00)
33+
tag_1:
34+
pop
35+
jumpi(tag_2, lt(calldatasize, 0x04))
36+
shr(0xe0, calldataload(0x00))
37+
dup1
38+
0x26121ff0
39+
eq
40+
tag_3
41+
jumpi
42+
dup1
43+
0x61bc221a
44+
eq
45+
tag_4
46+
jumpi
47+
dup1
48+
0xaefa573d
49+
eq
50+
tag_5
51+
jumpi
52+
tag_2:
53+
revert(0x00, 0x00)
54+
tag_3:
55+
tag_6
56+
tag_7
57+
jump // in
58+
tag_6:
59+
stop
60+
tag_4:
61+
tag_8
62+
sload(0x00)
63+
dup2
64+
jump
65+
tag_8:
66+
mload(0x40)
67+
swap1
68+
dup2
69+
mstore
70+
0x20
71+
add
72+
mload(0x40)
73+
dup1
74+
swap2
75+
sub
76+
swap1
77+
return
78+
tag_5:
79+
tag_8
80+
tag_13
81+
jump // in
82+
tag_7:
83+
0x40
84+
dup1
85+
mload
86+
dup1
87+
dup3
88+
add
89+
swap1
90+
swap2
91+
mstore
92+
0x05
93+
dup2
94+
mstore
95+
shl(0xd9, 0x32b93937b9)
96+
0x20
97+
dup3
98+
add
99+
mstore
100+
revert(0x00, 0x00)
101+
tag_13:
102+
0x00
103+
0x00
104+
0x00
105+
dup2
106+
sload
107+
tag_20
108+
swap1
109+
tag_21
110+
jump // in
111+
tag_20:
112+
swap2
113+
dup3
114+
swap1
115+
sstore
116+
pop
117+
swap2
118+
swap1
119+
pop
120+
jump // out
121+
tag_22:
122+
0x4e487b71
123+
0xe0
124+
shl
125+
0x00
126+
mstore
127+
0x11
128+
0x04
129+
mstore
130+
0x24
131+
0x00
132+
revert
133+
tag_21:
134+
0x00
135+
0x01
136+
dup3
137+
add
138+
tag_31
139+
jumpi
140+
tag_31
141+
tag_22
142+
jump // in
143+
tag_31:
144+
pop
145+
0x01
146+
add
147+
swap1
148+
jump // out
149+
150+
auxdata: <AUXDATA REMOVED>
151+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
pragma solidity >=0.0;
2+
// SPDX-License-Identifier: GPL-3.0
3+
contract C {
4+
error MyError(uint errorCode, string errorMsg, bool flag);
5+
function flag() pure public returns (bool) { return false; }
6+
function f() pure external {
7+
uint code = 8;
8+
string memory eMsg = "error";
9+
require(false, MyError(code, eMsg, flag()));
10+
}
11+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"language": "Solidity",
3+
"sources": {
4+
"C": {"urls": ["in.sol"]}
5+
},
6+
"settings": {
7+
"viaIR": false,
8+
"debug": {
9+
"revertStrings": "strip",
10+
"debugInfo": []
11+
},
12+
"outputSelection": {
13+
"*": {"*": ["evm.assembly"]}
14+
}
15+
}
16+
}

0 commit comments

Comments
 (0)