-
Notifications
You must be signed in to change notification settings - Fork 618
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
feat(resharding): implemented state-stats state-viewer command #10094
Conversation
maybe we can add which shard the stat is for as well? :o Also, kinda random question. What value do we get from top state records? |
If you mean to print it to the output then it is. If you mean to add a cmdline argument to select one, I don't need it right now but it can be easily added any time. I opted not to do it upfront to keep the command usage as simple as possible.
It was more of a "I can do it" rather than "I need to do it" kinda thing :) If I had to make up some reason for it, it would be: Generally speaking it would be good to understand the structure and properties of the trie a bit better. |
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.
Looks good! I just hope we aren't duplicating anything from what Robin has.
|
||
let iter = chunk_view.iter_flat_state_entries(None, None); | ||
for item in iter { | ||
let Ok((key, value)) = item else { |
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 like this syntax! Didn't know it existed.
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.
nit: Looking at the implementation of iter_flat_state_entries, it might be fine to just unwrap key value here but can leave as is.
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.
The sytax is cool yeah, just learned it recently too. :)
Actually I wanted to print a warning in there, let me do that.
Also not 100% sure what exactly would be the use of |
@shreyan-gupta What do you mean here?
|
} | ||
} | ||
|
||
fn read_flat_state_value( |
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 think the value itself is used anywhere... Quick optimization, we can perhaps just work with the size of the value instead of the vector value itself? But can leave as is
the state-stats commands iterates the flat state and prints some simple statistics about each shard
It's a bit imperfect as it doesn't combine together different records belonging to the same account (e.g. contract, contract data, ..), but I'll leave that for another time.
For shard 3 the results would suggest that we should reshard at account "tge-lockup.sweat". I'll do further analysis.
here is an output for mainnet as of today