diff --git a/core/state/statedb.go b/core/state/statedb.go index ba06d8e4d6..847812fe89 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -485,7 +485,7 @@ func (s *StateDB) SelfDestruct(addr common.Address) { prev: stateObject.selfDestructed, prevbalance: prev, }) - if s.logger != nil { + if s.logger != nil && prev.Sign() > 0 { s.logger.OnBalanceChange(addr, prev, n, BalanceDecreaseSelfdestruct) } stateObject.markSelfdestructed() diff --git a/eth/tracers/firehose.go b/eth/tracers/firehose.go index 250dafe25b..9b5e42a0f4 100644 --- a/eth/tracers/firehose.go +++ b/eth/tracers/firehose.go @@ -423,10 +423,6 @@ func (f *Firehose) CaptureEnter(typ vm.OpCode, from common.Address, to common.Ad f.ensureInCall() f.callStack.Peek().Suicide = true - if value.Sign() != 0 { - f.OnBalanceChange(from, value, common.Big0, state.BalanceDecreaseSelfdestruct) - } - // The next CaptureExit must be ignored, this variable will make the next CaptureExit to be ignored f.latestCallStartSuicided = true return @@ -670,6 +666,15 @@ func (f *Firehose) OnBalanceChange(a common.Address, prev, new *big.Int, reason return } + // Known Firehose issue: It's possible to burn Ether by sending some ether to a suicided account. In those case, + // at theend of block producing, StateDB finalize the block by burning ether from the account. This is something + // we were not tracking in the old Firehose instrumentation. + // + // New chain integration should remove this `if` statement all along. + if reason == state.BalanceDecreaseSelfdestructBurn { + return + } + f.ensureInBlockOrTrx() change := f.newBalanceChange("tracer", a, prev, new, balanceChangeReasonFromChain(reason)) @@ -1067,7 +1072,6 @@ func transactionTypeFromChainTxType(txType uint8) pbeth.TransactionTrace_Type { return pbeth.TransactionTrace_TRX_TYPE_DYNAMIC_FEE case types.LegacyTxType: return pbeth.TransactionTrace_TRX_TYPE_LEGACY - // Add when enabled in a fork // case types.BlobTxType: // return pbeth.TransactionTrace_TRX_TYPE_BLOB default: