-
Notifications
You must be signed in to change notification settings - Fork 180
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
[Flow EVM] patch evm debug tracer to collect results and reset internal state after each tx execution #6327
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6327 +/- ##
==========================================
- Coverage 42.37% 40.46% -1.92%
==========================================
Files 1584 1322 -262
Lines 116430 87238 -29192
==========================================
- Hits 49341 35299 -14042
+ Misses 62106 48603 -13503
+ Partials 4983 3336 -1647
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
defer func() { | ||
if proc.evm.Config.Tracer.OnTxEnd != nil { | ||
j := i | ||
res := batchResults[j] | ||
if err == nil && res != nil { | ||
proc.evm.Config.Tracer.OnTxEnd(res.Receipt(), res.ValidationError) | ||
} | ||
} | ||
}() | ||
|
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.
no need to use defer as we don't want to collect the results on unhappy cases
The tracer can be used for multiple transactions and later collect results being called. We need to support storing interim results until the collection time.
Unfortunately, the call tracer is stateful and if not cleaned up could result in bugs. for example, a failed transaction might change the internal state of the call tracer and the next transaction would start from an invalid state. This usually result in an "incorrect number of top-level calls" error.
This PR updates the tracer to collect and hold on to the tracing results after each transaction execution (onTxEnd) and reset the internal state of the tracer before each transaction execution (onTxStart).
It also makes the trace collection during batchRun function more clear.