Fixed some small stuff while merging extended-tracer in

This commit is contained in:
Matthieu Vachon 2024-01-15 14:03:07 -05:00
parent 35c5b287f0
commit 8545daf9f9
2 changed files with 10 additions and 6 deletions

View file

@ -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()

View file

@ -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: