Skip to content

Commit

Permalink
Revert "core/state: move UpdateContractCode before the trie hash is c…
Browse files Browse the repository at this point in the history
…omputed (ethereum#27853)"

This reverts commit 075fd1c.
  • Loading branch information
devopsbo3 authored Nov 10, 2023
1 parent 9682fc8 commit 56b68ef
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions core/state/statedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -546,9 +546,6 @@ func (s *StateDB) updateStateObject(obj *stateObject) {
if err := s.trie.UpdateAccount(addr, &obj.data); err != nil {
s.setError(fmt.Errorf("updateStateObject (%x) error: %v", addr[:], err))
}
if obj.dirtyCode {
s.trie.UpdateContractCode(obj.Address(), common.BytesToHash(obj.CodeHash()), obj.code)
}
// Cache the data until commit. Note, this update mechanism is not symmetric
// to the deletion, because whereas it is enough to track account updates
// at commit time, deletions need tracking at transaction boundary level to
Expand Down Expand Up @@ -1192,6 +1189,7 @@ func (s *StateDB) Commit(block uint64, deleteEmptyObjects bool) (common.Hash, er
// Write any contract code associated with the state object
if obj.code != nil && obj.dirtyCode {
rawdb.WriteCode(codeWriter, common.BytesToHash(obj.CodeHash()), obj.code)
s.trie.UpdateContractCode(obj.Address(), common.BytesToHash(obj.CodeHash()), obj.code)
obj.dirtyCode = false
}
// Write any storage changes in the state object to its storage trie
Expand Down

0 comments on commit 56b68ef

Please sign in to comment.