Skip to content

test_push()

Documentation for tests/benchmark/compute/instruction/test_stack.py::test_push@8db70f93.

Generate fixtures for these test cases for Amsterdam with:

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

Benchmark PUSH instruction.

Source code in tests/benchmark/compute/instruction/test_stack.py
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
@pytest.mark.repricing
@pytest.mark.parametrize(
    "opcode",
    [
        pytest.param(Op.PUSH0),
        pytest.param(Op.PUSH1),
        pytest.param(Op.PUSH2),
        pytest.param(Op.PUSH3),
        pytest.param(Op.PUSH4),
        pytest.param(Op.PUSH5),
        pytest.param(Op.PUSH6),
        pytest.param(Op.PUSH7),
        pytest.param(Op.PUSH8),
        pytest.param(Op.PUSH9),
        pytest.param(Op.PUSH10),
        pytest.param(Op.PUSH11),
        pytest.param(Op.PUSH12),
        pytest.param(Op.PUSH13),
        pytest.param(Op.PUSH14),
        pytest.param(Op.PUSH15),
        pytest.param(Op.PUSH16),
        pytest.param(Op.PUSH17),
        pytest.param(Op.PUSH18),
        pytest.param(Op.PUSH19),
        pytest.param(Op.PUSH20),
        pytest.param(Op.PUSH21),
        pytest.param(Op.PUSH22),
        pytest.param(Op.PUSH23),
        pytest.param(Op.PUSH24),
        pytest.param(Op.PUSH25),
        pytest.param(Op.PUSH26),
        pytest.param(Op.PUSH27),
        pytest.param(Op.PUSH28),
        pytest.param(Op.PUSH29),
        pytest.param(Op.PUSH30),
        pytest.param(Op.PUSH31),
        pytest.param(Op.PUSH32),
    ],
)
def test_push(
    benchmark_test: BenchmarkTestFiller,
    opcode: Op,
) -> None:
    """Benchmark PUSH instruction."""
    benchmark_test(
        target_opcode=opcode,
        code_generator=ExtCallGenerator(
            attack_block=opcode[1] if opcode.has_data_portion() else opcode
        ),
    )

Parametrized Test Cases

This test generates 33 parametrized test cases across 3 forks.