Skip to content

Commit

Permalink
Fix max proto size for retrieval client (#1231)
Browse files Browse the repository at this point in the history
Signed-off-by: Cody Littley <[email protected]>
  • Loading branch information
cody-littley authored Feb 6, 2025
1 parent 3ad96b1 commit ff351e8
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion api/clients/v2/retrieval_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit ff351e8

Please sign in to comment.