Skip to content

test_fork_transition_excess_blob_gas_post_blob_genesis()

Documentation for tests/cancun/eip4844_blobs/test_excess_blob_gas_fork_transition.py::test_fork_transition_excess_blob_gas_post_blob_genesis@01f496f4.

Generate fixtures for these test cases for Prague with:

fill -v tests/cancun/eip4844_blobs/test_excess_blob_gas_fork_transition.py::test_fork_transition_excess_blob_gas_post_blob_genesis --fork Prague

Test excessBlobGas calculation in the header when the fork is activated.

Source code in tests/cancun/eip4844_blobs/test_excess_blob_gas_fork_transition.py
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
@pytest.mark.valid_at_transition_to("Prague", subsequent_forks=True)
@pytest.mark.parametrize_by_fork(
    "post_fork_block_count,pre_fork_blobs_per_block,post_fork_blobs_per_block",
    lambda fork: [
        pytest.param(
            SpecHelpers.get_min_excess_blobs_for_blob_gas_price(fork=fork, blob_gas_price=2)
            // (
                fork.max_blobs_per_block(timestamp=FORK_TIMESTAMP)
                - fork.target_blobs_per_block(timestamp=FORK_TIMESTAMP)
            )
            + 2,
            fork.max_blobs_per_block(timestamp=0),
            fork.max_blobs_per_block(timestamp=FORK_TIMESTAMP),
            id="max_blobs",
        ),
        pytest.param(
            10,
            0,
            fork.max_blobs_per_block(timestamp=FORK_TIMESTAMP),
            id="no_blobs_before",
        ),
        pytest.param(
            10,
            fork.max_blobs_per_block(timestamp=0),
            0,
            id="no_blobs_after",
        ),
        pytest.param(
            10,
            fork.target_blobs_per_block(timestamp=0),
            fork.target_blobs_per_block(timestamp=FORK_TIMESTAMP),
            id="target_blobs",
        ),
        pytest.param(
            10,
            1,
            fork.max_blobs_per_block(timestamp=FORK_TIMESTAMP),
            id="single_blob_to_max_blobs",
        ),
        pytest.param(
            10,
            fork.max_blobs_per_block(timestamp=0),
            1,
            id="max_blobs_to_single_blob",
        ),
    ],
)
def test_fork_transition_excess_blob_gas_post_blob_genesis(
    blockchain_test: BlockchainTestFiller,
    env: Environment,
    pre: Alloc,
    pre_fork_blocks: List[Block],
    post_fork_blocks: List[Block],
    post: Mapping[Address, Account],
):
    """Test `excessBlobGas` calculation in the header when the fork is activated."""
    blockchain_test(
        pre=pre,
        post=post,
        blocks=pre_fork_blocks + post_fork_blocks,
        genesis_environment=env,
    )

Parametrized Test Cases

This test case is only parametrized by fork.

Test ID (Abbreviated) post_fork_block_count pre_fork_blobs_per_block post_fork_blobs_per_block
...fork_CancunToPragueAtTime15k-max_blobs-blockchain_test 11 6 9
...fork_CancunToPragueAtTime15k-no_blobs_before-blockchain_test 10 0 9
...fork_CancunToPragueAtTime15k-no_blobs_after-blockchain_test 10 6 0
...fork_CancunToPragueAtTime15k-target_blobs-blockchain_test 10 3 6
...fork_CancunToPragueAtTime15k-single_blob_to_max_blobs-blockchain_test 10 1 9
...fork_CancunToPragueAtTime15k-max_blobs_to_single_blob-blockchain_test 10 6 1