From 83732f2abfcd1c1b7d7d3cb07b3abd6fd49b8ddd Mon Sep 17 00:00:00 2001 From: danceratopz Date: Wed, 13 May 2026 22:18:46 +0200 Subject: [PATCH] refactor(tests): Use `filter_combinations` marker to drop infeasible cell in `test_varying_calldata_costs` `STORAGE_CLEAR` refund is zero on revert, so `gas_used_pre_refund == gas_used_post_refund` and the `(post, pre)` interval that `DATA_FLOOR_BETWEEN_TX_GAS_BEFORE_AND_AFTER` requires is empty. Replace the runtime `pytest.skip()` with the `filter_combinations` marker introduced in #2543, which runs in `pytest_collection_modifyitems` and can express predicates across covariant-marker-injected and inline parametrize axes uniformly. Keeps `with_all_refund_types()` so new refund types added to the fork in future automatically participate, preserves the original three-decorator parametrize stack, and produces byte-identical fixture IDs and content vs the pre-refactor branch (verified via `diff` on `varying_calldata_costs.json` keys and bodies). The two infeasible items per fork are now deselected at collection time rather than skipped at runtime. --- .../test_gas_accounting.py | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/tests/amsterdam/eip7778_block_gas_accounting_without_refunds/test_gas_accounting.py b/tests/amsterdam/eip7778_block_gas_accounting_without_refunds/test_gas_accounting.py index 27f373a1409..1b6a6be1d81 100644 --- a/tests/amsterdam/eip7778_block_gas_accounting_without_refunds/test_gas_accounting.py +++ b/tests/amsterdam/eip7778_block_gas_accounting_without_refunds/test_gas_accounting.py @@ -370,6 +370,18 @@ class CallDataTestType(Enum): ], ) @pytest.mark.with_all_refund_types() +@pytest.mark.filter_combinations( + lambda refund_type, refund_tx_reverts, calldata_test_type, **_: not ( + refund_type == RefundTypes.STORAGE_CLEAR + and refund_tx_reverts + and calldata_test_type + == CallDataTestType.DATA_FLOOR_BETWEEN_TX_GAS_BEFORE_AND_AFTER + ), + reason=( + "STORAGE_CLEAR refund is zero on revert, so the (post, pre) " + "interval that DATA_FLOOR_BETWEEN needs is empty" + ), +) @pytest.mark.valid_from("EIP7778") def test_varying_calldata_costs( blockchain_test: BlockchainTestFiller, @@ -388,17 +400,6 @@ def test_varying_calldata_costs( 2. tx_gas_after_refund < calldata_floor < tx_gas_before_refund 3. calldata_floor > tx_gas_before_refund """ - if refund_type == RefundTypes.STORAGE_CLEAR: - if ( - refund_tx_reverts - and calldata_test_type - == CallDataTestType.DATA_FLOOR_BETWEEN_TX_GAS_BEFORE_AND_AFTER - ): - pytest.skip( - "calldata_cost cannot be between pre and post refund gas" - "since refund is zero when execution reverts" - ) - match refund_type: case RefundTypes.STORAGE_CLEAR: bytes_to_add_per_iteration = b"00" * 2