Added more tracing to log computation

This commit is contained in:
Matthieu Vachon 2024-01-08 11:58:46 -05:00
parent 3181acac69
commit 3e44bf5895

View file

@ -298,12 +298,18 @@ func (f *Firehose) removeLogBlockIndexOnStateRevertedCalls() {
} }
func (f *Firehose) assignOrdinalAndIndexToReceiptLogs() { func (f *Firehose) assignOrdinalAndIndexToReceiptLogs() {
firehoseTrace("assigning ordinal and index to logs")
defer func() {
firehoseTrace("assigning ordinal and index to logs terminated")
}()
trx := f.transaction trx := f.transaction
receiptsLogs := trx.Receipt.Logs receiptsLogs := trx.Receipt.Logs
callLogs := []*pbeth.Log{} callLogs := []*pbeth.Log{}
for _, call := range trx.Calls { for _, call := range trx.Calls {
firehoseTrace("checking call reverted=%t logs=%d", call.StateReverted, len(call.Logs))
if call.StateReverted { if call.StateReverted {
continue continue
} }
@ -744,6 +750,8 @@ func (f *Firehose) OnLog(l *types.Log) {
} }
activeCall := f.callStack.Peek() activeCall := f.callStack.Peek()
firehoseTrace("adding log to call address=%s call=%d (has already %d logs)", l.Address, activeCall.Index, len(activeCall.Logs))
activeCall.Logs = append(activeCall.Logs, &pbeth.Log{ activeCall.Logs = append(activeCall.Logs, &pbeth.Log{
Address: l.Address.Bytes(), Address: l.Address.Bytes(),
Topics: topics, Topics: topics,