Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validator: Remove optional and duplicated dialopts for streaming middleware #8549

Merged
merged 1 commit into from
Mar 3, 2021

Conversation

prestonvanloon
Copy link
Member

What type of PR is this?

Other

What does this PR do? Why is it needed?

This stream interceptor is already defined in ConstructDialOptions.

func ConstructDialOptions(
maxCallRecvMsgSize int,
withCert string,
grpcRetries uint,
grpcRetryDelay time.Duration,
extraOpts ...grpc.DialOption,
) []grpc.DialOption {
var transportSecurity grpc.DialOption
if withCert != "" {
creds, err := credentials.NewClientTLSFromFile(withCert, "")
if err != nil {
log.Errorf("Could not get valid credentials: %v", err)
return nil
}
transportSecurity = grpc.WithTransportCredentials(creds)
} else {
transportSecurity = grpc.WithInsecure()
log.Warn("You are using an insecure gRPC connection. If you are running your beacon node and " +
"validator on the same machines, you can ignore this message. If you want to know " +
"how to enable secure connections, see: https://docs.prylabs.network/docs/prysm-usage/secure-grpc")
}
if maxCallRecvMsgSize == 0 {
maxCallRecvMsgSize = 10 * 5 << 20 // Default 50Mb
}
dialOpts := []grpc.DialOption{
transportSecurity,
grpc.WithDefaultCallOptions(
grpc.MaxCallRecvMsgSize(maxCallRecvMsgSize),
grpc_retry.WithMax(grpcRetries),
grpc_retry.WithBackoff(grpc_retry.BackoffLinear(grpcRetryDelay)),
),
grpc.WithStatsHandler(&ocgrpc.ClientHandler{}),
grpc.WithUnaryInterceptor(middleware.ChainUnaryClient(
grpc_opentracing.UnaryClientInterceptor(),
grpc_prometheus.UnaryClientInterceptor,
grpc_retry.UnaryClientInterceptor(),
grpcutils.LogRequests,
)),
grpc.WithChainStreamInterceptor(
grpcutils.LogStream,
grpc_opentracing.StreamClientInterceptor(),
grpc_prometheus.StreamClientInterceptor,
grpc_retry.StreamClientInterceptor(),
),
grpc.WithResolvers(&multipleEndpointsGrpcResolverBuilder{}),
}
dialOpts = append(dialOpts, extraOpts...)
return dialOpts
}

Which issues(s) does this PR fix?

None reported

Other notes for review

@codecov
Copy link

codecov bot commented Mar 3, 2021

Codecov Report

❗ No coverage uploaded for pull request base (develop@565d510). Click here to learn what that means.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             develop    #8549   +/-   ##
==========================================
  Coverage           ?   58.69%           
==========================================
  Files              ?      458           
  Lines              ?    32911           
  Branches           ?        0           
==========================================
  Hits               ?    19316           
  Misses             ?    10661           
  Partials           ?     2934           

@rauljordan rauljordan merged commit c9858b5 into develop Mar 3, 2021
@rauljordan rauljordan deleted the validator-grpc-opts-fix branch March 3, 2021 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants