Skip to content

test_worst_extcodecopy_warm()

Documentation for tests/zkevm/test_worst_stateful_opcodes.py::test_worst_extcodecopy_warm@64f949d0.

Generate fixtures for these test cases for Prague with:

fill -v tests/zkevm/test_worst_stateful_opcodes.py::test_worst_extcodecopy_warm --fork Prague

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

Source code in tests/zkevm/test_worst_stateful_opcodes.py
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
484
485
486
487
488
489
490
491
492
@pytest.mark.valid_from("Cancun")
@pytest.mark.parametrize(
    "copied_size",
    [
        pytest.param(512, id="512"),
        pytest.param(1024, id="1KiB"),
        pytest.param(5 * 1024, id="5KiB"),
    ],
)
@pytest.mark.slow()
def test_worst_extcodecopy_warm(
    state_test: StateTestFiller,
    pre: Alloc,
    copied_size: int,
):
    """Test running a block with as many wamr EXTCODECOPY work as possible."""
    env = Environment()

    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=env.gas_limit,
        sender=pre.fund_eoa(),
    )

    state_test(
        genesis_environment=env,
        pre=pre,
        post={},
        tx=tx,
    )

Parametrized Test Cases

The interactive table below is also available as a standalone page.

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