-
Notifications
You must be signed in to change notification settings - Fork 117
refactor(l2): avoid peer handler logs #5253
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
Lines of code reportTotal lines added: Detailed view |
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 RPC API context to make syncer and peer_handler optional, enabling conditional initialization based on the "based" mode configuration in L2. The version is also bumped from 5.0.0 to 6.0.0.
Key changes:
- Modified
RpcApiContextto useOption<Arc<SyncManager>>andOption<PeerHandler>instead of required fields - Refactored L2 initializer to conditionally create networking components only when based mode is enabled
- Updated all RPC endpoints to handle optional syncer and peer_handler with proper error messages
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/CLI.md | Updated default builder extra data version from 5.0.0 to 6.0.0 |
| crates/networking/rpc/rpc.rs | Changed syncer and peer_handler fields to Option types in RpcApiContext |
| crates/networking/rpc/test_utils.rs | Updated test context construction to wrap values in Some() |
| crates/networking/rpc/net/mod.rs | Added Option unwrapping with error handling for peer_handler |
| crates/networking/rpc/eth/client.rs | Added Option unwrapping with error handling for syncer in syncing endpoint |
| crates/networking/rpc/engine/payload.rs | Added Option unwrapping with error handling for syncer in payload handlers |
| crates/networking/rpc/engine/fork_choice.rs | Added Option unwrapping with error handling for syncer in fork choice handler |
| crates/networking/rpc/admin/peers.rs | Added Option unwrapping with error handling for peer_handler in admin endpoints |
| crates/l2/networking/rpc/rpc.rs | Updated start_api signature to accept optional syncer and peer_handler |
| cmd/ethrex/l2/initializers.rs | Refactored to conditionally initialize networking components based on based mode flag |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Motivation
Currently, we initialize the
peer_handlerandSyncManagerin L2 only because theRpcApiContextstruct requires them.Description
Makes
peer_handlerandSyncManagerfields optional.Closes #5222