Commit c3363225 authored by Matthew Slipper's avatar Matthew Slipper Committed by GitHub

l2geth: Fix NPE in API tracer (#2873)

The `debug_standardTraceBlockToFile` RPC was panicing here:

```go
// Line 572 in eth/api_tracer.go
if config != nil && config.Overrides != nil {
```

`config` is an instance of `StdTraceConfig`, which embeds a pointer to `vm.LogConfig`. This pointer is `nil` when the user doesn't pass in any overrides. Since `vm.LogConfig` exposes the `Overrides` parameter, this caused a panic.

`debug_standardTraceBlockToFile` is required for users like Dune, who need access to transaction traces that are too complex to serve over RPC.
parent d1b1089b
---
'@eth-optimism/l2geth': patch
---
fix NPE in debug_standardTraceBlockToFile
...@@ -65,7 +65,7 @@ type TraceConfig struct { ...@@ -65,7 +65,7 @@ type TraceConfig struct {
// StdTraceConfig holds extra parameters to standard-json trace functions. // StdTraceConfig holds extra parameters to standard-json trace functions.
type StdTraceConfig struct { type StdTraceConfig struct {
*vm.LogConfig vm.LogConfig
Reexec *uint64 Reexec *uint64
TxHash common.Hash TxHash common.Hash
} }
...@@ -550,9 +550,7 @@ func (api *PrivateDebugAPI) standardTraceBlockToFile(ctx context.Context, block ...@@ -550,9 +550,7 @@ func (api *PrivateDebugAPI) standardTraceBlockToFile(ctx context.Context, block
txHash common.Hash txHash common.Hash
) )
if config != nil { if config != nil {
if config.LogConfig != nil { logConfig = config.LogConfig
logConfig = *config.LogConfig
}
txHash = config.TxHash txHash = config.TxHash
} }
logConfig.Debug = true logConfig.Debug = true
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment