Skip to content

Commit b93e4fb

Browse files
chfastmarioevz
andauthored
refactor(fw,tests): EOF - make NON_RETURNING_SECTION default in Container (#599)
* feat(fw): make NON_RETURNING_SECTION default in Container * fix(fw): fix EOF tests * fix(tests): EOF: Remove code defaults from most containers --------- Co-authored-by: Mario Vega <[email protected]>
1 parent f7115f5 commit b93e4fb

File tree

20 files changed

+111
-521
lines changed

20 files changed

+111
-521
lines changed

src/ethereum_test_tools/eof/v1/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
HEADER_SECTION_COUNT_BYTE_LENGTH,
2121
HEADER_SECTION_KIND_BYTE_LENGTH,
2222
HEADER_SECTION_SIZE_BYTE_LENGTH,
23+
NON_RETURNING_SECTION,
2324
TYPES_INPUTS_BYTE_LENGTH,
2425
TYPES_OUTPUTS_BYTE_LENGTH,
2526
TYPES_STACK_BYTE_LENGTH,
@@ -102,7 +103,7 @@ class Section(CopyValidateModel):
102103
"""
103104
Data stack items consumed by this code section (function)
104105
"""
105-
code_outputs: int = 0
106+
code_outputs: int = NON_RETURNING_SECTION
106107
"""
107108
Data stack items produced by or expected at the end of this code section
108109
(function)

src/ethereum_test_tools/tests/test_eof_v1.py

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
Section.Code("0x00"),
2626
],
2727
),
28-
"ef0001 01 0004 02 0001 0001 04 0000 00 00000000 00",
28+
"ef0001 01 0004 02 0001 0001 04 0000 00 00800000 00",
2929
),
3030
(
3131
"Single code section, single container section",
@@ -35,7 +35,7 @@
3535
Section.Container("0x0B"),
3636
],
3737
),
38-
"ef0001 01 0004 02 0001 0001 03 0001 0001 04 0000 00 00000000 0A 0B",
38+
"ef0001 01 0004 02 0001 0001 03 0001 0001 04 0000 00 00800000 0A 0B",
3939
),
4040
(
4141
"Single code section, single container section, single data",
@@ -46,7 +46,7 @@
4646
Section.Data("0x0C"),
4747
],
4848
),
49-
"ef0001 01 0004 02 0001 0001 03 0001 0001 04 0001 00" "00000000 0A 0B 0C",
49+
"ef0001 01 0004 02 0001 0001 03 0001 0001 04 0001 00 00800000 0A 0B 0C",
5050
),
5151
(
5252
"Single code section, single container section, single data 2",
@@ -57,7 +57,7 @@
5757
Section.Container("0x0B"),
5858
],
5959
),
60-
"ef0001 01 0004 02 0001 0001 03 0001 0001 04 0001 00" "00000000 0A 0B 0C",
60+
"ef0001 01 0004 02 0001 0001 03 0001 0001 04 0001 00 00800000 0A 0B 0C",
6161
),
6262
(
6363
"Single code section, multiple container section, single data",
@@ -69,7 +69,7 @@
6969
Section.Container("0x0D"),
7070
],
7171
),
72-
"ef0001 01 0004 02 0001 0001 03 0002 0001 0001 04 0001 00" "00000000 0A 0B 0D 0C",
72+
"ef0001 01 0004 02 0001 0001 03 0002 0001 0001 04 0001 00 00800000 0A 0B 0D 0C",
7373
),
7474
(
7575
"Single code section, multiple container sections",
@@ -80,7 +80,7 @@
8080
Section.Container("0x00"),
8181
],
8282
),
83-
"ef0001 01 0004 02 0001 0001 03 0002 0002 0001 04 0000 00 00000000 00" "0001 00",
83+
"ef0001 01 0004 02 0001 0001 03 0002 0002 0001 04 0000 00 00800000 00 0001 00",
8484
),
8585
(
8686
"No code section",
@@ -121,7 +121,7 @@
121121
Section.Data("0x0f"),
122122
],
123123
),
124-
"ef0001 01 0004 02 0001 0001 04 0001 00 00000000 0e 0f",
124+
"ef0001 01 0004 02 0001 0001 04 0001 00 00800000 0e 0f",
125125
),
126126
(
127127
"Multiple type sections",
@@ -139,7 +139,7 @@
139139
],
140140
auto_type_section=AutoSection.NONE,
141141
),
142-
"ef0001 01 0004 01 0004 02 0001 0001 04 0000 00" "00000000 00000000 00",
142+
"ef0001 01 0004 01 0004 02 0001 0001 04 0000 00 00000000 00000000 00",
143143
),
144144
(
145145
"Invalid Magic",
@@ -149,7 +149,7 @@
149149
Section.Code("0x00"),
150150
],
151151
),
152-
"effe01 01 0004 02 0001 0001 04 0000 00 00000000 00",
152+
"effe01 01 0004 02 0001 0001 04 0000 00 00800000 00",
153153
),
154154
(
155155
"Invalid Version",
@@ -159,7 +159,7 @@
159159
Section.Code("0x00"),
160160
],
161161
),
162-
"ef0002 01 0004 02 0001 0001 04 0000 00 00000000 00",
162+
"ef0002 01 0004 02 0001 0001 04 0000 00 00800000 00",
163163
),
164164
(
165165
"Section Invalid size Version",
@@ -171,7 +171,7 @@
171171
),
172172
],
173173
),
174-
"ef0001 01 0004 02 0001 ffff 04 0000 00 00000000 00",
174+
"ef0001 01 0004 02 0001 ffff 04 0000 00 00800000 00",
175175
),
176176
(
177177
"Nested EOF",
@@ -186,8 +186,8 @@
186186
),
187187
],
188188
),
189-
"ef0001 01 0004 02 0001 0001 03 0001 0014 04 0000 00 00000000 00"
190-
"ef0001 01 0004 02 0001 0001 04 0000 00 00000000 01",
189+
"ef0001 01 0004 02 0001 0001 03 0001 0014 04 0000 00 00800000 00"
190+
"ef0001 01 0004 02 0001 0001 04 0000 00 00800000 01",
191191
),
192192
(
193193
"Nested EOF in Data",
@@ -201,8 +201,8 @@
201201
),
202202
],
203203
),
204-
"ef0001 01 0004 02 0001 0001 04 0014 00 00000000 00"
205-
"ef0001 01 0004 02 0001 0001 04 0000 00 00000000 01",
204+
"ef0001 01 0004 02 0001 0001 04 0014 00 00800000 00"
205+
"ef0001 01 0004 02 0001 0001 04 0000 00 00800000 01",
206206
),
207207
(
208208
"Incomplete code section",
@@ -214,7 +214,7 @@
214214
),
215215
],
216216
),
217-
"ef0001 01 0004 02 0001 0002 04 0000 00 00000000",
217+
"ef0001 01 0004 02 0001 0002 04 0000 00 00800000",
218218
),
219219
(
220220
"Trailing bytes after code section",
@@ -224,7 +224,7 @@
224224
],
225225
extra=bytes.fromhex("deadbeef"),
226226
),
227-
"ef0001 01 0004 02 0001 0003 04 0000 00 00000000 600000 deadbeef",
227+
"ef0001 01 0004 02 0001 0003 04 0000 00 00800000 600000 deadbeef",
228228
),
229229
(
230230
"Multiple code sections",
@@ -236,7 +236,7 @@
236236
),
237237
"""
238238
ef0001 01 0008 02 0002 0003 0003 04 0000 00
239-
00000000 00000000
239+
00800000 00800000
240240
600000
241241
600000
242242
""",
@@ -249,7 +249,7 @@
249249
],
250250
header_terminator=bytes(),
251251
),
252-
"ef0001 01 0004 02 0001 0003 04 0000 00000000 600000",
252+
"ef0001 01 0004 02 0001 0003 04 0000 00800000 600000",
253253
),
254254
(
255255
"No auto type section",
@@ -274,7 +274,7 @@
274274
),
275275
"""
276276
ef0001 01 0008 02 0001 0001 04 0001 00
277-
00000000 00000000
277+
00800000 00800000
278278
00 00
279279
""",
280280
),
@@ -290,7 +290,7 @@
290290
),
291291
"""
292292
ef0001 01 0004 02 0001 0001 04 0000 00
293-
01000000
293+
01800000
294294
00
295295
""",
296296
),
@@ -306,7 +306,7 @@
306306
),
307307
"""
308308
ef0001 01 0004 02 0001 0001 04 0000 00
309-
ff000000
309+
ff800000
310310
00
311311
""",
312312
),
@@ -354,7 +354,7 @@
354354
),
355355
"""
356356
ef0001 01 0004 02 0001 0001 04 0000 00
357-
00000201
357+
00800201
358358
00
359359
""",
360360
),
@@ -370,7 +370,7 @@
370370
),
371371
"""
372372
ef0001 01 0004 02 0001 0001 04 0000 00
373-
0000FFFF
373+
0080FFFF
374374
00
375375
""",
376376
),
@@ -387,7 +387,7 @@
387387
),
388388
"""
389389
ef0001 01 0008 02 0002 0001 0001 04 0000 00
390-
0000FFFF 00000000
390+
0080FFFF 00800000
391391
00
392392
00
393393
""",

0 commit comments

Comments
 (0)