Skip to content

Commit 1a98ca7

Browse files
authored
calculate tree index correctly for SLOAD access event (#79)
1 parent b7d0870 commit 1a98ca7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

core/vm/instructions.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,13 +605,13 @@ func opSload(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]by
605605
loc := scope.Stack.peek()
606606
hash := common.Hash(loc.Bytes32())
607607
val := interpreter.evm.StateDB.GetState(scope.Contract.Address(), hash)
608-
loc.SetBytes(val.Bytes())
609608

610609
if interpreter.evm.chainConfig.IsCancun(interpreter.evm.Context.BlockNumber) {
611610
index := trieUtils.GetTreeKeyStorageSlot(scope.Contract.Address().Bytes(), loc)
612611
// TODO SSTORE write events
613612
interpreter.evm.Accesses.SetLeafValue(index, val.Bytes())
614613
}
614+
loc.SetBytes(val.Bytes())
615615
return nil, nil
616616
}
617617

0 commit comments

Comments
 (0)