From 73379fa360ec1074a662322adbf5ab4688e2c941 Mon Sep 17 00:00:00 2001 From: Franklin Delehelle Date: Wed, 21 Feb 2024 10:37:29 +0100 Subject: [PATCH] fix: capture SSTORE-touched storage slots for correct gas computations --- .../consensys/linea/blockcapture/BlockCapturer.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arithmetization/src/main/java/net/consensys/linea/blockcapture/BlockCapturer.java b/arithmetization/src/main/java/net/consensys/linea/blockcapture/BlockCapturer.java index 2d5e409ba7..24ea5ea57f 100644 --- a/arithmetization/src/main/java/net/consensys/linea/blockcapture/BlockCapturer.java +++ b/arithmetization/src/main/java/net/consensys/linea/blockcapture/BlockCapturer.java @@ -111,6 +111,16 @@ public void tracePreExecution(MessageFrame frame) { } } + // SSTORE needs to know the previous storage value for correct gas computation + case SSTORE -> { + if (frame.stackSize() > 1) { + final Account account = frame.getWorldUpdater().get(frame.getRecipientAddress()); + final Address address = account.getAddress(); + final UInt256 key = UInt256.fromBytes(frame.getStackItem(0)); + this.reaper.touchStorage(address, key); + } + } + // These access contracts potentially existing before the conflation played out. case CALL, CALLCODE, DELEGATECALL, STATICCALL -> { if (frame.stackSize() > 1) {