Skip to content

Commit

Permalink
bugfix: fix the fork: GetState for suicide addr
Browse files Browse the repository at this point in the history
  • Loading branch information
setunapo authored and brilliant-lx committed Oct 1, 2022
1 parent 42b2351 commit c83a843
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions core/state/statedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,9 @@ func (s *StateDB) SubRefund(gas uint64) {
// Exist reports whether the given account address exists in the state.
// Notably this also returns true for suicided accounts.
func (s *StateDB) Exist(addr common.Address) bool {
return s.getStateObject(addr) != nil
exist := s.getStateObject(addr) != nil
log.Info("StateDB Exist", "exist", exist)
return exist
}

// Empty returns whether the state object is either non-existent
Expand Down Expand Up @@ -2853,10 +2855,15 @@ func (s *ParallelStateDB) GetState(addr common.Address, hash common.Hash) common
// 1.Try to get from dirty
if exist, ok := s.parallel.addrStateChangesInSlot[addr]; ok {
if !exist {
return common.Hash{}
// it could be suicided within this SlotDB?
// it should be able to get state from suicided address within a Tx:
// e.g. within a transaction: call addr:suicide -> get state: should be ok
// return common.Hash{}
log.Info("ParallelStateDB GetState suicided", "addr", addr, "hash", hash)
} else {
obj := s.parallel.dirtiedStateObjectsInSlot[addr] // addr must exist in dirtiedStateObjectsInSlot
return obj.GetState(s.db, hash)
}
obj := s.parallel.dirtiedStateObjectsInSlot[addr] // addr must exist in dirtiedStateObjectsInSlot
return obj.GetState(s.db, hash)
}
if keys, ok := s.parallel.kvChangesInSlot[addr]; ok {
if _, ok := keys[hash]; ok {
Expand Down

0 comments on commit c83a843

Please sign in to comment.