Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions tests/benchmark/stateful/bloatnet/test_single_opcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ def test_sload_bloated_prefetch_miss(
# distinct mode, a single shared sender otherwise). The senders
# list collects one entry per tx so the BAL builder below can
# group nonce changes by sender uniformly.
senders_iter = _sender_generator(pre, distinct_senders)
#senders_iter = _sender_generator(pre, distinct_senders)
senders: list[EOA] = []

gas_available = gas_benchmark_value
Expand All @@ -344,7 +344,8 @@ def test_sload_bloated_prefetch_miss(
# reads an offset the prefetcher's pre-block snapshot does
# not see, achieving a 100% prefetch miss rate on max-gas txs.
first_tx_gas = min(gas_available, intrinsic_gas + 30_000)
sender = next(senders_iter)
sender = pre.fund_eoa()
nondistinct=sender
senders.append(sender)
txs.append(
Transaction(
Expand All @@ -362,14 +363,15 @@ def test_sload_bloated_prefetch_miss(
while gas_available >= intrinsic_gas:
tx_gas = min(gas_available, tx_gas_limit)
new_offset = base_offset + tx_index * max_sloads_per_tx
sender = next(senders_iter)
sender = pre.fund_eoa() if distinct_senders else nondistinct
senders.append(sender)
txs.append(
Transaction(
gas_limit=tx_gas,
to=authority,
data=Hash(new_offset),
sender=sender,
#value=1
)
)
gas_available -= tx_gas
Expand Down Expand Up @@ -498,7 +500,7 @@ def test_sload_bloated_multi_contract(
# distinct mode, a single shared sender otherwise). The senders
# list collects one entry per tx so the BAL builder below can
# group nonce changes by sender uniformly.
senders_iter = _sender_generator(pre, distinct_senders)
#senders_iter = _sender_generator(pre, distinct_senders)
senders: list[EOA] = []

gas_available = gas_benchmark_value
Expand All @@ -507,14 +509,15 @@ def test_sload_bloated_multi_contract(

# Each tx targets a freshly-deployed contract with identical code
# and storage layout.
nondistinct = pre.fund_eoa()
while gas_available >= min_tx_gas:
tx_gas = min(gas_available, tx_gas_limit)
target = pre.deploy_contract(
code=runtime_code,
storage=Storage(storage_data),
)
targets.append(target)
sender = next(senders_iter)
sender = pre.fund_eoa() if distinct_senders else nondistinct
senders.append(sender)
txs.append(
Transaction(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
TestPhaseManager,
Transaction,
)
from execution_testing.test_types.transaction_types import AuthorizationTuple

CURSOR_SLOT = 0
CURSOR_INIT = 1
Expand Down Expand Up @@ -216,16 +217,37 @@ def run_bal_benchmark(
) -> None:
"""Deploy contract, create txs, BAL expectations, and run."""
contract = pre.deploy_contract(
code=contract_code, storage=contract_storage
code=contract_code
)

blocks = []
authority = pre.stub_eoa("bloated_eoa_20GB")
with TestPhaseManager.setup():
sender = pre.fund_eoa()
tx = Transaction(
gas_limit=100_000,
to=sender,
value=0,
sender=sender,
authorization_list=[
AuthorizationTuple(
chain_id=0,
address=contract,
nonce=authority.nonce,
signer=authority,
),
],
)
blocks.append(Block(txs=[tx]))


num_txs = len(plan.gas_limits)
with TestPhaseManager.execution():
sender = pre.fund_eoa()
transactions = [
Transaction(
sender=sender,
to=contract,
to=authority,
gas_limit=plan.gas_limits[i],
data=b"",
)
Expand Down Expand Up @@ -266,6 +288,8 @@ def run_bal_benchmark(
account_expectations=expectations
),
)

blocks.append(block)

# Post-state: only check sender nonce (sanity).
# Exact storage values depend on gas dynamics and may be
Expand All @@ -275,5 +299,5 @@ def run_bal_benchmark(
}

benchmark_test(
pre=pre, post=post, blocks=[block], skip_gas_used_validation=True
pre=pre, post=post, blocks=blocks, skip_gas_used_validation=True
)
Loading