node/gointerfaces/grpcutil: unify grpc server bring-up across daemons#22171
Merged
Conversation
…privateapi, p2p/sentry: unify grpc server bring-up Four sites re-inlined the interceptor/keepalive option block that grpcutil.NewServer already builds (two of them including its dead commented-out metrics hooks) and all four repeated the listen + health + serve tail. Split NewServer into NewServerWithOpts (no MaxConcurrentStreams, nil-safe creds) plus StartServer/ StartServerOnListener, and convert the sites. Per-site options are unchanged: downloader/txpool still run without MaxConcurrentStreams, txpool keeps ReadBufferSize(0)/WriteBufferSize(0), health registration stays gated where it was gated.
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors gRPC server initialization across multiple daemons to remove duplicated option/interceptor/keepalive blocks and centralize the common listen + (optional) health server + serve-goroutine startup logic in grpcutil.
Changes:
- Added
grpcutil.NewServerWithOptsfor composing a standard server with optional extragrpc.ServerOptions (and nil-safe creds handling). - Added
grpcutil.StartServer/StartServerOnListenerto own the common listener + health registration +Servegoroutine tail. - Updated downloader, txpool, privateapi, and sentry to use the unified helpers while preserving per-site option differences (e.g., txpool buffer sizes, healthCheck gating).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
node/gointerfaces/grpcutil/utils.go |
Introduces NewServerWithOpts and shared StartServer* helpers for consistent gRPC bring-up. |
cmd/downloader/main.go |
Switches downloader gRPC startup to grpcutil.NewServerWithOpts + grpcutil.StartServer. |
txnprovider/txpool/txpool_grpc_server.go |
Switches txpool gRPC startup to grpcutil.NewServerWithOpts (preserving buffer opts) + grpcutil.StartServer. |
node/privateapi/all.go |
Switches privateapi server startup to grpcutil.StartServer (preserving healthCheck gating). |
p2p/sentry/sentry_grpc_server.go |
Switches sentry server startup tail to grpcutil.StartServerOnListener (preserving custom listen config + healthCheck gating). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…creds by value, relabel txpool serve error Drop the *credentials.TransportCredentials pointer-to-interface params and their unwrap shims (sole callers pass literal nil); relabel the txpool serve-failure log, previously copy-pasted from privateapi; grammar-fix a moved comment.
AskAlexSharov
approved these changes
Jul 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
cmd/downloader,txnprovider/txpool,node/privateapi, andp2p/sentryeach re-inlined the interceptor/keepalive option block thatgrpcutil.NewServeralready builds — two of them complete with its dead commented-out metrics hooks — and all four repeated the same listen + health-server + serve-goroutine tail.NewServer(rateLimit, creds)now delegates to a newNewServerWithOpts(creds, extraOpts...)(nil-safe creds, no forcedMaxConcurrentStreams), andStartServer/StartServerOnListenerown the listen/health/serve tail. The four sites convert onto these.Option preservation was the review focus, per site: downloader and txpool still run without
MaxConcurrentStreams(as before); txpool keeps its explicitReadBufferSize(0)/WriteBufferSize(0); privateapi/sentry keep health registration gated on theirhealthCheckflag while downloader/txpool keep it unconditional; existingNewServercallers see byte-identical behavior.Two deliberate exceptions to strict preservation:
StartGrpcs now takecredentials.TransportCredentialsby value (asprivateapi.StartGrpcalready does) instead of pointer-to-interface, dropping the identical unwrap shim at each site; their sole callers pass literalniland are unchanged.txpool gRPC server failinstead of theprivate RPC server failstring copy-pasted from privateapi — in the standalone txpool daemon,--private.api.addrnames the remote node it connects to, so the old label pointed triage at the wrong process. Nothing greps or asserts these strings.Otherwise no behavior change — existing tests are the safety net (txpool, privateapi, sentry suites green). Full
make lintclean,make erigon integrationbuild. Net −117 lines.Part of a dedup series; siblings #22165–#22170.