-
Notifications
You must be signed in to change notification settings - Fork 132
core/validatorapi: add eth2wrap logic to proxy #4042
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
Conversation
4e4e938 to
973b9e4
Compare
9c4a472 to
4a4e409
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #4042 +/- ##
==========================================
+ Coverage 53.80% 56.32% +2.51%
==========================================
Files 242 241 -1
Lines 39425 30910 -8515
==========================================
- Hits 21214 17410 -3804
+ Misses 15967 11228 -4739
- Partials 2244 2272 +28 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
pinebit
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the build is broken
Need to create a release on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the beacon node proxy mechanism by moving proxy logic from the router layer to the Handler interface, enabling cleaner architecture and better testability. The changes update the go-eth2-client dependency to add native proxy support.
- Introduces a new
Proxymethod to theHandlerinterface that returns*http.Responseinstead of writing directly tohttp.ResponseWriter - Removes beacon node address dependency from router initialization, simplifying the API
- Implements request body duplication in multi-client scenarios to enable proper fallback handling
Reviewed Changes
Copilot reviewed 17 out of 18 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| go.mod, go.sum | Updates go-eth2-client dependency from v0.27.1-obol.1 to v0.27.1-obol.2 |
| testutil/beaconmock/options.go | Adds ProxyFunc implementation with responseCapture helper for mock testing |
| testutil/beaconmock/beaconmock.go | Adds Proxy method to Mock struct |
| core/validatorapi/validatorapi.go | Adds Proxy method to Component |
| core/validatorapi/router.go | Refactors proxy handling from http.Handler to ProxyProvider interface |
| core/validatorapi/router_internal_test.go | Updates tests to use new proxy pattern and removes legacy test code |
| core/validatorapi/mocks/handler.go | Adds generated mock for Proxy method |
| app/eth2wrap/multi.go | Implements Proxy with request body duplication for multi-client fallback |
| app/eth2wrap/httpwrap.go | Adds Proxy wrapper with logging |
| app/eth2wrap/eth2wrap.go | Adds isBadGateway helper for fallback logic |
| app/eth2wrap/genwrap/genwrap.go | Updates code generation to handle ProxyProvider |
| app/eth2wrap/eth2wrap_gen.go | Adds generated Proxy method |
| app/app.go | Removes eth2Cl parameter from wireVAPIRouter |
| app/app_internal_test.go | Updates test to match new wireVAPIRouter signature |
| app/eth2wrap/multi_test.go, lazy_test.go | Adds test coverage for Proxy functionality |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
The previous PR #4042 added `eth2wrap` logic (`multi`,`lazy`,etc) to proxied requests but broke SSE requests. This PR fixes this issue by using `proxy.ServeHTTP(proxyResponseWriter{w.(writeFlusher)}, clonedReq)` to maintain a long lived HTTP connection between BN and VC. category: bug ticket: none



Proxied requests from the VC to the BN didn't have our
eth2wraplogic (such as sending to multiple BNs or retrying to fallback nodes) neither did they send our additional headers fromCHARON_BEACON_NODE_HEADERS.This changes our proxy to use the
eth2wrapclient to proxy to (possibly) multiple addresses instead of directly proxing to a single address.category: feature
ticket: none