Skip to content

Commit

Permalink
undo some changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Siddharth More authored and Siddharth More committed Apr 2, 2024
1 parent 24ed6a2 commit 0c89a8e
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 44 deletions.
17 changes: 1 addition & 16 deletions disperser/apiserver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,6 @@ func (s *DispersalServer) DisperseBlobAuthenticated(stream pb.Disperser_Disperse
}

func (s *DispersalServer) DisperseBlob(ctx context.Context, req *pb.DisperseBlobRequest) (*pb.DisperseBlobReply, error) {
if req == nil {
s.metrics.HandleInvalidArgRequest("DisperseBlob Request")
return nil, api.NewInvalidArgError("DisperseBlob: Request must not be nil")
}

blob, err := s.validateRequestAndGetBlob(ctx, req)
if err != nil {
for _, quorumID := range req.CustomQuorumNumbers {
Expand Down Expand Up @@ -535,16 +530,11 @@ func (s *DispersalServer) GetBlobStatus(ctx context.Context, req *pb.BlobStatusR
}))
defer timer.ObserveDuration()

if req == nil {
s.metrics.HandleInvalidArgRequest("GetBlobStatus")
return nil, api.NewInvalidArgError("GetBlobStatus: Request must not be nil")
}

requestID := req.GetRequestId()
if len(requestID) == 0 {
s.metrics.HandleInvalidArgRpcRequest("GetBlobStatus")
s.metrics.HandleInvalidArgRequest("GetBlobStatus")
return nil, api.NewInvalidArgError("GetBlobStatus: request_id must not be empty")
return nil, api.NewInvalidArgError("request_id must not be empty")
}

s.logger.Info("received a new blob status request", "requestID", string(requestID))
Expand Down Expand Up @@ -654,11 +644,6 @@ func (s *DispersalServer) RetrieveBlob(ctx context.Context, req *pb.RetrieveBlob
}))
defer timer.ObserveDuration()

if req == nil {
s.metrics.HandleInvalidArgRequest("RetrieveBlob")
return nil, api.NewInvalidArgError("RetrieveBlob: Request must not be nil")
}

origin, err := common.GetClientAddress(ctx, s.rateConfig.ClientIPHeader, 2, true)
if err != nil {
s.metrics.HandleInvalidArgRpcRequest("RetrieveBlob")
Expand Down
5 changes: 0 additions & 5 deletions disperser/encoder/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,6 @@ func (s *Server) popRequest() {
func (s *Server) handleEncoding(ctx context.Context, req *pb.EncodeBlobRequest) (*pb.EncodeBlobReply, error) {
begin := time.Now()

if req == nil {
return nil, errors.New("handleEncoding: missing encode request")

}

if len(req.Data) == 0 {
return nil, errors.New("handleEncoding: missing data")

Expand Down
17 changes: 0 additions & 17 deletions node/grpc/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ func (s *Server) serveRetrieval() error {
}

func (s *Server) handleStoreChunksRequest(ctx context.Context, in *pb.StoreChunksRequest) (*pb.StoreChunksReply, error) {

// Get batch header hash
batchHeader, err := GetBatchHeader(in)
if err != nil {
Expand Down Expand Up @@ -194,11 +193,6 @@ func (s *Server) StoreChunks(ctx context.Context, in *pb.StoreChunksRequest) (*p
}))
defer timer.ObserveDuration()

if in == nil {
s.node.Metrics.RecordRPCRequest("StoreChunks", "failure")
return nil, api.NewInvalidArgError("StoreChunks: request is nil")
}

// Validate the request.
if err := s.validateStoreChunkRequest(in); err != nil {
return nil, err
Expand All @@ -224,11 +218,6 @@ func (s *Server) RetrieveChunks(ctx context.Context, in *pb.RetrieveChunksReques
}))
defer timer.ObserveDuration()

if in == nil {
s.node.Metrics.RecordRPCRequest("RetrieveChunks", "failure")
return nil, api.NewInvalidArgError("RetrieveChunks: request is nil")
}

if in.GetQuorumId() > core.MaxQuorumID {
return nil, fmt.Errorf("invalid request: quorum ID must be in range [0, %d], but found %d", core.MaxQuorumID, in.GetQuorumId())
}
Expand Down Expand Up @@ -281,12 +270,6 @@ func (s *Server) RetrieveChunks(ctx context.Context, in *pb.RetrieveChunksReques
}

func (s *Server) GetBlobHeader(ctx context.Context, in *pb.GetBlobHeaderRequest) (*pb.GetBlobHeaderReply, error) {

if in == nil {
s.node.Metrics.RecordRPCRequest("GetBlobHeader", "failure")
return nil, api.NewInvalidArgError("GetBlobHeader: request is nil")
}

var batchHeaderHash [32]byte
copy(batchHeaderHash[:], in.GetBatchHeaderHash())

Expand Down
8 changes: 2 additions & 6 deletions node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,20 +267,16 @@ func (n *Node) ProcessBatch(ctx context.Context, header *core.BatchHeader, blobs

log.Debug("Processing batch", "num of blobs", len(blobs))

if header == nil {
return nil, errors.New("ProcessBatch: batch header is nil")
}

if len(blobs) == 0 {
return nil, errors.New("the number of blobs must be greater than zero")
return nil, errors.New("ProcessBatch: number of blobs must be greater than zero")
}

if len(rawBlobs) == 0 {
return nil, errors.New("ProcessBatch: number of raw blobs must be greater than zero")
}

if len(blobs) != len(rawBlobs) {
return nil, errors.New("the number of parsed blobs must be the same as number of blobs from protobuf request")
return nil, errors.New("number of parsed blobs must be the same as number of blobs from protobuf request")
}

// Measure num batches received and its size in bytes
Expand Down

0 comments on commit 0c89a8e

Please sign in to comment.