From fd62bd36e3290b57d477f4bdd5080060a78b3131 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Tue, 28 Jan 2025 10:26:02 +0100 Subject: [PATCH] fix(tests): fix unit tests and use Bytecode verbatim (#1137) --- src/ethereum_test_vm/tests/test_vm.py | 10 +++++----- .../eip4750_functions/test_code_validation.py | 4 ++-- .../eip7480_data_section/test_code_validation.py | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/ethereum_test_vm/tests/test_vm.py b/src/ethereum_test_vm/tests/test_vm.py index 719e6b284c7..0060fbe60d7 100644 --- a/src/ethereum_test_vm/tests/test_vm.py +++ b/src/ethereum_test_vm/tests/test_vm.py @@ -426,8 +426,8 @@ def test_bytecode_concatenation_with_bytes(): assert code == bytes([0x60, 0xFF, 0x19, 0x01, 0x02]) assert str(code) == "" - assert code.popped_stack_items == code.popped_stack_items - assert code.pushed_stack_items == code.pushed_stack_items - assert code.max_stack_height == code.max_stack_height - assert code.min_stack_height == code.min_stack_height - assert code.terminating == code.terminating + assert code.popped_stack_items == base.popped_stack_items + assert code.pushed_stack_items == base.pushed_stack_items + assert code.max_stack_height == base.max_stack_height + assert code.min_stack_height == base.min_stack_height + assert code.terminating == base.terminating diff --git a/tests/osaka/eip7692_eof_v1/eip4750_functions/test_code_validation.py b/tests/osaka/eip7692_eof_v1/eip4750_functions/test_code_validation.py index 4cdd4df1dc4..135c6e178ba 100644 --- a/tests/osaka/eip7692_eof_v1/eip4750_functions/test_code_validation.py +++ b/tests/osaka/eip7692_eof_v1/eip4750_functions/test_code_validation.py @@ -190,7 +190,7 @@ def test_eof_validity( name="imm1", sections=[ Section.Code( - code=Op.CALLF + Op.STOP, + code=Op.CALLF + b"\x00", ) ], ), @@ -201,7 +201,7 @@ def test_eof_validity( code=Op.PUSH0 + Op.PUSH0 + Op.CALLF[1] + Op.STOP, ), Section.Code( - code=Op.CALLF + Op.STOP, # would be valid with "02" + Op.RETF. + code=Op.CALLF + b"\x00", # would be valid with "02" + Op.RETF. code_inputs=2, code_outputs=1, max_stack_height=2, diff --git a/tests/osaka/eip7692_eof_v1/eip7480_data_section/test_code_validation.py b/tests/osaka/eip7692_eof_v1/eip7480_data_section/test_code_validation.py index ee7e575fd1e..70a3f20c5b7 100644 --- a/tests/osaka/eip7692_eof_v1/eip7480_data_section/test_code_validation.py +++ b/tests/osaka/eip7692_eof_v1/eip7480_data_section/test_code_validation.py @@ -192,7 +192,7 @@ def test_legacy_initcode_invalid_eof_v1_contract( Container( name="imm1", sections=[ - Section.Code(Op.DATALOADN + Op.STOP), + Section.Code(Op.DATALOADN + b"\x00"), Section.Data(b"\xff" * 32), ], ), @@ -204,7 +204,7 @@ def test_legacy_initcode_invalid_eof_v1_contract( max_stack_height=1, ), Section.Code( - Op.DATALOADN + Op.STOP, + Op.DATALOADN + b"\x00", code_outputs=1, ), Section.Code(