From 4a4115017dd473ee9fbb8566b46316b85b5accd5 Mon Sep 17 00:00:00 2001 From: Zhang Guyu Date: Tue, 5 Jul 2022 15:14:00 +0800 Subject: [PATCH] feat: trace state change only if store is nil (#11) --- pkg/txtracev1/trace_logger.go | 2 +- pkg/txtracev2/trace_logger.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/txtracev1/trace_logger.go b/pkg/txtracev1/trace_logger.go index f3d291f..3da2e46 100644 --- a/pkg/txtracev1/trace_logger.go +++ b/pkg/txtracev1/trace_logger.go @@ -286,7 +286,7 @@ func (ot *OeTracer) CaptureState(pc uint64, op vm.OpCode, gas, cost uint64, scop fromTrace.childTraces = append(fromTrace.childTraces, trace) case vm.SSTORE: stackLen := len(stack.Data()) - if stackLen >= 2 { + if stackLen >= 2 && ot.store == nil { accountAddress := contract.Address() if ot.stateDiff[accountAddress] == nil { ot.stateDiff[accountAddress] = make(AccountDiff) diff --git a/pkg/txtracev2/trace_logger.go b/pkg/txtracev2/trace_logger.go index 2e7e9b0..f2d3f43 100644 --- a/pkg/txtracev2/trace_logger.go +++ b/pkg/txtracev2/trace_logger.go @@ -300,7 +300,7 @@ func (ot *OeTracer) CaptureState(pc uint64, op vm.OpCode, gas, cost uint64, scop ot.traceStack[len(ot.traceStack)-1].Error = "execution reverted" case vm.SSTORE: stackLen := len(scope.Stack.Data()) - if stackLen >= 2 { + if stackLen >= 2 && ot.store == nil { accountAddress := scope.Contract.Address() if ot.stateDiff[accountAddress] == nil { ot.stateDiff[accountAddress] = make(AccountDiff)