Skip to content

Commit

Permalink
Merge pull request #2801 from OffchainLabs/overflow_check
Browse files Browse the repository at this point in the history
[NIT-2944] Check batchProcessed > 0 to avoid underflow
  • Loading branch information
joshuacolvin0 authored Nov 20, 2024
2 parents 387ac79 + 3b07fcc commit 288a285
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions arbnode/sync_monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,13 @@ func (s *SyncMonitor) FullSyncProgressMap() map[string]interface{} {
batchProcessed := s.inboxReader.GetLastReadBatchCount()
res["batchProcessed"] = batchProcessed

processedBatchMsgs, err := s.inboxReader.Tracker().GetBatchMessageCount(batchProcessed - 1)
if err != nil {
res["batchMetadataError"] = err.Error()
} else {
res["messageOfProcessedBatch"] = processedBatchMsgs
if batchProcessed > 0 {
processedBatchMsgs, err := s.inboxReader.Tracker().GetBatchMessageCount(batchProcessed - 1)
if err != nil {
res["batchMetadataError"] = err.Error()
} else {
res["messageOfProcessedBatch"] = processedBatchMsgs
}
}

l1reader := s.inboxReader.l1Reader
Expand Down

0 comments on commit 288a285

Please sign in to comment.