From 1bf9670149217fa8fd67deb8315abf6be42da310 Mon Sep 17 00:00:00 2001 From: fselmo Date: Mon, 13 Oct 2025 13:05:32 -0600 Subject: [PATCH] fix: track implicit SLOAD within SSTORE for OOG cases --- src/ethereum/forks/amsterdam/vm/instructions/storage.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/ethereum/forks/amsterdam/vm/instructions/storage.py b/src/ethereum/forks/amsterdam/vm/instructions/storage.py index ab5da8376f..202c795cb2 100644 --- a/src/ethereum/forks/amsterdam/vm/instructions/storage.py +++ b/src/ethereum/forks/amsterdam/vm/instructions/storage.py @@ -100,6 +100,15 @@ def sstore(evm: Evm) -> None: ) current_value = get_storage(state, evm.message.current_target, key) + # Track the implicit SLOAD that occurs in SSTORE + # This must happen BEFORE charge_gas() so reads are recorded even if OOG + track_storage_read( + state.change_tracker, + evm.message.current_target, + key, + evm.message.block_env.state, + ) + gas_cost = Uint(0) if (evm.message.current_target, key) not in evm.accessed_storage_keys: