Skip to content

Commit 77b0423

Browse files
committed
Improve logging
1 parent b7a2010 commit 77b0423

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

espresso/streamer.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,15 +156,18 @@ func (s *BatchStreamer[B]) RefreshSafeL1Origin(safeL1Origin eth.BlockID) error {
156156
s.Reset()
157157
}
158158

159-
return err
159+
if err != nil {
160+
return fmt.Errorf("failed to confirm espresso block height: %w", err)
161+
}
162+
return nil
160163
}
161164

162165
// Update streamer state based on L1 and L2 sync status
163166
func (s *BatchStreamer[B]) Refresh(ctx context.Context, finalizedL1 eth.L1BlockRef, safeBatchNumber uint64, safeL1Origin eth.BlockID) error {
164167
s.FinalizedL1 = finalizedL1
165168

166169
if err := s.RefreshSafeL1Origin(safeL1Origin); err != nil {
167-
return err
170+
return fmt.Errorf("failed to refresh safe L1 origin: %w", err)
168171
}
169172

170173
// NOTE: be sure to update s.finalizedL1 before checking this condition and returning
@@ -272,7 +275,7 @@ func (s *BatchStreamer[B]) Update(ctx context.Context) error {
272275
// the current block height available to process.
273276
currentBlockHeight, err := s.EspressoClient.FetchLatestBlockHeight(ctx)
274277
if err != nil {
275-
return err
278+
return fmt.Errorf("failed to fetch latest block height: %w", err)
276279
}
277280

278281
// Streaming API implementation
@@ -556,7 +559,7 @@ func (s *BatchStreamer[B]) confirmEspressoBlockHeight(safeL1Origin eth.BlockID)
556559
s.fallbackHotShotPos = s.originHotShotPos
557560
return false, nil
558561
} else if err != nil {
559-
return false, err
562+
return false, fmt.Errorf("failed to get finalized state from light client: %w", err)
560563
}
561564

562565
shouldReset = hotshotState.BlockHeight < s.fallbackHotShotPos

op-node/rollup/derive/attributes_queue.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,11 @@ func CaffNextBatch(s *espresso.BatchStreamer[EspressoBatch], ctx context.Context
121121
// Get the L1 finalized block
122122
finalizedL1Block, err := l1Fetcher.L1BlockRefByLabel(ctx, eth.Finalized)
123123
if err != nil {
124-
s.Log.Error("failed to get the L1 finalized block", "err", err)
125-
return nil, false, err
124+
return nil, false, fmt.Errorf("failed to get the L1 finalized block: %w", err)
126125
}
127126
// Refresh the sync status
128127
if err := s.Refresh(ctx, finalizedL1Block, parent.Number, parent.L1Origin); err != nil {
129-
return nil, false, err
128+
return nil, false, fmt.Errorf("failed to refresh Espresso streamer: %w", err)
130129
}
131130

132131
// Update the streamer if needed

0 commit comments

Comments
 (0)