diff --git a/tests/prague/eip7692_eof_v1/eip7620_eof_create/test_gas.py b/tests/prague/eip7692_eof_v1/eip7620_eof_create/test_gas.py index e536414a02..27fb4e79b1 100644 --- a/tests/prague/eip7692_eof_v1/eip7620_eof_create/test_gas.py +++ b/tests/prague/eip7692_eof_v1/eip7620_eof_create/test_gas.py @@ -6,6 +6,7 @@ from ethereum_test_tools import Alloc, Environment, StateTestFiller, compute_eofcreate_address from ethereum_test_tools.eof.v1 import Container, Section +from ethereum_test_tools.utility.pytest import extend_with_defaults from ethereum_test_tools.vm.opcode import Opcodes as Op from ethereum_test_types.helpers import cost_memory_bytes @@ -53,64 +54,113 @@ def make_factory(initcode: Container): @pytest.mark.parametrize("value", [0, 1]) @pytest.mark.parametrize("new_account", [True, False]) @pytest.mark.parametrize( - "mem_expansion_bytes", - [0, 1, 32, 33], -) -@pytest.mark.parametrize( - ["initcode", "initcode_execution_cost", "runtime"], - [ - pytest.param( - smallest_initcode_subcontainer, - smallest_initcode_subcontainer_gas, - smallest_runtime_subcontainer, - id="smallest_code", - ), - pytest.param( - Container.Init(aborting_container), - smallest_initcode_subcontainer_gas, - aborting_container, - id="aborting_runtime", - ), - pytest.param( - reverting_container, smallest_initcode_subcontainer_gas, None, id="reverting_initcode" - ), - pytest.param( - expensively_reverting_container, - expensively_reverting_container_gas, - None, - id="expensively_reverting_initcode", - ), - pytest.param( - Container.Init(big_runtime_subcontainer), - smallest_initcode_subcontainer_gas, - big_runtime_subcontainer, - id="big_runtime", + **extend_with_defaults( + defaults=dict( + mem_expansion_bytes=0, + initcode=smallest_initcode_subcontainer, + initcode_execution_cost=smallest_initcode_subcontainer_gas, + runtime=smallest_runtime_subcontainer, ), - pytest.param( - Container.Init(make_factory(smallest_initcode_subcontainer)), - smallest_initcode_subcontainer_gas, - make_factory(smallest_initcode_subcontainer), - id="nested_initcode", - ), - pytest.param( - bigger_initcode_subcontainer, - bigger_initcode_subcontainer_gas, - smallest_runtime_subcontainer, - id="bigger_initcode", - ), - pytest.param( - data_initcode_subcontainer, - smallest_initcode_subcontainer_gas, - data_runtime_container, - id="data_initcode", - ), - pytest.param( - data_appending_initcode_subcontainer, - data_appending_initcode_subcontainer_gas, - data_runtime_container, - id="data_appending_initcode", - ), - ], + cases=[ + pytest.param( + dict(), + id="smallest_code", + ), + pytest.param( + dict( + mem_expansion_bytes=1, + ), + id="mem_expansion_1byte", + ), + pytest.param( + dict( + mem_expansion_bytes=32, + ), + id="mem_expansion_1word", + ), + pytest.param( + dict( + mem_expansion_bytes=33, + ), + id="mem_expansion_2words", + ), + pytest.param( + dict( + initcode=Container.Init(aborting_container), + runtime=aborting_container, + ), + id="aborting_runtime", + ), + pytest.param( + dict( + initcode=reverting_container, + runtime=None, + ), + id="reverting_initcode", + ), + pytest.param( + dict( + mem_expansion_bytes=1, + initcode=reverting_container, + runtime=None, + ), + id="reverting_initcode_mem_expansion_1byte", + ), + pytest.param( + dict( + initcode=expensively_reverting_container, + initcode_execution_cost=expensively_reverting_container_gas, + runtime=None, + ), + id="expensively_reverting_initcode", + ), + pytest.param( + dict( + initcode=Container.Init(big_runtime_subcontainer), + runtime=big_runtime_subcontainer, + ), + id="big_runtime", + ), + pytest.param( + dict( + initcode=Container.Init(make_factory(smallest_initcode_subcontainer)), + runtime=make_factory(smallest_initcode_subcontainer), + ), + id="nested_initcode", + ), + pytest.param( + dict( + initcode=bigger_initcode_subcontainer, + initcode_execution_cost=bigger_initcode_subcontainer_gas, + ), + id="bigger_initcode", + ), + pytest.param( + dict( + initcode=data_initcode_subcontainer, + runtime=data_runtime_container, + ), + id="data_initcode", + ), + pytest.param( + dict( + initcode=data_appending_initcode_subcontainer, + initcode_execution_cost=data_appending_initcode_subcontainer_gas, + runtime=data_runtime_container, + ), + id="data_appending_initcode", + ), + pytest.param( + dict( + mem_expansion_bytes=1, + initcode=data_appending_initcode_subcontainer, + initcode_execution_cost=data_appending_initcode_subcontainer_gas, + runtime=data_runtime_container, + ), + id="data_appending_initcode_mem_expansion_1byte", + ), + ], + ) ) def test_eofcreate_gas( state_test: StateTestFiller,