Skip to content

Commit

Permalink
Relax the condition check for err in zero tracer
Browse files Browse the repository at this point in the history
This should be a safe change since we also do check if the object is actually in the live set.
  • Loading branch information
cffls committed Aug 7, 2024
1 parent 032a4f7 commit 956b892
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions eth/tracers/native/zero.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
}
Expand All @@ -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)
}
Expand Down

0 comments on commit 956b892

Please sign in to comment.