Skip to content

Commit

Permalink
fix: capture SSTORE-touched storage slots for correct gas computations
Browse files Browse the repository at this point in the history
  • Loading branch information
delehef authored and delehef committed Feb 22, 2024
1 parent fe1b978 commit 73379fa
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 73379fa

Please sign in to comment.