Skip to content

Commit

Permalink
log
Browse files Browse the repository at this point in the history
  • Loading branch information
sunny2022da committed Sep 27, 2024
1 parent 8c429ad commit e834002
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 2 additions & 0 deletions core/state/state_object.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package state
import (
"bytes"
"fmt"
"github.com/ethereum/go-ethereum/log"
"io"
"sync"
"time"
Expand Down Expand Up @@ -676,6 +677,7 @@ func (s *stateObject) updateRoot() {
defer func(start time.Time) { s.db.StorageHashes += time.Since(start) }(time.Now())
}
s.data.Root = tr.Hash()
log.Debug("updateRoot", "addr", s.address, "data", s.data)
}

// commit obtains a set of dirty storage trie nodes and updates the account data.
Expand Down
13 changes: 7 additions & 6 deletions core/state/statedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -744,12 +744,9 @@ func (s *StateDB) GetTransientState(addr common.Address, key common.Hash) common

// updateStateObject writes the given object to the trie.
func (s *StateDB) updateStateObject(obj *stateObject) {
/*
if !(s.isParallel && s.parallel.isSlotDB) {
obj.storageRecordsLock.Lock()
defer obj.storageRecordsLock.Unlock()
}
*/
log.Debug("updateStateObject", "addr", obj.address, "data", obj.data,
"object.dirtyNonce", obj.dirtyNonce,
"object.dirtyBalance", obj.dirtyBalance)
if !s.noTrie {
// Track the amount of time wasted on updating the account from the trie
if metrics.EnabledExpensive {
Expand Down Expand Up @@ -789,6 +786,7 @@ func (s *StateDB) updateStateObject(obj *stateObject) {

// deleteStateObject removes the given object from the state trie.
func (s *StateDB) deleteStateObject(obj *stateObject) {
log.Debug("deleteStateObject", "addr", obj.address, "data", obj.data)
if s.noTrie {
return
}
Expand Down Expand Up @@ -1466,6 +1464,7 @@ func (s *StateDB) Finalise(deleteEmptyObjects bool) {
// TODO: For parallel SlotDB, IntermediateRootForSlot is used, need to clean up this method.
func (s *StateDB) IntermediateRoot(deleteEmptyObjects bool) common.Hash {
// Finalise all the dirty storage states and write them into the tries
log.Debug("IntermediateRoot", "deleteEmptyObjects", deleteEmptyObjects)
s.Finalise(deleteEmptyObjects)
s.AccountsIntermediateRoot()
return s.StateIntermediateRoot()
Expand Down Expand Up @@ -1604,8 +1603,10 @@ func (s *StateDB) StateIntermediateRoot() common.Hash {
}

if s.noTrie {
log.Debug("StateIntermediateRoot", "root noTrie", s.expectedRoot)
return s.expectedRoot
} else {
log.Debug("StateIntermediateRoot", "root", s.trie.Hash())
return s.trie.Hash()
}
}
Expand Down

0 comments on commit e834002

Please sign in to comment.