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

eth: added trace_call to trace on top of arbitrary blocks #21338

Merged
merged 6 commits into from
Sep 7, 2020
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions eth/api_tracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,19 @@ func (api *PrivateDebugAPI) TraceTransaction(ctx context.Context, hash common.Ha
return api.traceTx(ctx, msg, vmctx, statedb, config)
}

// Call lets you trace a given eth_call. returns the structured logs created during the execution of EVM
MariusVanDerWijden marked this conversation as resolved.
Show resolved Hide resolved
// if the given transaction was added on top of the provided block and returns them as a JSON object.
// You can provide -2 as a block number to trace on top of the pending block.
func (api *PrivateDebugAPI) Call(ctx context.Context, args ethapi.CallArgs, blockNrOrHash rpc.BlockNumberOrHash, config *TraceConfig) (interface{}, error) {
MariusVanDerWijden marked this conversation as resolved.
Show resolved Hide resolved
statedb, header, err := api.eth.APIBackend.StateAndHeaderByNumberOrHash(ctx, blockNrOrHash)
MariusVanDerWijden marked this conversation as resolved.
Show resolved Hide resolved
if err != nil {
return nil, err
}
msg := args.ToMessage(api.eth.APIBackend.RPCGasCap())
vmctx := core.NewEVMContext(msg, header, api.eth.blockchain, nil)
return api.traceTx(ctx, msg, vmctx, statedb, config)
}

// traceTx configures a new tracer according to the provided configuration, and
// executes the given message in the provided environment. The return value will
// be tracer dependent.
Expand Down