From 077938e82b47042fd0d3caa9f10db5a70bacec49 Mon Sep 17 00:00:00 2001 From: Ardit Marku Date: Thu, 7 Nov 2024 20:05:38 +0200 Subject: [PATCH] Move tracing reset to OnTxEnd hook --- fvm/evm/debug/tracer.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/fvm/evm/debug/tracer.go b/fvm/evm/debug/tracer.go index 52b4a7e5236..2568e894958 100644 --- a/fvm/evm/debug/tracer.go +++ b/fvm/evm/debug/tracer.go @@ -165,12 +165,6 @@ func NewSafeTxTracer(ct *CallTracer) *tracers.Tracer { if ct.tracer.OnTxStart != nil { ct.tracer.OnTxStart(vm, tx, from) } - // reset tracing to have fresh state - if err := ct.ResetTracer(); err != nil { - l.Error().Err(err). - Msg("failed to reset tracer") - return - } } wrapped.OnTxEnd = func(receipt *types.Receipt, err error) { @@ -197,6 +191,13 @@ func NewSafeTxTracer(ct *CallTracer) *tracers.Tracer { return } ct.resultsByTxID[receipt.TxHash] = res + + // reset tracing to have fresh state + if err := ct.ResetTracer(); err != nil { + l.Error().Err(err). + Msg("failed to reset tracer") + return + } } wrapped.OnEnter = func(