From 1885360e830d00b1845e350e0e4b782f15127eb9 Mon Sep 17 00:00:00 2001 From: Guido Vranken Date: Thu, 30 Nov 2023 02:54:22 +0100 Subject: [PATCH] Call Tracer.CaptureState before memory expansion --- core/vm/interpreter.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/vm/interpreter.go b/core/vm/interpreter.go index 79dbf1161e4..161068229bf 100644 --- a/core/vm/interpreter.go +++ b/core/vm/interpreter.go @@ -293,11 +293,15 @@ func (in *EVMInterpreter) Run(contract *Contract, input []byte, readOnly bool) ( if err != nil || !contract.UseGas(dynamicCost) { return nil, ErrOutOfGas } + // Do tracing before memory expansion + if in.cfg.Debug { + in.cfg.Tracer.CaptureState(_pc, op, gasCopy, cost, callContext, in.returnData, in.depth, err) //nolint:errcheck + logged = true + } if memorySize > 0 { mem.Resize(memorySize) } - } - if in.cfg.Debug { + } else if in.cfg.Debug { in.cfg.Tracer.CaptureState(_pc, op, gasCopy, cost, callContext, in.returnData, in.depth, err) //nolint:errcheck logged = true }