Skip to content

test_multi_block_dimension_flip()

Documentation for tests/amsterdam/eip8037_state_creation_gas_cost_increase/test_block_2d_gas_accounting.py::test_multi_block_dimension_flip@87aba1a3.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/amsterdam/eip8037_state_creation_gas_cost_increase/test_block_2d_gas_accounting.py::test_multi_block_dimension_flip --fork Amsterdam

Verify gas_used across blocks where dominant dimension flips.

Block 1: STOP txs only (regular dominates). Block 2: SSTORE txs only (state dominates). Each block independently computes its own 2D max.

Source code in tests/amsterdam/eip8037_state_creation_gas_cost_increase/test_block_2d_gas_accounting.py
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
@pytest.mark.valid_from("EIP8037")
def test_multi_block_dimension_flip(
    blockchain_test: BlockchainTestFiller,
    pre: Alloc,
    fork: Fork,
) -> None:
    """
    Verify gas_used across blocks where dominant dimension flips.

    Block 1: STOP txs only (regular dominates).
    Block 2: SSTORE txs only (state dominates).
    Each block independently computes its own 2D max.
    """
    n = 3
    intrinsic_gas = fork.transaction_intrinsic_cost_calculator()()
    tx_regular, tx_state = sstore_tx_gas(fork)

    block_1 = stop_txs(pre, fork, n)
    block_2, post_2 = sstore_txs(pre, fork, n)

    blockchain_test(
        pre=pre,
        blocks=[
            Block(
                txs=block_1,
                header_verify=Header(gas_used=n * intrinsic_gas),
            ),
            Block(
                txs=block_2,
                header_verify=Header(
                    gas_used=max(n * tx_regular, n * tx_state),
                ),
            ),
        ],
        post=post_2,
    )

Parametrized Test Cases

This test generates 1 parametrized test case across 1 fork.