Skip to content

Commit 7cc0877

Browse files
committed
eof: Add unit tests in yulSyntaxTests and objectCompiler
1 parent f2e6caf commit 7cc0877

File tree

7 files changed

+123
-0
lines changed

7 files changed

+123
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
object "a" {
2+
code {
3+
sstore(0, extcall(address(), 0, 0, 10))
4+
sstore(1, extdelegatecall(address(), 0, 0))
5+
sstore(2, extstaticcall(address(), 0, 0))
6+
}
7+
}
8+
9+
// ====
10+
// bytecodeFormat: >=EOFv1
11+
// ----
12+
// Assembly:
13+
// /* "source":81:83 */
14+
// 0x0a
15+
// /* "source":78:79 */
16+
// 0x00
17+
// /* "source":64:73 */
18+
// dup1
19+
// address
20+
// /* "source":56:84 */
21+
// extcall
22+
// /* "source":53:54 */
23+
// 0x00
24+
// /* "source":46:85 */
25+
// sstore
26+
// /* "source":138:139 */
27+
// 0x00
28+
// /* "source":124:133 */
29+
// dup1
30+
// address
31+
// /* "source":108:140 */
32+
// extdelegatecall
33+
// /* "source":105:106 */
34+
// 0x01
35+
// /* "source":98:141 */
36+
// sstore
37+
// /* "source":192:193 */
38+
// 0x00
39+
// /* "source":178:187 */
40+
// dup1
41+
// address
42+
// /* "source":164:194 */
43+
// extstaticcall
44+
// /* "source":161:162 */
45+
// 0x02
46+
// /* "source":154:195 */
47+
// sstore
48+
// /* "source":22:211 */
49+
// stop
50+
// Bytecode: ef000101000402000100170400000000800004600a5f8030f85f555f8030f96001555f8030fb60025500
51+
// Opcodes: 0xEF STOP ADD ADD STOP DIV MUL STOP ADD STOP OR DIV STOP STOP STOP STOP DUP1 STOP DIV PUSH1 0xA PUSH0 DUP1 ADDRESS EXTCALL PUSH0 SSTORE PUSH0 DUP1 ADDRESS EXTDELEGATECALL PUSH1 0x1 SSTORE PUSH0 DUP1 ADDRESS EXTSTATICCALL PUSH1 0x2 SSTORE STOP
52+
// SourceMappings: 81:2:0:-:0;78:1;64:9;;56:28;53:1;46:39;138:1;124:9;;108:32;105:1;98:43;192:1;178:9;;164:30;161:1;154:41;22:189
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
object "a" {
2+
code {
3+
function extcall() {}
4+
function extstaticcall() {}
5+
function extdelegatecall() {}
6+
}
7+
}
8+
9+
// ====
10+
// bytecodeFormat: legacy
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
object "a" {
2+
code {
3+
function extcall() {}
4+
}
5+
}
6+
7+
// ====
8+
// bytecodeFormat: >=EOFv1
9+
// ----
10+
// ParserError 5568: (41-48): Cannot use builtin function name "extcall" as identifier name.
11+
// ParserError 8143: (41-48): Expected keyword "data" or "object" or "}".
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
object "a" {
2+
code {
3+
pop(extcall(address(), 0, 0, 0))
4+
pop(extdelegatecall(address(), 0, 0))
5+
pop(extstaticcall(address(), 0, 0))
6+
}
7+
}
8+
9+
// ====
10+
// bytecodeFormat: >=EOFv1
11+
// ----
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
object "a" {
2+
code {
3+
pop(extcall(address(), 0, 0, 0))
4+
pop(extdelegatecall(address(), 0, 0))
5+
pop(extstaticcall(address(), 0, 0))
6+
}
7+
}
8+
9+
// ====
10+
// bytecodeFormat: legacy
11+
// ----
12+
// TypeError 4328: (36-43): The "extcall" instruction is only available on EOF.
13+
// TypeError 3950: (36-63): Expected expression to evaluate to one value, but got 0 values instead.
14+
// TypeError 4328: (77-92): The "extdelegatecall" instruction is only available on EOF.
15+
// TypeError 3950: (77-109): Expected expression to evaluate to one value, but got 0 values instead.
16+
// TypeError 4328: (123-136): The "extstaticcall" instruction is only available on EOF.
17+
// TypeError 3950: (123-153): Expected expression to evaluate to one value, but got 0 values instead.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
object "a" {
2+
code {
3+
function extdelegatecall() {}
4+
}
5+
}
6+
7+
// ====
8+
// bytecodeFormat: >=EOFv1
9+
// ----
10+
// ParserError 5568: (41-56): Cannot use builtin function name "extdelegatecall" as identifier name.
11+
// ParserError 8143: (41-56): Expected keyword "data" or "object" or "}".
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
object "a" {
2+
code {
3+
function extstaticcall() {}
4+
}
5+
}
6+
7+
// ====
8+
// bytecodeFormat: >=EOFv1
9+
// ----
10+
// ParserError 5568: (41-54): Cannot use builtin function name "extstaticcall" as identifier name.
11+
// ParserError 8143: (41-54): Expected keyword "data" or "object" or "}".

0 commit comments

Comments
 (0)