Skip to content

Conversation

@DiogoSantoss
Copy link
Contributor

@DiogoSantoss DiogoSantoss commented Oct 21, 2025

Proxied requests from the VC to the BN didn't have our eth2wrap logic (such as sending to multiple BNs or retrying to fallback nodes) neither did they send our additional headers from CHARON_BEACON_NODE_HEADERS.
This changes our proxy to use the eth2wrap client to proxy to (possibly) multiple addresses instead of directly proxing to a single address.

category: feature
ticket: none

@DiogoSantoss DiogoSantoss self-assigned this Oct 21, 2025
@DiogoSantoss DiogoSantoss force-pushed the diogo/use-eth2wrap-in-proxy branch from 4e4e938 to 973b9e4 Compare October 21, 2025 14:33
@DiogoSantoss DiogoSantoss force-pushed the diogo/use-eth2wrap-in-proxy branch from 9c4a472 to 4a4e409 Compare October 22, 2025 08:54
@codecov
Copy link

codecov bot commented Oct 22, 2025

Codecov Report

❌ Patch coverage is 53.33333% with 35 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.32%. Comparing base (bba43cd) to head (a9a4240).
⚠️ Report is 17 commits behind head on main.

Files with missing lines Patch % Lines
app/eth2wrap/eth2wrap.go 4.76% 20 Missing ⚠️
app/eth2wrap/multi.go 77.77% 3 Missing and 3 partials ⚠️
core/validatorapi/router.go 78.94% 2 Missing and 2 partials ⚠️
app/eth2wrap/httpwrap.go 0.00% 3 Missing ⚠️
app/eth2wrap/eth2wrap_gen.go 60.00% 1 Missing and 1 partial ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Collaborator

@pinebit pinebit left a 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

@DiogoSantoss
Copy link
Contributor Author

Looks like the build is broken

Need to create a release on go-eth2-client to update this go.mod

@pinebit pinebit requested a review from Copilot October 31, 2025 09:06
Copy link

Copilot AI left a 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 Proxy method to the Handler interface that returns *http.Response instead of writing directly to http.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.

@sonarqubecloud
Copy link

@DiogoSantoss DiogoSantoss added the merge when ready Indicates bulldozer bot may merge when all checks pass label Nov 3, 2025
@obol-bulldozer obol-bulldozer bot merged commit 281b1ea into main Nov 3, 2025
12 checks passed
@obol-bulldozer obol-bulldozer bot deleted the diogo/use-eth2wrap-in-proxy branch November 3, 2025 15:47
obol-bulldozer bot pushed a commit that referenced this pull request Dec 8, 2025
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge when ready Indicates bulldozer bot may merge when all checks pass

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants