From 956b89283a78fb4add2042f22417ec37b2ffe55a Mon Sep 17 00:00:00 2001 From: Jerry Date: Wed, 7 Aug 2024 15:37:11 -0700 Subject: [PATCH] Relax the condition check for err in zero tracer This should be a safe change since we also do check if the object is actually in the live set. --- eth/tracers/native/zero.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eth/tracers/native/zero.go b/eth/tracers/native/zero.go index dc357f7c090..a400024b501 100644 --- a/eth/tracers/native/zero.go +++ b/eth/tracers/native/zero.go @@ -122,7 +122,7 @@ func (t *zeroTracer) CaptureState(pc uint64, op vm.OpCode, gas, cost uint64, sco slot := libcommon.Hash(stackData[stackLen-1].Bytes32()) // If the SSTORE is out of gas and the slot is in live state, we will add the slot to account read - if err == vm.ErrOutOfGas { + if err != nil { if t.env.IntraBlockState().HasLiveState(caller, &slot) { t.addAccountToTrace(caller) t.addSLOADToAccount(caller, slot) @@ -134,7 +134,7 @@ func (t *zeroTracer) CaptureState(pc uint64, op vm.OpCode, gas, cost uint64, sco case stackLen >= 1 && (op == vm.EXTCODECOPY || op == vm.EXTCODEHASH || op == vm.EXTCODESIZE || op == vm.BALANCE || op == vm.SELFDESTRUCT): addr := libcommon.Address(stackData[stackLen-1].Bytes20()) - if err == vm.ErrOutOfGas && op == vm.SELFDESTRUCT { + if err != nil && op == vm.SELFDESTRUCT { if t.env.IntraBlockState().HasLiveAccount(addr) { t.addAccountToTrace(addr) } @@ -146,7 +146,7 @@ func (t *zeroTracer) CaptureState(pc uint64, op vm.OpCode, gas, cost uint64, sco addr := libcommon.Address(stackData[stackLen-2].Bytes20()) // If the call is out of gas, we will add account but not the opcode - if err == vm.ErrOutOfGas && op == vm.CALL { + if err != nil && op == vm.CALL { if t.env.IntraBlockState().HasLiveAccount(addr) { t.addAccountToTrace(addr) }