Skip to content

Test Deep Branch

Documentation for tests/benchmark/stateful/bloatnet/depth_benchmarks/test_deep_branch.py@c17999c0.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/benchmark/stateful/bloatnet/depth_benchmarks/test_deep_branch.py --gas-benchmark-values 1

BloatNet worst-case depth benchmarks for deep SSTORE and SLOAD.

This test implements a worst-case scenario for Ethereum block processing that exploits the computational complexity of Patricia Merkle Trie operations. It uses CREATE2 to deploy contracts at pre-mined addresses with shared prefixes, maximizing trie traversal depth.

Key features:

  • Accesses pre-deployed contracts via CREATE2 address derivation
  • Each contract has deep storage slots with configurable trie depth
  • Includes both a mutating attack(uint256) benchmark and a read-only getDeepest() benchmark
  • Respects Fusaka tx gas limit (16M gas) and fills blocks fully
  • Verifies correctness via post-state checks or receipt-status validation

Test parameters:

  • storage_depth: Depth of storage slots (e.g., 10, 11)
  • account_depth: Account address prefix sharing depth (e.g., 6, 7)

Contract sources:

Test Functions Overview

Name Type Cases (Amsterdam) Description
test_worst_depth_get_deepest benchmark_test 13 BloatNet worst-case SLOAD benchmark with deep CREATE2-derived contracts.
test_worst_depth_stateroot_recomp benchmark_test 13 BloatNet worst-case SSTORE attack benchmark with pre-deployed contracts.