Skip to content

test_worst_extcodecopy_warm()

Documentation for tests/benchmark/test_worst_stateful_opcodes.py::test_worst_extcodecopy_warm@e9958ed2.

Generate fixtures for these test cases for Osaka with:

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

Test running a block with as many wamr EXTCODECOPY work as possible.

Source code in tests/benchmark/test_worst_stateful_opcodes.py
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
@pytest.mark.parametrize(
    "copied_size",
    [
        pytest.param(512, id="512"),
        pytest.param(1024, id="1KiB"),
        pytest.param(5 * 1024, id="5KiB"),
    ],
)
def test_worst_extcodecopy_warm(
    benchmark_test: BenchmarkTestFiller,
    pre: Alloc,
    copied_size: int,
    gas_benchmark_value: int,
) -> None:
    """Test running a block with as many wamr EXTCODECOPY work as possible."""
    copied_contract_address = pre.deploy_contract(
        code=Op.JUMPDEST * copied_size,
    )

    execution_code = (
        Op.PUSH10(copied_size)
        + Op.PUSH20(copied_contract_address)
        + While(
            body=Op.EXTCODECOPY(Op.DUP4, 0, 0, Op.DUP2),
        )
    )
    execution_code_address = pre.deploy_contract(code=execution_code)
    tx = Transaction(
        to=execution_code_address,
        gas_limit=gas_benchmark_value,
        sender=pre.fund_eoa(),
    )

    benchmark_test(tx=tx)

Parametrized Test Cases

This test case is only parametrized by fork.

Test ID (Abbreviated) copied_size
...fork_Prague-blockchain_test-512 512
...fork_Prague-blockchain_test-1KiB 1024
...fork_Prague-blockchain_test-5KiB 5120
...fork_Osaka-blockchain_test-512 512
...fork_Osaka-blockchain_test-1KiB 1024
...fork_Osaka-blockchain_test-5KiB 5120