Skip to content

Conversation

gballet
Copy link
Member

@gballet gballet commented Aug 28, 2025

Filtering for leaf nodes was missing from #32388, which means that even the root done was reported, which made little sense for the bloatnet data processing we want to do.

@gballet gballet requested a review from rjl493456442 as a code owner August 28, 2025 10:12
@gballet gballet changed the title core/stateless: only report leaf stats core/stateless: only report leaf depth in witness stats Aug 28, 2025
@gballet gballet added this to the 1.16.3 milestone Aug 28, 2025
// Add records trie access depths from the given node paths.
// If `owner` is the zero hash, accesses are attributed to the account trie;
// otherwise, they are attributed to the storage trie of that account.
func (s *WitnessStats) Add(nodes map[string][]byte, owner common.Hash) {
if owner == (common.Hash{}) {
for path := range maps.Keys(nodes) {
s.accountTrie.add(int64(len(path)))
for path, nodeData := range nodes {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can determine the out-most node ("shortNode" with value embedded) by node path.

e.g., paths: [], [1], [1,2], [1,2,3], [1,2,4]

then we can know [1,2,3] is the one of the target node.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point, the problem is that this is a map and so it forces us to get its keys, sort them and then go over them again and again, like a tree. Probably more efficient if you can make it work, but this is also quite easy to mess up and the code will be way more unreadable. But that's just my intuition, I'll think about it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually I think sorting and checking the path lengths is enough to make things more efficient. I'll continue investigating.

@rjl493456442 rjl493456442 merged commit 931befe into ethereum:master Sep 1, 2025
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants