Conversation
Refactors relay config to use DocumentedConfig/VerifiableConfig framework.
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (27.63%) is below the target coverage (50.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## master #2465 +/- ##
==========================================
+ Coverage 39.32% 39.42% +0.09%
==========================================
Files 552 553 +1
Lines 50999 51287 +288
==========================================
+ Hits 20055 20218 +163
- Misses 28409 28524 +115
- Partials 2535 2545 +10
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR introduces a new documented/verified RelayConfig for the relay service, wires the relay binary into the shared config framework, and keeps the legacy config path for blobapi compatibility while updating tests and documentation.
Changes:
- Add
RelayConfigimplementingconfig.DocumentedConfig/VerifiableConfig, with defaults, validation, and a helper to populate from the legacy config; generate corresponding Relay configuration docs. - Refactor the relay binary (
relay/cmd/main.go) to useconfig.Bootstrapand construct all dependencies (AWS/DynamoDB, object storage, chain state, etc.) off the new config type, while preserving the legacy CLI entrypoint for blobapi viaPopulateFromLegacy. - Update relay tests, test harnesses, and config/limiter comments to use the new config type and keep the docs for Controller/Relay in sync with the updated config structures.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
relay/timeout_config.go |
Simplifies timeout field comments to align with the generated docs and the new Relay config layout. |
relay/testutils.go |
Introduces NewTestRelayConfig returning the new *RelayConfig with sensible test defaults for caches, rate limits, timeouts, and ports. |
relay/server_test.go |
Switches tests to DefaultRelayConfig() and adjusts ports/rate limits; ensures tests exercise the new config type but currently leaves TestReadNonExistentBlob using an OS-assigned port while the client still dials :50051, which will cause a connection mismatch. |
relay/server.go |
Changes Server and NewServer to depend on *RelayConfig instead of the legacy *Config, wiring through all the same fields (caches, rate limits, timeouts, metrics port, etc.) from the new type. |
relay/relay_config.go |
Adds the new RelayConfig struct with defaults, validation logic (Verify), document-metadata methods, and a PopulateFromLegacy helper to bridge existing callers; note that EigenDADirectory is enforced as required in Verify but not marked docs:"required", so docs treat it as optional. |
relay/limiter/config.go |
Rewrites limiter config comments to be shorter, matching the new Relay config docs and rate limit descriptions without changing behavior. |
relay/cmd/main.go |
Replaces the urfave/cli-based entrypoint with a config.Bootstrap-driven run function that constructs all runtime dependencies off RelayConfig and starts the gRPC server with signal-based shutdown; currently, main blocks on a never-canceled context.Background() and run does not handle the nil-config (help) case from Bootstrap, which can lead to hangs and panics. |
relay/cmd/lib/relay.go |
Keeps the legacy CLI path for blobapi, now creating a RelayConfig via DefaultRelayConfig() plus PopulateFromLegacy and passing that into relay.NewServer, while keeping all legacy flag/config parsing intact. |
relay/cmd/lib/config.go |
Documents the legacy relay Config as a compatibility shim for blobapi, to be removed once blobapi migrates to the documented config framework. |
relay/cmd/flags/flags.go |
Marks the existing relay CLI flags as legacy, clarifying they are only for the blobapi-compatible path. |
inabox/tests/setup_disperser_harness.go |
Updates the in-a-box test harness to use relay.NewTestRelayConfig with the new config type when constructing relay servers. |
docs/config/Relay.md |
New auto-generated Relay config documentation describing all RelayConfig fields, environment variables, and defaults; currently shows EigenDADirectory as optional despite being required by Verify. |
docs/config/Controller.md |
Auto-regenerated Controller config docs reflecting updated common.GRPCServerConfig and AWS client documentation (e.g., Server.GrpcPort now required, AWS access/secret keys optional with defaults). |
common/config/doc_generator/main.go |
Extends the config doc generator to emit documentation for relay.DefaultRelayConfig alongside the existing controller and other configs. |
Comments suppressed due to low confidence (1)
relay/server_test.go:241
DefaultRelayConfig()leavesGRPCPortat its zero value, so this test now starts the server on0.0.0.0:0(an OS-assigned port), while the helpergetBlobstill dials0.0.0.0:50051. PreviouslydefaultConfig()hard-coded port 50051, so this change introduces a mismatch that will causeTestReadNonExistentBlobto connect to the wrong port; either setconfig.GRPCPort = 50051here (as in the other tests) or update the client helpers to use the actual listener address.
// This is the server used to read it back
config := DefaultRelayConfig()
addr := fmt.Sprintf("0.0.0.0:%d", config.GRPCPort)
listener, err := net.Listen("tcp", addr)
require.NoError(t, err)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Refactors relay config to use DocumentedConfig/VerifiableConfig framework.
Note: Leaves original config temporarily for use by blobapi (which merges relay flags with apiserver flags and launches the relay and apiserver using the old config format). Blobapi/apiserver should be refactored to the documented/verifiable config framework next (in a separate PR), so the old relay config logic can be properly removed.