Skip to content

Commit 3496e71

Browse files
authored
fix: track implicit SLOAD within SSTORE for OOG cases (#18)
1 parent f3ad599 commit 3496e71

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

  • src/ethereum/forks/amsterdam/vm/instructions

src/ethereum/forks/amsterdam/vm/instructions/storage.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,15 @@ def sstore(evm: Evm) -> None:
100100
)
101101
current_value = get_storage(state, evm.message.current_target, key)
102102

103+
# Track the implicit SLOAD that occurs in SSTORE
104+
# This must happen BEFORE charge_gas() so reads are recorded even if OOG
105+
track_storage_read(
106+
state.change_tracker,
107+
evm.message.current_target,
108+
key,
109+
evm.message.block_env.state,
110+
)
111+
103112
gas_cost = Uint(0)
104113

105114
if (evm.message.current_target, key) not in evm.accessed_storage_keys:

0 commit comments

Comments
 (0)