Skip to content

Commit

Permalink
Remove Orphans in tests
Browse files Browse the repository at this point in the history
Update a couple of new tests trip the new "no orphan containers" rule.

Signed-off-by: Danno Ferrin <[email protected]>
  • Loading branch information
shemnon authored and marioevz committed Jul 1, 2024
1 parent 4a13945 commit c62d259
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 20 deletions.
8 changes: 6 additions & 2 deletions tests/prague/eip7692_eof_v1/eip3540_eof_v1/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@
Container(
name="max_code_sections_plus_container",
sections=[
Section.Code(Op.JUMPF[i + 1] if i < (MAX_CODE_SECTIONS - 1) else Op.STOP)
Section.Code(
Op.JUMPF[i + 1] if i < (MAX_CODE_SECTIONS - 1) else Op.RETURNCONTRACT[0](0, 0)
)
for i in range(MAX_CODE_SECTIONS)
]
+ [
Expand All @@ -62,7 +64,9 @@
Container(
name="max_code_sections_plus_data_plus_container",
sections=[
Section.Code(Op.JUMPF[i + 1] if i < (MAX_CODE_SECTIONS - 1) else Op.STOP)
Section.Code(
Op.JUMPF[i + 1] if i < (MAX_CODE_SECTIONS - 1) else Op.RETURNCONTRACT[0](0, 0)
)
for i in range(MAX_CODE_SECTIONS)
]
+ [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""
EOF Container: check how every opcode behaves in the middle of the valid eof container code
"""

from typing import List

import pytest
Expand Down Expand Up @@ -90,25 +89,27 @@ def sections(
"""
sections = [Section.Code(code=bytecode)]

if opcode == Op.CALLF:
sections.append(
Section.Code(
code=Op.RETF,
code_inputs=0,
code_outputs=0,
max_stack_height=0,
match opcode:
case Op.EOFCREATE | Op.RETURNCONTRACT:
sections.append(
Section.Container(
container=Container(
sections=[
Section.Code(code=Op.REVERT(0, 0)),
]
)
)
)
)
sections += [
Section.Container(
container=Container(
sections=[
Section.Code(code=Op.STOP),
]
case Op.CALLF:
sections.append(
Section.Code(
code=Op.RETF,
code_inputs=0,
code_outputs=0,
max_stack_height=0,
)
)
),
Section.Data("1122334455667788" * 4),
]
sections.append(Section.Data("1122334455667788" * 4))
return sections


Expand Down

0 comments on commit c62d259

Please sign in to comment.