Skip to content
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

tracers: tx-level hooks #24502

Closed
s1na opened this issue Mar 3, 2022 · 2 comments · Fixed by #24510
Closed

tracers: tx-level hooks #24502

s1na opened this issue Mar 3, 2022 · 2 comments · Fixed by #24510
Assignees

Comments

@s1na
Copy link
Contributor

s1na commented Mar 3, 2022

We have EVM-level hooks (CaptureStart, CaptureEnd) and call-level hooks (CaptureEnter, CaptureExit). I'm proposing adding something like CaptureTxStart and CaptureTxEnd.

Why should this feature exist?

This feature makes the following information easily available to tracers: start gas (or intrinsic cost), refund values, any pre-check errors and if we want tx fields.

edit: actually it's not possible to accurately compute the intrinsic cost now in tracers because they don't have access to the access list.

What are the use-cases?

Main reason I started thinking about this is in some of the tracers we have to compute the intrinsic cost & refund value (e.g. in the logger).

Implementation

Invoke the hooks here:

func (st *StateTransition) TransitionDb() (*ExecutionResult, error) {

@rjl493456442
Copy link
Member

Is it possible to merge the CaptureStart and CaptureEnter for both call frame scope? Looks like the only difference right now is CaptureStart is for topmost call frame?

Or we keep it for backward compatibility concern?

@s1na
Copy link
Contributor Author

s1na commented Mar 18, 2022

Is it possible to merge the CaptureStart and CaptureEnter for both call frame scope? Looks like the only difference right now is CaptureStart is for topmost call frame?

I agree it makes sense semantically to have CaptureEnter for all (including) topmost call frames, and move up captureStart to emit only tx-level relevant info. I think it'd need bigger changes in our tracers but I'm gonna give it some more thought.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants