-
Notifications
You must be signed in to change notification settings - Fork 118
feat(l1): new initial_lookup_interval and lookup_interval cli args #5236
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
base: main
Are you sure you want to change the base?
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 makes the peer lookup intervals configurable via CLI arguments instead of hardcoded constants, enabling easier testing of different P2P network configurations.
Key changes:
- Converts
INITIAL_LOOKUP_INTERVALandLOOKUP_INTERVALfrom Duration constants to u64 millisecond constants - Adds two new CLI parameters:
--p2p.initial-lookup-intervaland--p2p.lookup-interval - Threads the configuration values through
P2PContextto bothDiscoveryServerandRLPxInitiator
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| docs/CLI.md | Documents the new CLI parameters with default values and descriptions; also updates version string |
| crates/networking/p2p/discv4/server.rs | Converts constants to u64 and adds interval fields to DiscoveryServer struct |
| crates/networking/p2p/network.rs | Adds lookup interval fields to P2PContext and accepts them as constructor parameters |
| crates/networking/p2p/rlpx/initiator.rs | Removes local interval fields and uses values from P2PContext instead |
| cmd/ethrex/cli.rs | Adds CLI argument definitions with default values from constants |
| cmd/ethrex/initializers.rs | Passes new parameters when creating L1 P2P context |
| cmd/ethrex/l2/initializers.rs | Passes new parameters when creating L2 P2P context |
| crates/networking/rpc/test_utils.rs | Updates test helper to pass the new parameters using constant values |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| #[cfg(feature = "l2")] | ||
| pub based_context: Option<P2PBasedContext>, | ||
| pub tx_broadcaster: GenServerHandle<TxBroadcaster>, | ||
| // The initial interval between peer lookups, until the number of peers reaches [target_peers](RLPxInitiatorState::target_peers). |
Copilot
AI
Nov 11, 2025
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.
The documentation reference RLPxInitiatorState::target_peers is incorrect. The struct RLPxInitiatorState does not exist in the codebase. This should refer to the actual field or remove the broken documentation link.
| // The initial interval between peer lookups, until the number of peers reaches [target_peers](RLPxInitiatorState::target_peers). | |
| // The initial interval between peer lookups, until the number of peers reaches the target number. |
|
@copilot suggest better names for the cli params |
Motivation
It can be useful to have the
INITIAL_LOOKUP_INTERVALandLOOKUP_INTERVALconstants as parameters in the command line to test different configurations.Description
This pr introduces
initial_lookup_intervalandlookup_intervalas new cli parameters.Closes #5148