Skip to content

Commit

Permalink
state/stateobject: debug future;
Browse files Browse the repository at this point in the history
  • Loading branch information
0xbundler committed Nov 1, 2023
1 parent 4830682 commit a84415b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions core/state/state_object.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ package state

import (
"bytes"
"encoding/hex"
"fmt"
"github.com/ethereum/go-ethereum/core/state/snapshot"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/trie"
"io"
"math/big"
Expand Down Expand Up @@ -493,12 +495,13 @@ func (s *stateObject) updateTrie() (Trie, error) {
enErr, ok := err.(*trie.ExpiredNodeError)
if !ok {
s.db.setError(fmt.Errorf("state object pendingFutureReviveState err, contract: %v, key: %v, err: %v", s.address, key, err))
log.Info("updateTrie pendingFutureReviveState", "contract", s.address, "key", key, "epoch", s.db.Epoch(), "tr.epoch", tr.Epoch(), "tr", fmt.Sprintf("%p", tr), "ins", fmt.Sprintf("%p", s), "err", err)
continue
}
if _, err = fetchExpiredStorageFromRemote(s.db.expiryMeta, s.address, s.data.Root, tr, enErr.Path, key); err != nil {
s.db.setError(fmt.Errorf("state object pendingFutureReviveState fetchExpiredStorageFromRemote err, contract: %v, key: %v, path: %v, err: %v", s.address, key, enErr.Path, err))
}
//log.Debug("updateTrie pendingFutureReviveState", "contract", s.address, "key", key, "epoch", s.db.Epoch(), "tr.epoch", tr.Epoch(), "tr", fmt.Sprintf("%p", tr), "ins", fmt.Sprintf("%p", s))
log.Info("updateTrie pendingFutureReviveState", "contract", s.address, "key", key, "epoch", s.db.Epoch(), "tr.epoch", tr.Epoch(), "tr", fmt.Sprintf("%p", tr), "ins", fmt.Sprintf("%p", s))
}
// TODO(0xbundler): find some trie node with wrong epoch, temporary add get op, will fix later
//for key, val := range dirtyStorage {
Expand Down Expand Up @@ -924,6 +927,7 @@ func (s *stateObject) getExpirySnapStorage(key common.Hash) ([]byte, error, erro

if val == nil {
// record access empty kv, try touch in updateTrie for duplication
log.Info("getExpirySnapStorage nil val", "addr", s.address, "key", key, "val", val)
s.futureReviveState(key)
return nil, nil, nil
}
Expand All @@ -939,7 +943,7 @@ func (s *stateObject) getExpirySnapStorage(key common.Hash) ([]byte, error, erro
if s.db.EnableLocalRevive() && len(val.GetVal()) > 0 {
s.futureReviveState(key)
getCommittedStorageExpiredLocalReviveMeter.Mark(1)
//log.Debug("getExpirySnapStorage GetVal", "addr", s.address, "key", key, "val", hex.EncodeToString(val.GetVal()))
log.Info("getExpirySnapStorage GetVal", "addr", s.address, "key", key, "val", hex.EncodeToString(val.GetVal()))
return val.GetVal(), nil, nil
}

Expand Down

0 comments on commit a84415b

Please sign in to comment.