- 
                Notifications
    
You must be signed in to change notification settings  - Fork 21.5k
 
cmd/dbcmd: add inspect trie tool to analysis trie storage #28892
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
| 
           This PR on mainnet:  | 
    
| 
           Nice job! @MariusVanDerWijden Currently, only the hash of the contract address can be printed. The contract address can be obtained through the preimage.  | 
    
3bdeec1    to
    1581066      
    Compare
  
    36b7785    to
    1649310      
    Compare
  
    | 
           Still getting killed with OOM for me...  | 
    
Co-authored-by: Fynn <zcheng1004@gmail.com> Co-authored-by: lightclient <lightclient@protonmail.com> Co-authored-by: MariusVanDerWijden <m.vanderwijden@live.de>
b66c822    to
    f651600      
    Compare
  
    There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a few comments. Regarding verkle/binary, I can add support for it later.
| // triestat tracks the type and count of trie nodes at each level in the trie. | ||
| // | ||
| // Note: theoretically it is possible to have up to 64 trie level. Since it is | ||
| // unlikely to encounter such a large trie, the stats are capped at 16 levels to | ||
| // avoid substantial unneeded allocation. | ||
| type triestat struct { | ||
| level [16]stat | ||
| } | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is a similar structure in core/stateless/stats, it should be merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me look into this.
| } | ||
| 
               | 
          ||
| table := newTableWriter(os.Stdout) | ||
| table := tablewriter.NewWriter(os.Stdout) | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see the point of moving this to its own package, the tree writer is only used in trie, which is the one importing rawdb.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved it to it's own package because it isn't exported from rawdb. It felt wrong to expose it publicly in that package.
This pr adds a tool names
inpsect-trie, aimed to analyze the mpt and its node storage more efficiently.Example
./geth db inspect-trie --datadir server/data-seed/ latest 4000
Result