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 committed Feb 21, 2024
1 parent f16aabc commit a261b93
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 a261b93

Please sign in to comment.