-
Notifications
You must be signed in to change notification settings - Fork 16
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
Relay Call Trace API #30
Conversation
Tested using temp pytest: https://github.com/testinprod-io/erigon/tree/op-erigon-diff-checker 's commit: testinprod-io@1ddc66a
Minor issue: for Test all pass by ignoring |
if err := api.translateCaptureExit(top.gethTrace, tracer); err != nil { | ||
return err | ||
} | ||
for len(callStacks) > 0 && top.idx == len(callStacks[len(callStacks)-1].gethTrace.Calls)-1 { |
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.
It's a little bit confusing to understand the meaning and purpose of idx
. Please add some comments to explain the defenition of idx
, managing rootindex
, and the condition on L259.
Nice PR! Just one small comment, it could be confusing that you mentioned this is a postorder traversal because the result is preorder. I think you said this is postorder because we had to call |
This PR enables prebedrock relay for
debug_traceTransaction
andots_traceTransaction
related methods.debug_traceTransaction
Directly relay API response from l2geth. Stream out json response.
ots_traceTransaction
related methodsRelated methods:
ots_traceTransaction
,ots_getTransactionError
,ots_getInternalOperations
are all relayed. This is possible because I relayedrunTracer
method which is used by all otterscan tracing RPCs.You may wonder l2geth does not have
ots_traceTransaction
implemented, and how could relaying be possible.ots_traceTransaction
can be relayed by rearranging response fromdebug_traceTransaction
.For example, lets examine the following prebedrock tx with hash
txhash = 0xd2c3b3187d003fa65dcb991aba552f867d3b3e23ccfb6e87de15ed53ad819945
API response from
debug_traceTransaction(txhash)
:Response:
Desired output from
ots_traceTransaction(txhash)
:Therefore to generate response of
ots_traceTransaction
, we must do iterative postorder traversal by parsingdebug_traceTransaction
result. I chose iterating not recursing to avoid stack memory consumption.So,
debug_traceTransaction(txhash)
vm.EVMLogger
for stacking up call traces. This automatically addsdepth
field to each call frames from l2geth.