forked from solana-labs/solana
-
Notifications
You must be signed in to change notification settings - Fork 1k
Added option to specify tpu addresses in vortexor #6116
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
Merged
lijunwangs
merged 4 commits into
anza-xyz:master
from
lijunwangs:option_to_set_tpu_addresses
May 8, 2025
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,7 @@ use { | |
| solana_core::banking_trace::BankingTracer, | ||
| solana_logger::redirect_stderr_to_file, | ||
| solana_net_utils::{bind_in_range_with_config, SocketConfig}, | ||
| solana_sdk::{signature::read_keypair_file, signer::Signer}, | ||
| solana_sdk::{quic::QUIC_PORT_OFFSET, signature::read_keypair_file, signer::Signer}, | ||
| solana_streamer::streamer::StakedNodes, | ||
| solana_vortexor::{ | ||
| cli::Cli, | ||
|
|
@@ -20,7 +20,7 @@ use { | |
| std::{ | ||
| collections::HashMap, | ||
| env, | ||
| net::IpAddr, | ||
| net::{IpAddr, SocketAddr}, | ||
| sync::{atomic::AtomicBool, Arc, RwLock}, | ||
| time::Duration, | ||
| }, | ||
|
|
@@ -77,14 +77,21 @@ pub fn main() { | |
| let tpu_coalesce = Duration::from_millis(args.tpu_coalesce_ms); | ||
| let dynamic_port_range = args.dynamic_port_range; | ||
|
|
||
| let tpu_address = args.tpu_address; | ||
| let tpu_forward_address = args.tpu_forward_address; | ||
| let max_streams_per_ms = args.max_streams_per_ms; | ||
| let exit = Arc::new(AtomicBool::new(false)); | ||
| // To be linked with the Tpu sigverify and forwarder service | ||
| let (tpu_sender, tpu_receiver) = bounded(DEFAULT_CHANNEL_SIZE); | ||
| let (tpu_fwd_sender, _tpu_fwd_receiver) = bounded(DEFAULT_CHANNEL_SIZE); | ||
|
|
||
| let tpu_sockets = | ||
| Vortexor::create_tpu_sockets(*bind_address, dynamic_port_range, num_quic_endpoints); | ||
| let tpu_sockets = Vortexor::create_tpu_sockets( | ||
| *bind_address, | ||
| dynamic_port_range, | ||
| tpu_address, | ||
| tpu_forward_address, | ||
| num_quic_endpoints, | ||
| ); | ||
|
|
||
| let (banking_tracer, _) = BankingTracer::new( | ||
| None, // Not interesed in banking tracing | ||
|
|
@@ -125,7 +132,7 @@ pub fn main() { | |
| DEFAULT_SENDER_THREADS_COUNT, | ||
| DEFAULT_BATCH_SIZE, | ||
| DEFAULT_RECV_TIMEOUT, | ||
| destinations, | ||
| destinations.clone(), | ||
| ); | ||
|
|
||
| info!("Creating the SigVerifier"); | ||
|
|
@@ -156,6 +163,27 @@ pub fn main() { | |
| tpu_sockets.tpu_quic_fwd[0].local_addr() | ||
| ); | ||
|
|
||
| let tpu_address = tpu_sockets.tpu_quic[0].local_addr().unwrap(); | ||
| let tpu_public_address = SocketAddr::new( | ||
| tpu_address.ip(), | ||
| tpu_address.port().saturating_sub(QUIC_PORT_OFFSET), | ||
| ); | ||
| let tpu_fwd_address = tpu_sockets.tpu_quic_fwd[0].local_addr().unwrap(); | ||
| let tpu_fwd_public_address = SocketAddr::new( | ||
| tpu_fwd_address.ip(), | ||
| tpu_fwd_address.port().saturating_sub(QUIC_PORT_OFFSET), | ||
| ); | ||
|
|
||
| for destination in destinations.read().unwrap().iter() { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is great UX, thank you! |
||
| info!( | ||
| "To pair the validator with receiver address {destination} with this \ | ||
| vortexor, add the following arguments in the validator's start command: \ | ||
| --tpu-vortexor-receiver-address {destination} \ | ||
| --public-tpu-address {tpu_public_address} \ | ||
| --public-tpu-forward-address {tpu_fwd_public_address}", | ||
| ); | ||
| } | ||
|
|
||
| let vortexor = Vortexor::create_vortexor( | ||
| tpu_sockets, | ||
| staked_nodes, | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
How many dynamic ports does vortexor need? Maybe it could be easier to just make tpu_address and tpu_forwards_address required arguments and remove the dynamic_port_range argument?
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 dynamic_port_range is also used for client socket binds for rpc and websocket. We may add more sockets in the future such as for RPC service of the vortexor for subscription management.
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.
Oh I see, yes in this case it makes sense to have it to deconflict with agave. Also please make sure that defaults here are not the same as for agave itself, so if this is not provided we do not start accidentally binding on top of agave's default port range=)