diff --git a/eth/tracers/firehose.go b/eth/tracers/firehose.go index 63b9893776..223edae42b 100644 --- a/eth/tracers/firehose.go +++ b/eth/tracers/firehose.go @@ -643,6 +643,13 @@ func (f *Firehose) completeTransaction(receipt *types.Receipt) *pbeth.Transactio f.removeLogBlockIndexOnStateRevertedCalls() f.assignOrdinalAndIndexToReceiptLogs() + if *f.applyBackwardCompatibility { + // Known Firehose issue: Failed call logging a log with no topics were not fixed in the old Firehose instrumentation + // leading to them to be rendered as `topics: [""]` instead of `topics: nil` like successful calls. + // Here we re-apply this bogus behavior. + f.noTopicsLogOnFailedCallSetToEmptyHash() + } + if *f.applyBackwardCompatibility { // Known Firehose issue: This field has never been populated in the old Firehose instrumentation } else { @@ -757,6 +764,18 @@ func (f *Firehose) assignOrdinalAndIndexToReceiptLogs() { } } +func (f *Firehose) noTopicsLogOnFailedCallSetToEmptyHash() { + for _, call := range f.transaction.Calls { + if call.StateReverted { + for _, log := range call.Logs { + if len(log.Topics) == 0 { + log.Topics = make([][]byte, 1) + } + } + } + } +} + // OnCallEnter implements the EVMLogger interface to initialize the tracing operation. func (f *Firehose) OnCallEnter(depth int, typ byte, from common.Address, to common.Address, input []byte, gas uint64, value *big.Int) { opCode := vm.OpCode(typ)