diff --git a/packages/testing/src/execution_testing/__init__.py b/packages/testing/src/execution_testing/__init__.py index 0af1799866..b10c00e353 100644 --- a/packages/testing/src/execution_testing/__init__.py +++ b/packages/testing/src/execution_testing/__init__.py @@ -106,7 +106,6 @@ Opcode, OpcodeCallArg, Opcodes, - UndefinedOpcodes, call_return_code, ) @@ -190,7 +189,6 @@ "TransactionTest", "TransactionTestFiller", "TransactionType", - "UndefinedOpcodes", "While", "CoerceBytes", "Withdrawal", diff --git a/packages/testing/src/execution_testing/tools/tests/test_code.py b/packages/testing/src/execution_testing/tools/tests/test_code.py index 45d0e88e26..5da2d3b57b 100644 --- a/packages/testing/src/execution_testing/tools/tests/test_code.py +++ b/packages/testing/src/execution_testing/tools/tests/test_code.py @@ -27,7 +27,7 @@ ) from execution_testing.specs import StateTest from execution_testing.test_types import Alloc, Environment, Transaction -from execution_testing.vm import Op, UndefinedOpcodes +from execution_testing.vm import Op from ..tools_code import CalldataCase, Case, Conditional, Initcode, Switch @@ -699,16 +699,3 @@ def test_switch( t8n=default_t8n, fixture_format=BlockchainFixture, ) - - -def test_full_opcode_range() -> None: - """ - Test that the full opcode range is covered by the opcode set defined by - Opcodes and UndefineOpcodes. - """ - assert len(set(Op) & set(UndefinedOpcodes)) == 0 - full_possible_opcode_set = set(Op) | set(UndefinedOpcodes) - assert len(full_possible_opcode_set) == 256 - assert {op.hex() for op in full_possible_opcode_set} == { - f"{i:02x}" for i in range(256) - } diff --git a/packages/testing/src/execution_testing/vm/__init__.py b/packages/testing/src/execution_testing/vm/__init__.py index 40f4410fe0..b07127aabf 100644 --- a/packages/testing/src/execution_testing/vm/__init__.py +++ b/packages/testing/src/execution_testing/vm/__init__.py @@ -13,7 +13,6 @@ Opcode, OpcodeCallArg, Opcodes, - UndefinedOpcodes, ) # Ergonomic alias for the commonly used Opcodes enum @@ -31,6 +30,5 @@ "OpcodeCallArg", "OpcodeGasCalculator", "Opcodes", - "UndefinedOpcodes", "call_return_code", ) diff --git a/packages/testing/src/execution_testing/vm/opcodes.py b/packages/testing/src/execution_testing/vm/opcodes.py index 3fa693e2cc..31f7cf10e9 100644 --- a/packages/testing/src/execution_testing/vm/opcodes.py +++ b/packages/testing/src/execution_testing/vm/opcodes.py @@ -5768,114 +5768,3 @@ class Macros(Macro, Enum): ---- - None """ - - -class UndefinedOpcodes(Opcode, Enum): - """Enum containing all unknown opcodes (107 at the moment).""" - - OPCODE_0C = Opcode(0x0C) - OPCODE_0D = Opcode(0x0D) - OPCODE_0E = Opcode(0x0E) - OPCODE_0F = Opcode(0x0F) - OPCODE_1F = Opcode(0x1F) - OPCODE_21 = Opcode(0x21) - OPCODE_22 = Opcode(0x22) - OPCODE_23 = Opcode(0x23) - OPCODE_24 = Opcode(0x24) - OPCODE_25 = Opcode(0x25) - OPCODE_26 = Opcode(0x26) - OPCODE_27 = Opcode(0x27) - OPCODE_28 = Opcode(0x28) - OPCODE_29 = Opcode(0x29) - OPCODE_2A = Opcode(0x2A) - OPCODE_2B = Opcode(0x2B) - OPCODE_2C = Opcode(0x2C) - OPCODE_2D = Opcode(0x2D) - OPCODE_2E = Opcode(0x2E) - OPCODE_2F = Opcode(0x2F) - OPCODE_4B = Opcode(0x4B) - OPCODE_4C = Opcode(0x4C) - OPCODE_4D = Opcode(0x4D) - OPCODE_4E = Opcode(0x4E) - OPCODE_4F = Opcode(0x4F) - OPCODE_A5 = Opcode(0xA5) - OPCODE_A6 = Opcode(0xA6) - OPCODE_A7 = Opcode(0xA7) - OPCODE_A8 = Opcode(0xA8) - OPCODE_A9 = Opcode(0xA9) - OPCODE_AA = Opcode(0xAA) - OPCODE_AB = Opcode(0xAB) - OPCODE_AC = Opcode(0xAC) - OPCODE_AD = Opcode(0xAD) - OPCODE_AE = Opcode(0xAE) - OPCODE_AF = Opcode(0xAF) - OPCODE_B0 = Opcode(0xB0) - OPCODE_B1 = Opcode(0xB1) - OPCODE_B2 = Opcode(0xB2) - OPCODE_B3 = Opcode(0xB3) - OPCODE_B4 = Opcode(0xB4) - OPCODE_B5 = Opcode(0xB5) - OPCODE_B6 = Opcode(0xB6) - OPCODE_B7 = Opcode(0xB7) - OPCODE_B8 = Opcode(0xB8) - OPCODE_B9 = Opcode(0xB9) - OPCODE_BA = Opcode(0xBA) - OPCODE_BB = Opcode(0xBB) - OPCODE_BC = Opcode(0xBC) - OPCODE_BD = Opcode(0xBD) - OPCODE_BE = Opcode(0xBE) - OPCODE_BF = Opcode(0xBF) - OPCODE_C0 = Opcode(0xC0) - OPCODE_C1 = Opcode(0xC1) - OPCODE_C2 = Opcode(0xC2) - OPCODE_C3 = Opcode(0xC3) - OPCODE_C4 = Opcode(0xC4) - OPCODE_C5 = Opcode(0xC5) - OPCODE_C6 = Opcode(0xC6) - OPCODE_C7 = Opcode(0xC7) - OPCODE_C8 = Opcode(0xC8) - OPCODE_C9 = Opcode(0xC9) - OPCODE_CA = Opcode(0xCA) - OPCODE_CB = Opcode(0xCB) - OPCODE_CC = Opcode(0xCC) - OPCODE_CD = Opcode(0xCD) - OPCODE_CE = Opcode(0xCE) - OPCODE_CF = Opcode(0xCF) - OPCODE_D0 = Opcode(0xD0) - OPCODE_D1 = Opcode(0xD1) - OPCODE_D2 = Opcode(0xD2) - OPCODE_D3 = Opcode(0xD3) - OPCODE_D4 = Opcode(0xD4) - OPCODE_D5 = Opcode(0xD5) - OPCODE_D6 = Opcode(0xD6) - OPCODE_D7 = Opcode(0xD7) - OPCODE_D8 = Opcode(0xD8) - OPCODE_D9 = Opcode(0xD9) - OPCODE_DA = Opcode(0xDA) - OPCODE_DB = Opcode(0xDB) - OPCODE_DC = Opcode(0xDC) - OPCODE_DD = Opcode(0xDD) - OPCODE_DE = Opcode(0xDE) - OPCODE_DF = Opcode(0xDF) - OPCODE_E0 = Opcode(0xE0) - OPCODE_E1 = Opcode(0xE1) - OPCODE_E2 = Opcode(0xE2) - OPCODE_E3 = Opcode(0xE3) - OPCODE_E4 = Opcode(0xE4) - OPCODE_E5 = Opcode(0xE5) - OPCODE_E6 = Opcode(0xE6) - OPCODE_E7 = Opcode(0xE7) - OPCODE_E8 = Opcode(0xE8) - OPCODE_E9 = Opcode(0xE9) - OPCODE_EA = Opcode(0xEA) - OPCODE_EB = Opcode(0xEB) - OPCODE_EC = Opcode(0xEC) - OPCODE_ED = Opcode(0xED) - OPCODE_EE = Opcode(0xEE) - OPCODE_EF = Opcode(0xEF) - OPCODE_F6 = Opcode(0xF6) - OPCODE_F7 = Opcode(0xF7) - OPCODE_F8 = Opcode(0xF8) - OPCODE_F9 = Opcode(0xF9) - OPCODE_FB = Opcode(0xFB) - OPCODE_FC = Opcode(0xFC) diff --git a/tests/frontier/opcodes/test_all_opcodes.py b/tests/frontier/opcodes/test_all_opcodes.py index bf87d21836..d9d4eac34c 100644 --- a/tests/frontier/opcodes/test_all_opcodes.py +++ b/tests/frontier/opcodes/test_all_opcodes.py @@ -18,7 +18,6 @@ ParameterSet, StateTestFiller, Transaction, - UndefinedOpcodes, gas_test, ) @@ -78,7 +77,9 @@ def test_all_opcodes( code_worked = 1000 code_contract: Dict[Opcode, Address] = {} - for opcode in sorted(set(Op) | set(UndefinedOpcodes)): + valid_opcodes = set(fork.valid_opcodes()) + all_opcodes = set(Opcode(i) for i in range(0xFF + 1)) + for opcode in sorted(valid_opcodes | all_opcodes): code_contract[opcode] = pre.deploy_contract( balance=10, code=prepare_stack(opcode) + opcode + prepare_suffix(opcode), @@ -116,9 +117,7 @@ def test_all_opcodes( sender=pre.fund_eoa(), gas_limit=9_000_000, to=contract_address, - data=b"", - value=0, - protected=False, + protected=fork.supports_protected_txs(), ) state_test(pre=pre, post=post, tx=tx)