Skip to content

Commit

Permalink
test: fix pathdb unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
VM committed Sep 10, 2024
1 parent 176b3f0 commit 186c59c
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 9 deletions.
1 change: 0 additions & 1 deletion cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import (
"time"

"github.com/ethereum/go-ethereum/core/txpool/bundlepool"

pcsclite "github.com/gballet/go-libpcsclite"
gopsutil "github.com/shirou/gopsutil/mem"
"github.com/urfave/cli/v2"
Expand Down
2 changes: 1 addition & 1 deletion triedb/pathdb/asyncnodebuffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ func (nc *nodecache) flush(db ethdb.KeyValueStore, clean *fastcache.Cache, id ui
commitBytesMeter.Mark(int64(size))
commitNodesMeter.Mark(int64(nodes))
commitTimeTimer.UpdateSince(start)
log.Info("Persisted pathdb nodes 2222", "nodes", len(nc.nodes), "bytes", common.StorageSize(size), "elapsed", common.PrettyDuration(time.Since(start)))
log.Debug("Persisted pathdb nodes", "nodes", len(nc.nodes), "bytes", common.StorageSize(size), "elapsed", common.PrettyDuration(time.Since(start)))
nc.reset()
return nil
}
Expand Down
6 changes: 0 additions & 6 deletions triedb/pathdb/history.go
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,6 @@ func (h *history) decode(accountData, storageData, accountIndexes, storageIndexe
func (h *history) Size() int {
size := 0

// calculate size of meta
if h.meta != nil {
metaSize := 1
metaSize += len(h.meta.parent) + len(h.meta.root)
Expand All @@ -526,25 +525,20 @@ func (h *history) Size() int {

size += metaSize
}
// calculate size of accounts
for address, data := range h.accounts {
size += len(address)
size += len(data)
}
// calculate size of accountList
size += len(h.accountList) * common.AddressLength
// calculate size of storages
for _, storage := range h.storages {
for slotHash, data := range storage {
size += len(slotHash)
size += len(data)
}
}
// calculate size of storageList
for _, slots := range h.storageList {
size += len(slots) * common.HashLength
}
// calculate size of journalNodes
for _, jn := range h.nodes {
size += common.AddressLength
for _, n := range jn.Nodes {
Expand Down
2 changes: 1 addition & 1 deletion triedb/pathdb/nodebufferlist.go
Original file line number Diff line number Diff line change
Expand Up @@ -1096,7 +1096,7 @@ func (mf *multiDifflayer) flush(db ethdb.KeyValueStore, clean *fastcache.Cache,
commitBytesMeter.Mark(int64(size))
commitNodesMeter.Mark(int64(nodes))
commitTimeTimer.UpdateSince(start)
log.Info("Persisted pathdb nodes 1111", "nodes", len(mf.nodes), "bytes", common.StorageSize(size), "state_id", id, "elapsed", common.PrettyDuration(time.Since(start)))
log.Info("Persisted pathdb nodes", "nodes", len(mf.nodes), "bytes", common.StorageSize(size), "state_id", id, "elapsed", common.PrettyDuration(time.Since(start)))
return nil
}

Expand Down

0 comments on commit 186c59c

Please sign in to comment.