Skip to content

Commit

Permalink
ci: fix ci lint error
Browse files Browse the repository at this point in the history
  • Loading branch information
fynnss committed May 14, 2024
1 parent 21c176c commit bb38b1f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
2 changes: 1 addition & 1 deletion cmd/geth/dbcmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Remove blockchain and state databases`,
utils.DataDirFlag,
utils.SyncModeFlag,
},
Usage: "Inspect the MPT tree of the account and contract. the blocknum arg can be latest/snapshot/number.",
Usage: "Inspect the MPT tree of the account and contract. 'blocknum' can be latest/snapshot/number. 'topn' means output the top N storage tries info ranked by the total number of TrieNodes",
Description: `This commands iterates the entrie WorldState.`,
}
dbCheckStateContentCmd = &cli.Command{
Expand Down
11 changes: 2 additions & 9 deletions trie/inspect_trie.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ type stat struct {
}

type trieStat struct {
lock sync.RWMutex
owner common.Hash
totalNodeStat nodeStat
nodeStatByLevel [16]nodeStat
Expand Down Expand Up @@ -140,7 +139,7 @@ func (trieStat *trieStat) Display(ownerAddress string, treeType string) string {
}
table.SetAlignment(1)

for i, _ := range trieStat.nodeStatByLevel {
for i := range trieStat.nodeStatByLevel {
if trieStat.nodeStatByLevel[i].IsEmpty() {
continue
}
Expand Down Expand Up @@ -191,7 +190,6 @@ func NewInspector(tr *Trie, db Database, stateRootHash common.Hash, blockNum uin

// Run statistics, external call
func (s *Inspector) Run() {

ticker := time.NewTicker(30 * time.Second)
go func() {
defer ticker.Stop()
Expand Down Expand Up @@ -304,14 +302,9 @@ func (s *Inspector) DisplayResult() {
fmt.Println(s.results.account.Display("", "AccountTrie"))
fmt.Println("EOA accounts num: ", s.eoaAccountNums)

type SortedTrie struct {
totalNum uint64
ownerAddress string
}
// display contract trie
for _, st := range s.results.storageTopN {
fmt.Printf(st.Display(st.owner.String(), "StorageTrie"))

fmt.Println(st.Display(st.owner.String(), "StorageTrie"))
}
fmt.Printf("Contract Trie, total trie num: %v, ShortNodeCnt: %v, FullNodeCnt: %v, ValueNodeCnt: %v\n",
s.results.storageTrieNum, s.results.storageTotal.ShortNodeCnt.Load(), s.results.storageTotal.FullNodeCnt.Load(), s.results.storageTotal.ValueNodeCnt.Load())
Expand Down

0 comments on commit bb38b1f

Please sign in to comment.