From 3beda5cc80b2b79ceeeafe2583899fa2d72a6613 Mon Sep 17 00:00:00 2001 From: anishnaik Date: Tue, 27 Aug 2024 15:42:58 -0400 Subject: [PATCH] fix: check that receipt is non-nil in `OnTxEnd` hook (#457) * throw panic if execution tracing fails * do not store trace in case of error --- fuzzing/executiontracer/execution_tracer.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fuzzing/executiontracer/execution_tracer.go b/fuzzing/executiontracer/execution_tracer.go index 46bfb01a..0b876c0c 100644 --- a/fuzzing/executiontracer/execution_tracer.go +++ b/fuzzing/executiontracer/execution_tracer.go @@ -110,6 +110,12 @@ func (t *ExecutionTracer) GetTrace(txHash common.Hash) *ExecutionTrace { // OnTxEnd is called upon the end of transaction execution, as defined by tracers.Tracer. func (t *ExecutionTracer) OnTxEnd(receipt *coretypes.Receipt, err error) { + // We avoid storing the trace for this transaction. An error should realistically only occur if we hit a block gas + // limit error. In this case, the transaction will be retried in the next block and we can retrieve the trace at + // that time. + if err != nil || receipt == nil { + return + } t.traceMap[receipt.TxHash] = t.trace }