Skip to content

Commit 7683a34

Browse files
committed
Address review comments
Signed-off-by: senthil <cendhu@gmail.com>
1 parent c13cb1d commit 7683a34

4 files changed

Lines changed: 11 additions & 10 deletions

File tree

service/coordinator/signature_verifier_manager.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,14 +234,14 @@ func (sv *signatureVerifier) sendTransactionsToSVService(
234234

235235
if firstBatch {
236236
if err := splitAndSendToVerifier(stream, request); err != nil {
237-
return errors.Wrap(err, "send to stream ended with error")
237+
return err
238238
}
239239
firstBatch = false
240240
continue
241241
}
242242

243243
if err := stream.Send(request); err != nil {
244-
return errors.Wrap(err, "send to stream ended with error")
244+
return errors.Wrap(err, streamEndErrWrap)
245245
}
246246
logger.Debugf("Batch contains %d TXs, and was stored in the accumulator and sent to a sv", batchSize)
247247
}
@@ -281,7 +281,7 @@ func splitAndSendToVerifier(
281281
if err := stream.Send(rBatch); err != nil {
282282
// ResourceExhausted should not occur here, as we have split a block's transactions
283283
// into two batches, assuming the block size is less than the maximum gRPC message size.
284-
return err
284+
return errors.Wrap(err, streamEndErrWrap)
285285
}
286286
}
287287

service/coordinator/validator_committer_manager.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ import (
2525
"github.com/hyperledger/fabric-x-committer/utils/monitoring/promutil"
2626
)
2727

28+
const streamEndErrWrap = "sending to stream ended with an error"
29+
2830
type (
2931
// validatorCommitterManager is responsible for managing all communication with
3032
// all vcservices. It is responsible for:
@@ -263,7 +265,7 @@ func (vc *validatorCommitter) sendTransactionsToVCService(
263265

264266
if firstBatch {
265267
if err := splitAndSendToVC(stream, txBatch); err != nil {
266-
return errors.Wrap(err, "send to stream ended with error")
268+
return err
267269
}
268270
firstBatch = false
269271
continue
@@ -272,7 +274,7 @@ func (vc *validatorCommitter) sendTransactionsToVCService(
272274
if err := stream.Send(&protovcservice.TransactionBatch{
273275
Transactions: txBatch,
274276
}); err != nil {
275-
return errors.Wrap(err, "send to stream ended with error")
277+
return errors.Wrap(err, streamEndErrWrap)
276278
}
277279
logger.Debugf("TX node contains %d TXs, and was sent to a vcservice", len(txBatch))
278280
}
@@ -297,7 +299,7 @@ func splitAndSendToVC(
297299

298300
for _, rBatch := range blkToBatch {
299301
if err := stream.Send(rBatch); err != nil {
300-
return err
302+
return errors.Wrap(err, streamEndErrWrap)
301303
}
302304
}
303305

utils/connection/client_util.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const (
3535
// defaultGrpcMaxAttempts is set to a high number to allow the timeout to dictate the retry end condition.
3636
defaultGrpcMaxAttempts = 1024
3737
// TODO: All services including the orderer must use the same default maximum message size.
38-
// Hence, we need to move this constant to fabrix-x-common.
38+
// Hence, we need to move this constant to fabric-x-common.
3939
maxMsgSize = 100 * 1024 * 1024
4040
scResolverSchema = "sc.connection"
4141
)

utils/connection/server_util.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ func NewLocalHostServer() *ServerConfig {
4242

4343
// GrpcServer instantiate a [grpc.Server].
4444
func (c *ServerConfig) GrpcServer() *grpc.Server {
45-
var opts []grpc.ServerOption
45+
opts := append([]grpc.ServerOption{}, grpc.MaxRecvMsgSize(maxMsgSize))
46+
opts = append(opts, grpc.MaxSendMsgSize(maxMsgSize))
4647
if c.Creds != nil {
4748
cert, err := tls.LoadX509KeyPair(c.Creds.CertPath, c.Creds.KeyPath)
4849
utils.Must(err)
@@ -67,8 +68,6 @@ func (c *ServerConfig) GrpcServer() *grpc.Server {
6768
PermitWithoutStream: c.KeepAlive.EnforcementPolicy.PermitWithoutStream,
6869
}))
6970
}
70-
opts = append(opts, grpc.MaxRecvMsgSize(maxMsgSize))
71-
opts = append(opts, grpc.MaxSendMsgSize(maxMsgSize))
7271
return grpc.NewServer(opts...)
7372
}
7473

0 commit comments

Comments
 (0)