test_dup()
Documentation for tests/benchmark/compute/instruction/test_stack.py::test_dup@8db70f93.
Generate fixtures for these test cases for Amsterdam with:
fill -v tests/benchmark/compute/instruction/test_stack.py::test_dup --gas-benchmark-values 1
Benchmark DUP instruction.
Source code in tests/benchmark/compute/instruction/test_stack.py
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89 | @pytest.mark.repricing
@pytest.mark.parametrize(
"opcode",
[
pytest.param(Op.DUP1),
pytest.param(Op.DUP2),
pytest.param(Op.DUP3),
pytest.param(Op.DUP4),
pytest.param(Op.DUP5),
pytest.param(Op.DUP6),
pytest.param(Op.DUP7),
pytest.param(Op.DUP8),
pytest.param(Op.DUP9),
pytest.param(Op.DUP10),
pytest.param(Op.DUP11),
pytest.param(Op.DUP12),
pytest.param(Op.DUP13),
pytest.param(Op.DUP14),
pytest.param(Op.DUP15),
pytest.param(Op.DUP16),
],
)
def test_dup(
benchmark_test: BenchmarkTestFiller,
opcode: Op,
) -> None:
"""Benchmark DUP instruction."""
min_stack_height = opcode.min_stack_height
benchmark_test(
target_opcode=opcode,
code_generator=ExtCallGenerator(
setup=Op.PUSH0 * min_stack_height,
attack_block=opcode,
),
)
|
Parametrized Test Cases
This test generates 16 parametrized test cases across 3 forks.