Skip to content

test_dupn()

Documentation for tests/benchmark/compute/instruction/test_stack.py::test_dupn@c17999c0.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/benchmark/compute/instruction/test_stack.py::test_dupn --gas-benchmark-values 1

Benchmark DUPN instruction.

Source code in tests/benchmark/compute/instruction/test_stack.py
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
@pytest.mark.repricing
@pytest.mark.valid_from("Amsterdam")
@pytest.mark.parametrize(
    "stack_index",
    [17, 107, 235],
    ids=lambda x: f"stack_{x}",
)
def test_dupn(
    benchmark_test: BenchmarkTestFiller,
    stack_index: int,
) -> None:
    """Benchmark DUPN instruction."""
    opcode = Op.DUPN[stack_index]
    benchmark_test(
        target_opcode=Op.DUPN,
        code_generator=ExtCallGenerator(
            setup=Op.PUSH0 * opcode.min_stack_height,
            attack_block=opcode,
        ),
    )

Parametrized Test Cases

This test generates 3 parametrized test cases across 1 fork.