Skip to content

test_extcodecopy_warm()

Documentation for tests/benchmark/compute/instruction/test_account_query.py::test_extcodecopy_warm@7b8124a7.

Generate fixtures for these test cases for Osaka with:

fill -v tests/benchmark/compute/instruction/test_account_query.py::test_extcodecopy_warm --gas-benchmark-values 1

Benchmark EXTCODECOPY instruction.

Source code in tests/benchmark/compute/instruction/test_account_query.py
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
@pytest.mark.repricing(copied_size=512)
@pytest.mark.parametrize(
    "copy_size",
    [0, 32, 256, 512, 1024],
)
def test_extcodecopy_warm(
    benchmark_test: BenchmarkTestFiller,
    pre: Alloc,
    copy_size: int,
) -> None:
    """Benchmark EXTCODECOPY instruction."""
    copied_contract_address = pre.deploy_contract(
        code=Op.JUMPDEST * copy_size,
    )

    benchmark_test(
        target_opcode=Op.EXTCODECOPY,
        code_generator=JumpLoopGenerator(
            setup=Op.PUSH10(copy_size) + Op.PUSH20(copied_contract_address),
            attack_block=Op.EXTCODECOPY(Op.DUP4, 0, 0, Op.DUP2),
        ),
    )

Parametrized Test Cases

This test generates 5 parametrized test cases across 2 forks.