Skip to content

Commit

Permalink
add some logs;
Browse files Browse the repository at this point in the history
  • Loading branch information
0xbundler committed Nov 15, 2023
1 parent 72a619e commit 433a4c9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions core/state/state_expiry.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,13 @@ func ReviveStorageTrie(addr common.Address, tr Trie, proof types.ReviveStoragePr

nubs, err := tr.TryRevive(key, proofCache.CacheNubs())
if err != nil {
log.Info("ReviveStorageTrie tr.TryRevive", "addr", addr, "key", key, "err", err)
return nil, err
}

// check if it could get from trie
if _, err = tr.GetStorage(addr, key); err != nil {
log.Info("ReviveStorageTrie tr.GetStorage", "addr", addr, "key", key, "err", err)
return nil, err
}

Expand Down
12 changes: 10 additions & 2 deletions core/state/state_object.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import (
"sync"
"time"

"github.com/ethereum/go-ethereum/log"

"github.com/ethereum/go-ethereum/core/state/snapshot"
"github.com/ethereum/go-ethereum/trie"

Expand Down Expand Up @@ -302,15 +304,21 @@ func (s *stateObject) GetCommittedState(key common.Hash) common.Hash {
s.db.setError(fmt.Errorf("state object getTrie err, contract: %v, err: %v", s.address, err))
return common.Hash{}
}
val, err := tr.GetStorage(s.address, key.Bytes())
var val []byte
val, err = tr.GetStorage(s.address, key.Bytes())
if err != nil {
log.Info("tr.GetStorage", "addr", s.address, "key", key, "val", val, "err", err)
}
if metrics.EnabledExpensive {
s.db.StorageReads += time.Since(start)
}
// handle state expiry situation
if s.db.EnableExpire() {
if path, ok := trie.ParseExpiredNodeErr(err); ok {
//log.Debug("GetCommittedState expired in trie", "addr", s.address, "key", key, "err", err)
val, err = s.tryReviveState(path, key)
if err != nil {
log.Info("s.tryReviveState", "addr", s.address, "key", key, "val", val, "err", err)
}
getCommittedStorageExpiredMeter.Mark(1)
} else if err == nil {
getCommittedStorageUnexpiredMeter.Mark(1)
Expand Down

0 comments on commit 433a4c9

Please sign in to comment.