-
Notifications
You must be signed in to change notification settings - Fork 643
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(state-viewer): simple gas counter extraction #7733
Conversation
lookup the charged gas counters for an executed function call
@matklad I really want some debugging tooling like proposed in this PR. For now just extracting gas counters for one receipt. Next step would be to apply a parameter diff to it and recompute the cost. And do that with entire block ranges, We needed such a tool in the past, we need it now, and we will likely need it again in the future. So far we usually ended up replaying entire ranges with manual one-shot code changes and parsing scripts, such as the one from Edvard. I don't want to write yet another such script, so I'm trying to make it more generally useful. :) But it is a bit awkward to implement. Our gas profiles and parameters are still not connected directly. To make it work here, I added a mapping As reminder: Today we use The estimator has its own Long-term, I think expanding the But I wonder if you think it makes sense to have some incomplete tool like this merged in. Or maybe you see some better way and I am going in the complete wrong direction here. |
Hm, so the code here reminds me of #5719. I think here we implement exactly the same "gas -> counts" logic we used there. I guess my super-high level comment is that we have too much infrastructure here already:
So, before we add something here, I wonder if we can remove anything? In particular, this |
Reverse-engineer the charged gas counters for an executed function call
in the state viewer. This is useful to have in the state viewer because the
RPC request for tx-status only gives the total gas values per cost.
A next step building on top would be another state viewer command that
takes a set of parameter changes and a range of blocks. It could then
find receipts that are successful with the old config but would run out of
gas with the new parameters. This is useful to evaluate any sort of gas
increase.
So far, only the counters for WASM execution / host function calls
are supported. Adding action counters would be much more effort
and probably it makes more sense to include more details in the
gas profile first.