Skip to content

Commit

Permalink
Fix: fix incorrectly set origin storage.
Browse files Browse the repository at this point in the history
Fix an issue of incorrectly set the origin storage at parallel stateDB's
GetState(). Remove this code because it is already solved by lightCopy

PR: bnb-chain#2
  • Loading branch information
DavidZangNR authored and sunny2022da committed Aug 13, 2024
1 parent bc00562 commit 89f61e2
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions core/state/parallel_statedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -660,22 +660,6 @@ func (s *ParallelStateDB) GetState(addr common.Address, hash common.Hash) common
val = common.Hash{}
if object != nil {
val = object.GetState(hash)
// TODO-dav: delete following originStorage change, as lightCopy is copy originStorage now.
// test dirty, there can be a case the object saved in dirty by other changes such as SetBalance. But the
// addrStateChangesInSlot[addr] does not record it. So later load from the dirties would cause flaw because the
// first value loaded from main stateDB is not updated to the object in dirties.
// Moreover, there is also an issue that the other kv in the object get from snap or trie that is accessed from
// previous tx in same block but not touched in current tx, is missed in the dirty. which may cause issues when
// calculate the root.
_, recorded := s.parallel.addrStateChangesInSlot[addr]
obj, isDirty := s.parallel.dirtiedStateObjectsInSlot[addr]
if !recorded && isDirty {
v, ok := obj.originStorage.GetValue(hash)

if !(ok && v.Cmp(val) == 0) {
obj.originStorage.StoreValue(hash, val)
}
}
}
value = val
}
Expand Down

0 comments on commit 89f61e2

Please sign in to comment.