Skip to content

test_nested_calls()

Documentation for tests/benchmark/compute/instruction/test_system.py::test_nested_calls@814481c0.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/benchmark/compute/instruction/test_system.py::test_nested_calls --gas-benchmark-values 1

Benchmark chains of nested call frames.

Source code in tests/benchmark/compute/instruction/test_system.py
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
@pytest.mark.parametrize(
    "opcode",
    [Op.CALL, Op.CALLCODE, Op.DELEGATECALL, Op.STATICCALL],
)
def test_nested_calls(
    benchmark_test: BenchmarkTestFiller,
    pre: Alloc,
    opcode: Op,
) -> None:
    """Benchmark chains of nested call frames."""
    chain_address = pre.deploy_contract(
        code=Op.POP(opcode(gas=Op.GAS, address=Op.ADDRESS))
    )

    benchmark_test(
        target_opcode=opcode,
        code_generator=JumpLoopGenerator(
            attack_block=Op.POP(Op.CALL(gas=Op.GAS, address=chain_address))
        ),
    )

Parametrized Test Cases

This test generates 4 parametrized test cases across 3 forks.