From 22105117b52c4b78fb62e1213a322e6794320d40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Sun, 11 Aug 2024 20:29:15 +0200 Subject: [PATCH] refactor(tests): use Container.expected_bytecode Use the Container.expected_bytecode feature in test_section_order(). Confirm that these tests replace EOFTests/efValidation/EOF1_section_order_.json. --- converted-ethereum-tests.txt | 1 + .../eip3540_eof_v1/test_section_order.py | 12 +++++------- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/converted-ethereum-tests.txt b/converted-ethereum-tests.txt index e6933cd178..d2e23de9b6 100644 --- a/converted-ethereum-tests.txt +++ b/converted-ethereum-tests.txt @@ -3,6 +3,7 @@ GeneralStateTests/stCreate2/call_outsize_then_create2_successful_then_returndata GeneralStateTests/stCreate2/call_then_create2_successful_then_returndatasize.json EOFTests/efValidation/EOF1_eofcreate_valid_.json +EOFTests/efValidation/EOF1_section_order_.json ([#647](https://github.com/ethereum/execution-spec-tests/pull/647)) EOFTests/efValidation/EOF1_returncontract_invalid_.json diff --git a/tests/prague/eip7692_eof_v1/eip3540_eof_v1/test_section_order.py b/tests/prague/eip7692_eof_v1/eip3540_eof_v1/test_section_order.py index d0f3703617..634fa91a4b 100644 --- a/tests/prague/eip7692_eof_v1/eip3540_eof_v1/test_section_order.py +++ b/tests/prague/eip7692_eof_v1/eip3540_eof_v1/test_section_order.py @@ -179,6 +179,10 @@ def make_section_order(kind) -> List[Section]: skip_body_listing=calculate_skip_flag(SectionKind.DATA, CasePosition.BODY), ) + expected_code, expected_exception = get_expected_code_exception( + section_kind, section_test, test_position + ) + eof_code = Container( sections=make_section_order(section_kind), auto_type_section=AutoSection.NONE, @@ -195,15 +199,9 @@ def make_section_order(kind) -> List[Section]: ) ) ), + expected_bytecode=expected_code, ) - expected_code, expected_exception = get_expected_code_exception( - section_kind, section_test, test_position - ) - - # TODO remove this after Container class implementation is reliable - assert bytes(eof_code).hex() == bytes.fromhex(expected_code).hex() - eof_test( data=eof_code, expect_exception=expected_exception,