Skip to content

Commit

Permalink
fix: check that receipt is non-nil in OnTxEnd hook (#457)
Browse files Browse the repository at this point in the history
* throw panic if execution tracing fails

* do not store trace in case of error
  • Loading branch information
anishnaik authored Aug 27, 2024
1 parent ff587c3 commit 3beda5c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions fuzzing/executiontracer/execution_tracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 3beda5c

Please sign in to comment.