From ff351e899061cbd687219fda7446ad6b41c847f4 Mon Sep 17 00:00:00 2001 From: Cody Littley <56973212+cody-littley@users.noreply.github.com> Date: Thu, 6 Feb 2025 10:25:09 -0600 Subject: [PATCH] Fix max proto size for retrieval client (#1231) Signed-off-by: Cody Littley --- api/clients/v2/retrieval_client.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/api/clients/v2/retrieval_client.go b/api/clients/v2/retrieval_client.go index 1a99fe4834..fc715ccfed 100644 --- a/api/clients/v2/retrieval_client.go +++ b/api/clients/v2/retrieval_client.go @@ -165,10 +165,20 @@ func (r *retrievalClient) getChunksFromOperator( quorumID core.QuorumID, chunksChan chan clients.RetrievedChunks, ) { + + // TODO (cody-littley): this client should be refactored to make requests for smaller quantities of data + // in order to avoid hitting the max message size limit. This will allow us to have much smaller + // message size limits. + + maxBlobSize := 16 * units.MiB // maximum size of the original blob + encodingRate := 8 // worst case scenario if one validator has 100% stake + fudgeFactor := units.MiB // to allow for some overhead from things like protobuf encoding + maxMessageSize := maxBlobSize*encodingRate + fudgeFactor + conn, err := grpc.NewClient( core.OperatorSocket(opInfo.Socket).GetV2RetrievalSocket(), grpc.WithTransportCredentials(insecure.NewCredentials()), - grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(16 /* max blob size */ *8 /* encoding rate */ *units.MiB)), + grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(maxMessageSize)), ) defer func() { err := conn.Close()