From c62d259da32335482b7974a7dd5fc06f871c1831 Mon Sep 17 00:00:00 2001 From: Danno Ferrin Date: Tue, 25 Jun 2024 13:28:21 -0600 Subject: [PATCH] Remove Orphans in tests Update a couple of new tests trip the new "no orphan containers" rule. Signed-off-by: Danno Ferrin --- .../eip3540_eof_v1/container.py | 8 +++- .../test_all_opcodes_in_container.py | 37 ++++++++++--------- 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/tests/prague/eip7692_eof_v1/eip3540_eof_v1/container.py b/tests/prague/eip7692_eof_v1/eip3540_eof_v1/container.py index e6da714625..71468cd081 100644 --- a/tests/prague/eip7692_eof_v1/eip3540_eof_v1/container.py +++ b/tests/prague/eip7692_eof_v1/eip3540_eof_v1/container.py @@ -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) ] + [ @@ -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) ] + [ diff --git a/tests/prague/eip7692_eof_v1/eip3540_eof_v1/test_all_opcodes_in_container.py b/tests/prague/eip7692_eof_v1/eip3540_eof_v1/test_all_opcodes_in_container.py index 67898b7b51..5f2f1a1bd9 100644 --- a/tests/prague/eip7692_eof_v1/eip3540_eof_v1/test_all_opcodes_in_container.py +++ b/tests/prague/eip7692_eof_v1/eip3540_eof_v1/test_all_opcodes_in_container.py @@ -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 @@ -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