Skip to content

Commit 0b1e698

Browse files
LouisTsai-Csiedanceratopz
authored andcommitted
refactor(test-benchmark): organize stateful benchmark folder structure (#3152)
* chore: relocate balance stateful benchmark - Rename test_bloatnet_balance_opcode to test_balance_query for readability - Move `test_balance_query` from `test_multi_opocode` to `test_account_query` folder * refactor: rename test_create2_access to test_create_operation * chore: organize call related stateful benchmark - create test_call_operation file - move test_call_value_existing and test_call_value_new_account - rename test name * refactor: relocate erc20 elated benchmark - add test_erc20_operation file - move test_sload_erc20_generic, test_sstore_erc20_generic, test_mixed_sload_sstore to same file * refactor: relocate sload benchmark - add test_sload file - move sload related benchmark * refactor: relocate sstore benchmark - add test_sstore file - move test_sstore_bloated, test_sstore_dirty_transitions to new file * chore: move test_extcodesize_bytecode_sizes to test_account_query * chore: docstring, comment refactor * docs: update stub-dependent test examples after benchmark reorg * chore(tests): fix markdown rendering in bloatnet benchmark docstrings * refactor(test-benchmark): file renaming, remove _operation suffix --------- Co-authored-by: danceratopz <danceratopz@gmail.com>
1 parent 9e9bf90 commit 0b1e698

16 files changed

Lines changed: 2265 additions & 2334 deletions

docs/filling_tests/fill_stateful.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ Each `pre_run/<start_block_hash>.json` (a `StatefulPreRunFixture`) is replayed o
149149

150150
## Stub-dependent tests
151151

152-
Some stateful tests (e.g. `test_single_opcode.py`, `test_multi_opcode.py`) target on-chain accounts the snapshot already contains. They reach them two ways:
152+
Some stateful tests (e.g. `test_erc20_operation.py`, `test_sload.py`) target on-chain accounts the snapshot already contains. They reach them two ways:
153153

154154
- `@pytest.mark.stub_parametrize("name", "prefix_")` — parametrize values pulled from `--address-stubs` matching `prefix_`.
155155
- `pre.deploy_contract(stub="<label>", ...)` — direct runtime lookup.

tests/benchmark/stateful/bloatnet/README.md

Lines changed: 0 additions & 94 deletions
This file was deleted.

tests/benchmark/stateful/bloatnet/depth_benchmarks/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The test measures the performance impact of state root recomputation and IO when
1515

1616
## Contract Sources
1717

18-
- **Pre-mined assets** (depth\__.sol, s_\_acc\*.json): https://github.com/CPerezz/worst_case_miner/tree/master/mined_assets
18+
- **Pre-mined assets** (`depth_*.sol`, `s*_acc*.json`): https://github.com/CPerezz/worst_case_miner/tree/master/mined_assets
1919

2020
For complete deployment setup and instructions, see the gist: https://gist.github.com/CPerezz/44d521c0f9e6adf7d84187a4f2c11978
2121

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
"""
2-
abstract: BloatNet worst-case attack benchmark for maximum SSTORE stress.
3-
"""
1+
"""BloatNet worst-case attack benchmark for maximum SSTORE stress."""

tests/benchmark/stateful/bloatnet/depth_benchmarks/test_deep_branch.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
"""
2-
abstract: BloatNet worst-case depth benchmarks for deep SSTORE and SLOAD.
2+
BloatNet worst-case depth benchmarks for deep SSTORE and SLOAD.
33
44
This test implements a worst-case scenario for Ethereum block processing
55
that exploits the computational complexity of Patricia Merkle Trie
66
operations. It uses CREATE2 to deploy contracts at pre-mined addresses
77
with shared prefixes, maximizing trie traversal depth.
88
99
Key features:
10+
1011
- Accesses pre-deployed contracts via CREATE2 address derivation
1112
- Each contract has deep storage slots with configurable trie depth
1213
- Includes both a mutating `attack(uint256)` benchmark and a read-only
@@ -15,11 +16,13 @@
1516
- Verifies correctness via post-state checks or receipt-status validation
1617
1718
Test parameters:
19+
1820
- storage_depth: Depth of storage slots (e.g., 10, 11)
1921
- account_depth: Account address prefix sharing depth (e.g., 6, 7)
2022
2123
Contract sources:
22-
- Pre-mined assets (depth_*.sol, s*_acc*.json):
24+
25+
- Pre-mined assets (`depth_*.sol`, `s*_acc*.json`):
2326
https://github.com/CPerezz/worst_case_miner/tree/master/mined_assets
2427
"""
2528

@@ -500,6 +503,7 @@ def test_worst_depth_stateroot_recomp(
500503
BloatNet worst-case SSTORE attack benchmark with pre-deployed contracts.
501504
502505
This test:
506+
503507
1. Derives CREATE2 addresses from initcode_hash + Nick's deployer
504508
2. Deploys AttackOrchestrator that calls attack() on each target
505509
3. Fills blocks with 16M gas transactions attacking contracts

0 commit comments

Comments
 (0)