From d80d30bd5a84837e4780a888b21ef49eb6398c9b Mon Sep 17 00:00:00 2001 From: Robert Raynor Date: Sat, 10 Aug 2024 10:35:04 -0700 Subject: [PATCH 1/2] Check if blobs are expired before returning --- disperser/apiserver/server.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/disperser/apiserver/server.go b/disperser/apiserver/server.go index eda0553389..ee7249e35d 100644 --- a/disperser/apiserver/server.go +++ b/disperser/apiserver/server.go @@ -727,6 +727,12 @@ func (s *DispersalServer) RetrieveBlob(ctx context.Context, req *pb.RetrieveBlob return nil, api.NewInternalError("failed to get blob metadata, please retry") } + if blobMetadata.Expiry < uint64(time.Now().Unix()) { + s.metrics.HandleNotFoundRpcRequest("RetrieveBlob") + s.metrics.HandleNotFoundRequest("RetrieveBlob") + return nil, api.NewNotFoundError("blob expired") + } + // Check throughout rate limit blobSize := encoding.GetBlobSize(blobMetadata.ConfirmationInfo.BlobCommitment.Length) From 7c951a87bf82169034c5aa7d3a6dcfc395ef2216 Mon Sep 17 00:00:00 2001 From: Robert Raynor Date: Sat, 10 Aug 2024 10:51:24 -0700 Subject: [PATCH 2/2] Use existing error message --- disperser/apiserver/server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/disperser/apiserver/server.go b/disperser/apiserver/server.go index ee7249e35d..4dbf48de20 100644 --- a/disperser/apiserver/server.go +++ b/disperser/apiserver/server.go @@ -730,7 +730,7 @@ func (s *DispersalServer) RetrieveBlob(ctx context.Context, req *pb.RetrieveBlob if blobMetadata.Expiry < uint64(time.Now().Unix()) { s.metrics.HandleNotFoundRpcRequest("RetrieveBlob") s.metrics.HandleNotFoundRequest("RetrieveBlob") - return nil, api.NewNotFoundError("blob expired") + return nil, api.NewNotFoundError("no metadata found for the given batch header hash and blob index") } // Check throughout rate limit