From 97f308a98f9f2f557a0815665f6497eac8f469fd Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Thu, 12 May 2022 21:20:40 +0200 Subject: [PATCH] core/vm: for tracing, do not report post-op memory --- 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 2b26c044af..4f1ebc43a2 100644 --- a/core/vm/interpreter.go +++ b/core/vm/interpreter.go @@ -223,11 +223,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.evm.depth, err) + 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.evm.depth, err) logged = true }