From 26cf408e2441f5353353f86ae13b46ac85c6f558 Mon Sep 17 00:00:00 2001 From: Mario Vega Date: Sat, 22 Jun 2024 02:59:13 +0000 Subject: [PATCH] fix(tests): required import modifications --- .../eip5656_mcopy/test_mcopy_memory_expansion.py | 3 +-- .../eip7692_eof_v1/eip3540_eof_v1/container.py | 2 +- .../test_all_opcodes_in_container.py | 4 ++-- .../eip3540_eof_v1/test_container_size.py | 4 ++-- .../eip3540_eof_v1/test_container_validation.py | 3 +-- .../eip3540_eof_v1/test_eof_example.py | 16 +++++----------- .../eip3540_eof_v1/test_example_valid_invalid.py | 6 +++--- .../eip3540_eof_v1/test_section_order.py | 13 +++---------- .../eip3540_eof_v1/test_section_size.py | 4 ++-- .../eip7069_extcall/test_returndataload.py | 3 +-- .../test_datacopy_memory_expansion.py | 4 ++-- .../eip7620_eof_create/test_returncontract.py | 3 +-- 12 files changed, 24 insertions(+), 41 deletions(-) diff --git a/tests/cancun/eip5656_mcopy/test_mcopy_memory_expansion.py b/tests/cancun/eip5656_mcopy/test_mcopy_memory_expansion.py index d855c9f811..88d3b32472 100644 --- a/tests/cancun/eip5656_mcopy/test_mcopy_memory_expansion.py +++ b/tests/cancun/eip5656_mcopy/test_mcopy_memory_expansion.py @@ -8,10 +8,9 @@ import pytest -from ethereum_test_tools import Account, Alloc, Bytecode, Environment +from ethereum_test_tools import Account, Address, Alloc, Bytecode, Environment from ethereum_test_tools import Opcodes as Op from ethereum_test_tools import StateTestFiller, Storage, Transaction, cost_memory_bytes -from ethereum_test_tools.common.base_types import Address from .common import REFERENCE_SPEC_GIT_PATH, REFERENCE_SPEC_VERSION 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 4fe4ee5bd3..910688096c 100644 --- a/tests/prague/eip7692_eof_v1/eip3540_eof_v1/container.py +++ b/tests/prague/eip7692_eof_v1/eip3540_eof_v1/container.py @@ -4,6 +4,7 @@ from typing import List +from ethereum_test_tools import EOFException from ethereum_test_tools.eof.v1 import ( VERSION_MAX_SECTION_KIND, AutoSection, @@ -17,7 +18,6 @@ MAX_CODE_SECTIONS, MAX_OPERAND_STACK_HEIGHT, ) -from ethereum_test_tools.exceptions import EOFException from ethereum_test_tools.vm.opcode import Opcodes as Op INVALID: List[Container] = [ 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 22dd9d273c..14149e069b 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 @@ -5,10 +5,10 @@ import pytest -from ethereum_test_tools import EOFTestFiller, Opcode +from ethereum_test_tools import EOFException, EOFTestFiller, Opcode from ethereum_test_tools import Opcodes as Op from ethereum_test_tools import UndefinedOpcodes -from ethereum_test_tools.eof.v1 import Container, ContainerKind, EOFException, Section +from ethereum_test_tools.eof.v1 import Container, ContainerKind, Section from ethereum_test_tools.eof.v1.constants import MAX_OPERAND_STACK_HEIGHT from .. import EOF_FORK_NAME diff --git a/tests/prague/eip7692_eof_v1/eip3540_eof_v1/test_container_size.py b/tests/prague/eip7692_eof_v1/eip3540_eof_v1/test_container_size.py index ea3771c4a1..d31fdc445e 100644 --- a/tests/prague/eip7692_eof_v1/eip3540_eof_v1/test_container_size.py +++ b/tests/prague/eip7692_eof_v1/eip3540_eof_v1/test_container_size.py @@ -4,9 +4,9 @@ import pytest -from ethereum_test_tools import EOFTestFiller +from ethereum_test_tools import EOFException, EOFTestFiller from ethereum_test_tools import Opcodes as Op -from ethereum_test_tools.eof.v1 import Container, EOFException, Section +from ethereum_test_tools.eof.v1 import Container, Section from ethereum_test_tools.eof.v1.constants import MAX_INITCODE_SIZE from .. import EOF_FORK_NAME diff --git a/tests/prague/eip7692_eof_v1/eip3540_eof_v1/test_container_validation.py b/tests/prague/eip7692_eof_v1/eip3540_eof_v1/test_container_validation.py index 84a96f3cba..3bb3424689 100644 --- a/tests/prague/eip7692_eof_v1/eip3540_eof_v1/test_container_validation.py +++ b/tests/prague/eip7692_eof_v1/eip3540_eof_v1/test_container_validation.py @@ -5,11 +5,10 @@ import pytest -from ethereum_test_tools import EOFTestFiller +from ethereum_test_tools import EOFException, EOFTestFiller from ethereum_test_tools import Opcodes as Op from ethereum_test_tools.eof.v1 import Container, ContainerKind, Section from ethereum_test_tools.eof.v1.constants import MAX_CODE_SECTIONS -from ethereum_test_tools.exceptions import EOFException from .. import EOF_FORK_NAME diff --git a/tests/prague/eip7692_eof_v1/eip3540_eof_v1/test_eof_example.py b/tests/prague/eip7692_eof_v1/eip3540_eof_v1/test_eof_example.py index 31e79578d2..0ecaad8228 100644 --- a/tests/prague/eip7692_eof_v1/eip3540_eof_v1/test_eof_example.py +++ b/tests/prague/eip7692_eof_v1/eip3540_eof_v1/test_eof_example.py @@ -4,15 +4,9 @@ import pytest -from ethereum_test_tools import EOFTestFiller +from ethereum_test_tools import Bytecode, EOFException, EOFTestFiller from ethereum_test_tools import Opcodes as Op -from ethereum_test_tools.eof.v1 import ( - AutoSection, - BytesConvertible, - Container, - EOFException, - Section, -) +from ethereum_test_tools.eof.v1 import AutoSection, Container, Section from .. import EOF_FORK_NAME @@ -129,7 +123,7 @@ def test_eof_example_custom_fields(eof_test: EOFTestFiller): @pytest.mark.parametrize( "data_section_bytes", - ("0x01", "0xef"), + (b"\x01", b"\xef"), ) @pytest.mark.parametrize( "code_section_code, exception", @@ -137,8 +131,8 @@ def test_eof_example_custom_fields(eof_test: EOFTestFiller): ) def test_eof_example_parameters( eof_test: EOFTestFiller, - data_section_bytes: BytesConvertible, - code_section_code: BytesConvertible, + data_section_bytes: bytes, + code_section_code: Bytecode, exception: EOFException, ): """ diff --git a/tests/prague/eip7692_eof_v1/eip3540_eof_v1/test_example_valid_invalid.py b/tests/prague/eip7692_eof_v1/eip3540_eof_v1/test_example_valid_invalid.py index 5f8f8fa7f2..e90e386ef2 100644 --- a/tests/prague/eip7692_eof_v1/eip3540_eof_v1/test_example_valid_invalid.py +++ b/tests/prague/eip7692_eof_v1/eip3540_eof_v1/test_example_valid_invalid.py @@ -4,9 +4,9 @@ import pytest -from ethereum_test_tools import EOFTestFiller +from ethereum_test_tools import EOFException, EOFTestFiller from ethereum_test_tools import Opcodes as Op -from ethereum_test_tools.eof.v1 import Bytes, Container, EOFException, Section +from ethereum_test_tools.eof.v1 import Container, Section from .. import EOF_FORK_NAME @@ -59,7 +59,7 @@ ), Section.Data("0xef"), ], - header_terminator=Bytes(b"\xFF"), + header_terminator=b"\xFF", ), "ef00010100040200010003040001ff00800001305000ef", EOFException.MISSING_TERMINATOR, 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 294ef9237a..d0f3703617 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 @@ -7,16 +7,9 @@ import pytest -from ethereum_test_tools import EOFTestFiller +from ethereum_test_tools import EOFException, EOFTestFiller from ethereum_test_tools import Opcodes as Op -from ethereum_test_tools.eof.v1 import ( - AutoSection, - Bytes, - Container, - EOFException, - Section, - SectionKind, -) +from ethereum_test_tools.eof.v1 import AutoSection, Container, Section, SectionKind from .. import EOF_FORK_NAME @@ -175,7 +168,7 @@ def make_section_order(kind) -> List[Section]: ) section_type = Section( kind=SectionKind.TYPE, - data=Bytes.fromhex("00800001"), + data=bytes.fromhex("00800001"), custom_size=4, skip_header_listing=calculate_skip_flag(SectionKind.TYPE, CasePosition.HEADER), skip_body_listing=calculate_skip_flag(SectionKind.TYPE, CasePosition.BODY), diff --git a/tests/prague/eip7692_eof_v1/eip3540_eof_v1/test_section_size.py b/tests/prague/eip7692_eof_v1/eip3540_eof_v1/test_section_size.py index ab767c074b..96eb30def0 100644 --- a/tests/prague/eip7692_eof_v1/eip3540_eof_v1/test_section_size.py +++ b/tests/prague/eip7692_eof_v1/eip3540_eof_v1/test_section_size.py @@ -6,9 +6,9 @@ import pytest -from ethereum_test_tools import EOFTestFiller +from ethereum_test_tools import EOFException, EOFTestFiller from ethereum_test_tools import Opcodes as Op -from ethereum_test_tools.eof.v1 import Container, EOFException, Section, SectionKind +from ethereum_test_tools.eof.v1 import Container, Section, SectionKind from .. import EOF_FORK_NAME diff --git a/tests/prague/eip7692_eof_v1/eip7069_extcall/test_returndataload.py b/tests/prague/eip7692_eof_v1/eip7069_extcall/test_returndataload.py index 3a7d42ae41..4cffc50514 100644 --- a/tests/prague/eip7692_eof_v1/eip7069_extcall/test_returndataload.py +++ b/tests/prague/eip7692_eof_v1/eip7069_extcall/test_returndataload.py @@ -6,8 +6,7 @@ import pytest -from ethereum_test_tools import Account, Alloc, Environment, StateTestFiller, Transaction -from ethereum_test_tools.common.types import Storage +from ethereum_test_tools import Account, Alloc, Environment, StateTestFiller, Storage, Transaction from ethereum_test_tools.eof.v1 import Container, Section from ethereum_test_tools.vm.opcode import Opcodes as Op diff --git a/tests/prague/eip7692_eof_v1/eip7480_data_section/test_datacopy_memory_expansion.py b/tests/prague/eip7692_eof_v1/eip7480_data_section/test_datacopy_memory_expansion.py index a8e35aea2b..49491e90d8 100644 --- a/tests/prague/eip7692_eof_v1/eip7480_data_section/test_datacopy_memory_expansion.py +++ b/tests/prague/eip7692_eof_v1/eip7480_data_section/test_datacopy_memory_expansion.py @@ -7,15 +7,15 @@ from ethereum_test_tools import ( Account, + Address, Alloc, Bytecode, Environment, StateTestFiller, Storage, Transaction, + cost_memory_bytes, ) -from ethereum_test_tools.common.base_types import Address -from ethereum_test_tools.common.helpers import cost_memory_bytes from ethereum_test_tools.eof.v1 import Container, Section from ethereum_test_tools.vm.opcode import Opcodes as Op diff --git a/tests/prague/eip7692_eof_v1/eip7620_eof_create/test_returncontract.py b/tests/prague/eip7692_eof_v1/eip7620_eof_create/test_returncontract.py index b2786bc8f1..432bfae1af 100644 --- a/tests/prague/eip7692_eof_v1/eip7620_eof_create/test_returncontract.py +++ b/tests/prague/eip7692_eof_v1/eip7620_eof_create/test_returncontract.py @@ -3,9 +3,8 @@ """ import pytest -from ethereum_test_tools import EOFTestFiller +from ethereum_test_tools import EOFException, EOFTestFiller from ethereum_test_tools.eof.v1 import Container, ContainerKind, Section -from ethereum_test_tools.exceptions import EOFException from ethereum_test_tools.vm.opcode import Opcodes as Op from .. import EOF_FORK_NAME