Skip to content

test_worst_blockhash()

Documentation for tests/benchmark/test_worst_stateful_opcodes.py::test_worst_blockhash@88e9fb8f.

Generate fixtures for these test cases for Osaka with:

fill -v tests/benchmark/test_worst_stateful_opcodes.py::test_worst_blockhash -m benchmark

Test running a block with as many blockhash accessing oldest allowed block as possible.

Source code in tests/benchmark/test_worst_stateful_opcodes.py
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
def test_worst_blockhash(
    benchmark_test: BenchmarkTestFiller,
    pre: Alloc,
    fork: Fork,
    gas_benchmark_value: int,
    tx_gas_limit_cap: int,
) -> None:
    """
    Test running a block with as many blockhash accessing oldest allowed block
    as possible.
    """
    # Create 256 dummy blocks to fill the blockhash window.
    blocks = [Block()] * 256

    benchmark_test(
        setup_blocks=blocks,
        code_generator=ExtCallGenerator(attack_block=Op.BLOCKHASH(1)),
        expected_benchmark_gas_used=gas_benchmark_value,
    )

Parametrized Test Cases

This test case is only parametrized by fork.

Test ID (Abbreviated)
...fork_Prague-blockchain_test
...fork_Osaka-blockchain_test