From c6c5c3a2d8b7e3282d430f1df289e5405a73fa88 Mon Sep 17 00:00:00 2001 From: nischit Date: Tue, 3 Jun 2025 23:06:13 +0545 Subject: [PATCH 1/3] catch panic from decodeLogFunc --- internal/common/log.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/internal/common/log.go b/internal/common/log.go index f0fef4f..0fe2507 100644 --- a/internal/common/log.go +++ b/internal/common/log.go @@ -112,6 +112,15 @@ func DecodeLogs(chainId string, logs []Log) []*DecodedLog { for idx, eventLog := range logs { wg.Add(1) go func(idx int, eventLog Log, mut *sync.Mutex) { + defer func() { + if err := recover(); err != nil { + log.Error(). + Any("chainId", chainId). + Any("Logs", logs). + Err(fmt.Errorf("%v", err)). + Msg("Caught panic in DecodeLogs, possibly in decodeLogFunc") + } + }() defer wg.Done() decodedLog := decodeLogFunc(&eventLog, mut) decodedLogs[idx] = decodedLog From 6741303fbf798182a6c83bb88452e7e49cb2045b Mon Sep 17 00:00:00 2001 From: nischit Date: Wed, 4 Jun 2025 13:04:46 +0545 Subject: [PATCH 2/3] minor change --- internal/common/log.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/common/log.go b/internal/common/log.go index 0fe2507..991ca3f 100644 --- a/internal/common/log.go +++ b/internal/common/log.go @@ -120,6 +120,7 @@ func DecodeLogs(chainId string, logs []Log) []*DecodedLog { Err(fmt.Errorf("%v", err)). Msg("Caught panic in DecodeLogs, possibly in decodeLogFunc") } + decodedLogs[idx] = &DecodedLog{Log: eventLog} }() defer wg.Done() decodedLog := decodeLogFunc(&eventLog, mut) From 4d12177f58c8289314b505a4aad2ab468a7947a2 Mon Sep 17 00:00:00 2001 From: nischit Date: Wed, 4 Jun 2025 13:06:04 +0545 Subject: [PATCH 3/3] log update --- internal/common/log.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/common/log.go b/internal/common/log.go index 991ca3f..98268e5 100644 --- a/internal/common/log.go +++ b/internal/common/log.go @@ -117,6 +117,9 @@ func DecodeLogs(chainId string, logs []Log) []*DecodedLog { log.Error(). Any("chainId", chainId). Any("Logs", logs). + Int("logIndex", idx). + Str("logAddress", eventLog.Address). + Str("logTopic0", eventLog.Topic0). Err(fmt.Errorf("%v", err)). Msg("Caught panic in DecodeLogs, possibly in decodeLogFunc") }