test_sload_same_key_benchmark()
Documentation for tests/benchmark/stateful/bloatnet/test_sload.py::test_sload_same_key_benchmark@ffe48572.
Generate fixtures for these test cases for Bogota with:
fill -v tests/benchmark/stateful/bloatnet/test_sload.py::test_sload_same_key_benchmark --gas-benchmark-values 1
Benchmark SLOAD instruction when loading the same key over and over.
Variants:
- storage_keys_pre_set: The key is pre-set to a non-zero value.
Source code in tests/benchmark/stateful/bloatnet/test_sload.py
| @pytest.mark.repricing
@pytest.mark.parametrize("storage_keys_pre_set", [False, True])
def test_sload_same_key_benchmark(
benchmark_test: BenchmarkTestFiller,
storage_keys_pre_set: bool,
) -> None:
"""
Benchmark SLOAD instruction when loading the same key over and over.
Variants:
- storage_keys_pre_set: The key is pre-set to a non-zero value.
"""
contract_storage = Storage()
if storage_keys_pre_set:
contract_storage[1] = 1
benchmark_test(
target_opcode=Op.SLOAD,
code_generator=JumpLoopGenerator(
setup=Op.PUSH1(1) if storage_keys_pre_set else Op.PUSH0,
attack_block=Op.SLOAD,
contract_storage=contract_storage,
),
)
|
Parametrized Test Cases
This test generates 2 parametrized test cases across 4 forks.