Skip to content

Commit

Permalink
Handle potential error from newBlockRangeBatcher (#13344)
Browse files Browse the repository at this point in the history
  • Loading branch information
jtraglia authored Dec 15, 2023
1 parent 53bc968 commit 97dfec8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions beacon-chain/sync/rpc_blob_sidecars_by_range.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ func (s *Service) blobSidecarsByRangeRPCHandler(ctx context.Context, msg interfa
ticker := time.NewTicker(time.Second)
defer ticker.Stop()
batcher, err := newBlockRangeBatcher(rp, s.cfg.beaconDB, s.rateLimiter, s.cfg.chain.IsCanonical, ticker)
if err != nil {
log.WithError(err).Info("error in BlobSidecarsByRange batch")
s.writeErrorResponseToStream(responseCodeServerError, p2ptypes.ErrGeneric.Error(), stream)
tracing.AnnotateError(span, err)
return err
}

var batch blockBatch
wQuota := params.BeaconNetworkConfig().MaxRequestBlobSidecars
Expand All @@ -107,7 +113,7 @@ func (s *Service) blobSidecarsByRangeRPCHandler(ctx context.Context, msg interfa
}
}
if err := batch.error(); err != nil {
log.WithError(err).Debug("error in BlocksByRange batch")
log.WithError(err).Debug("error in BlobSidecarsByRange batch")
s.writeErrorResponseToStream(responseCodeServerError, p2ptypes.ErrGeneric.Error(), stream)
tracing.AnnotateError(span, err)
return err
Expand Down Expand Up @@ -153,7 +159,7 @@ func validateBlobsByRange(r *pb.BlobSidecarsByRangeRequest, current primitives.S
}

var err error
rp.end, err = rp.start.SafeAdd((rp.size - 1))
rp.end, err = rp.start.SafeAdd(rp.size - 1)
if err != nil {
return rangeParams{}, errors.Wrap(p2ptypes.ErrInvalidRequest, "overflow start + count -1")
}
Expand Down

0 comments on commit 97dfec8

Please sign in to comment.