Skip to content

Commit

Permalink
refactor(tests): use Container.expected_bytecode
Browse files Browse the repository at this point in the history
Use the Container.expected_bytecode feature in test_section_order().
Confirm that these tests replace
EOFTests/efValidation/EOF1_section_order_.json.
  • Loading branch information
chfast committed Aug 11, 2024
1 parent e15ec28 commit 2210511
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
1 change: 1 addition & 0 deletions converted-ethereum-tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 5 additions & 7 deletions tests/prague/eip7692_eof_v1/eip3540_eof_v1/test_section_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 2210511

Please sign in to comment.