Skip to content

Commit 6eb6015

Browse files
nerolationSamWilsn
authored andcommitted
remove redundent code comments
1 parent b43e1b6 commit 6eb6015

File tree

11 files changed

+66
-26
lines changed

11 files changed

+66
-26
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
"""
2+
Block Access Lists (EIP-7928) implementation for Ethereum Osaka fork.
3+
"""
4+
5+
from .builder import (
6+
BlockAccessListBuilder,
7+
add_balance_change,
8+
add_code_change,
9+
add_nonce_change,
10+
add_storage_read,
11+
add_storage_write,
12+
add_touched_account,
13+
build,
14+
)
15+
from .tracker import (
16+
StateChangeTracker,
17+
set_transaction_index,
18+
track_address_access,
19+
track_balance_change,
20+
track_code_change,
21+
track_nonce_change,
22+
track_storage_read,
23+
track_storage_write,
24+
)
25+
from .utils import (
26+
compute_bal_hash,
27+
ssz_encode_block_access_list,
28+
validate_bal_against_execution,
29+
)
30+
31+
__all__ = [
32+
"BlockAccessListBuilder",
33+
"StateChangeTracker",
34+
"add_balance_change",
35+
"add_code_change",
36+
"add_nonce_change",
37+
"add_storage_read",
38+
"add_storage_write",
39+
"add_touched_account",
40+
"build",
41+
"compute_bal_hash",
42+
"set_transaction_index",
43+
"ssz_encode_block_access_list",
44+
"track_address_access",
45+
"track_balance_change",
46+
"track_code_change",
47+
"track_nonce_change",
48+
"track_storage_read",
49+
"track_storage_write",
50+
"validate_bal_against_execution",
51+
]

src/ethereum/osaka/block_access_lists/builder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Block Access List Builder for EIP-7928
33
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44
5-
This module implements the BAL builder that tracks all account and storage
5+
This module implements the Block Access List builder that tracks all account and storage
66
accesses during block execution and constructs the final BlockAccessList.
77
"""
88

src/ethereum/osaka/block_access_lists/tracker.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
BAL State Change Tracker for EIP-7928
2+
Block Access List State Change Tracker for EIP-7928
33
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44
55
This module tracks state changes during transaction execution to build Block Access Lists.
@@ -27,7 +27,7 @@
2727
@dataclass
2828
class StateChangeTracker:
2929
"""
30-
Tracks state changes during transaction execution for BAL construction.
30+
Tracks state changes during transaction execution for Block Access List construction.
3131
"""
3232
block_access_list_builder: BlockAccessListBuilder
3333
pre_storage_cache: Dict[tuple, U256] = field(default_factory=dict)

src/ethereum/osaka/block_access_lists/utils.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def compute_bal_hash(bal: BlockAccessList) -> Hash32:
3131
"""
3232
Compute the hash of a Block Access List.
3333
34-
The BAL is SSZ-encoded and then hashed with keccak256.
34+
The Block Access List is SSZ-encoded and then hashed with keccak256.
3535
3636
Parameters
3737
----------
@@ -41,7 +41,7 @@ def compute_bal_hash(bal: BlockAccessList) -> Hash32:
4141
Returns
4242
-------
4343
hash :
44-
The keccak256 hash of the SSZ-encoded BAL.
44+
The keccak256 hash of the SSZ-encoded Block Access List.
4545
"""
4646
bal_bytes = ssz_encode_block_access_list(bal)
4747
return keccak256(bal_bytes)
@@ -247,20 +247,20 @@ def validate_bal_against_execution(
247247
block_access_list_builder: Optional['BlockAccessListBuilder'] = None
248248
) -> bool:
249249
"""
250-
Validate that a BAL is structurally correct and optionally matches a builder's state.
250+
Validate that a Block Access List is structurally correct and optionally matches a builder's state.
251251
252252
Parameters
253253
----------
254254
bal :
255255
The Block Access List to validate.
256256
block_access_list_builder :
257-
Optional BAL builder to validate against. If provided, checks that the BAL
258-
hash matches what would be built from the builder's current state.
257+
Optional Block Access List builder to validate against. If provided, checks that the
258+
Block Access List hash matches what would be built from the builder's current state.
259259
260260
Returns
261261
-------
262262
valid :
263-
True if the BAL is structurally valid and matches the builder (if provided).
263+
True if the Block Access List is structurally valid and matches the builder (if provided).
264264
"""
265265
# 1. Validate structural constraints
266266

@@ -326,10 +326,10 @@ def validate_bal_against_execution(
326326
if len(code_change.new_code) > MAX_CODE_SIZE:
327327
return False
328328

329-
# 4. If BAL builder provided, validate against it by comparing hashes
329+
# 4. If Block Access List builder provided, validate against it by comparing hashes
330330
if block_access_list_builder is not None:
331331
from .builder import build
332-
# Build a BAL from the builder
332+
# Build a Block Access List from the builder
333333
expected_bal = build(block_access_list_builder)
334334

335335
# Compare hashes - much simpler!

src/ethereum/osaka/blocks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ class Header:
243243

244244
bal_hash: Hash32
245245
"""
246-
Hash of the Block Access List (BAL) containing all accounts and storage
246+
Hash of the Block Access List containing all accounts and storage
247247
locations accessed during block execution. Introduced in [EIP-7928].
248248
249249
[EIP-7928]: https://eips.ethereum.org/EIPS/eip-7928

src/ethereum/osaka/fork.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ def apply_body(
763763
"""
764764
block_output = vm.BlockOutput()
765765

766-
# Initialize BAL state change tracker
766+
# Initialize Block Access List state change tracker
767767
change_tracker = StateChangeTracker(block_output.block_access_list_builder)
768768

769769
process_unchecked_system_transaction(

src/ethereum/osaka/ssz_types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
SSZ Types for EIP-7928 Block-Level Access Lists
33
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44
5-
This module defines the SSZ data structures for Block-Level Access Lists (BALs)
5+
This module defines the SSZ data structures for Block-Level Access Lists
66
as specified in EIP-7928. These structures enable efficient encoding and
77
decoding of all accounts and storage locations accessed during block execution.
88
"""

src/ethereum/osaka/state.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -510,9 +510,7 @@ def increase_recipient_balance(recipient: Account) -> None:
510510
modify_state(state, sender_address, reduce_sender_balance)
511511
modify_state(state, recipient_address, increase_recipient_balance)
512512

513-
# Track balance changes for BAL
514513
if change_tracker is not None:
515-
# Track new balances after the transfer
516514
sender_new_balance = get_account(state, sender_address).balance
517515
recipient_new_balance = get_account(state, recipient_address).balance
518516

@@ -549,7 +547,6 @@ def set_balance(account: Account) -> None:
549547

550548
modify_state(state, address, set_balance)
551549

552-
# Track balance change for BAL
553550
if change_tracker is not None:
554551
change_tracker.track_balance_change(address, amount, state)
555552

@@ -575,7 +572,7 @@ def increase_nonce(sender: Account) -> None:
575572

576573
modify_state(state, address, increase_nonce)
577574

578-
# Track nonce change for BAL (for ALL accounts and ALL nonce changes)
575+
# Track nonce change for Block Access List (for ALL accounts and ALL nonce changes)
579576
# This includes:
580577
# - EOA senders (transaction nonce increments)
581578
# - Contracts performing CREATE/CREATE2

src/ethereum/osaka/vm/instructions/environment.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ def balance(evm: Evm) -> None:
8787
# Non-existent accounts default to EMPTY_ACCOUNT, which has balance 0.
8888
balance = get_account(evm.message.block_env.state, address).balance
8989

90-
# BAL tracking for address access
9190
if evm.message.change_tracker:
9291
evm.message.change_tracker.track_address_access(address)
9392

@@ -357,7 +356,6 @@ def extcodesize(evm: Evm) -> None:
357356
# OPERATION
358357
code = get_account(evm.message.block_env.state, address).code
359358

360-
# BAL tracking for address access
361359
if evm.message.change_tracker:
362360
evm.message.change_tracker.track_address_access(address)
363361

@@ -403,7 +401,6 @@ def extcodecopy(evm: Evm) -> None:
403401
evm.memory += b"\x00" * extend_memory.expand_by
404402
code = get_account(evm.message.block_env.state, address).code
405403

406-
# BAL tracking for address access
407404
if evm.message.change_tracker:
408405
evm.message.change_tracker.track_address_access(address)
409406

@@ -493,7 +490,6 @@ def extcodehash(evm: Evm) -> None:
493490
# OPERATION
494491
account = get_account(evm.message.block_env.state, address)
495492

496-
# BAL tracking for address access
497493
if evm.message.change_tracker:
498494
evm.message.change_tracker.track_address_access(address)
499495

src/ethereum/osaka/vm/instructions/storage.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ def sload(evm: Evm) -> None:
6060
evm.message.block_env.state, evm.message.current_target, key
6161
)
6262

63-
# BAL tracking
6463
if evm.message.change_tracker:
6564
evm.message.change_tracker.track_storage_read(
6665
evm.message.current_target, key, evm.message.block_env.state
@@ -134,7 +133,6 @@ def sstore(evm: Evm) -> None:
134133
raise WriteInStaticContext
135134
set_storage(state, evm.message.current_target, key, new_value)
136135

137-
# BAL tracking
138136
if evm.message.change_tracker:
139137
evm.message.change_tracker.track_storage_write(
140138
evm.message.current_target, key, new_value, state

0 commit comments

Comments
 (0)