-
Notifications
You must be signed in to change notification settings - Fork 1k
rpc-sts: add config options for stake-weighted qos #197
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -115,6 +115,7 @@ pub struct Config { | |
| pub batch_send_rate_ms: u64, | ||
| /// When the retry pool exceeds this max size, new transactions are dropped after their first broadcast attempt | ||
| pub retry_pool_max_size: usize, | ||
| pub tpu_peers: Option<Vec<SocketAddr>>, | ||
| } | ||
|
|
||
| impl Default for Config { | ||
|
|
@@ -127,6 +128,7 @@ impl Default for Config { | |
| batch_size: DEFAULT_TRANSACTION_BATCH_SIZE, | ||
| batch_send_rate_ms: DEFAULT_BATCH_SEND_RATE_MS, | ||
| retry_pool_max_size: MAX_TRANSACTION_RETRY_POOL_SIZE, | ||
| tpu_peers: None, | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -566,12 +568,18 @@ impl SendTransactionService { | |
| stats: &SendTransactionServiceStats, | ||
| ) { | ||
| // Processing the transactions in batch | ||
| let addresses = Self::get_tpu_addresses_with_slots( | ||
| let mut addresses = config | ||
| .tpu_peers | ||
| .as_ref() | ||
| .map(|addrs| addrs.iter().map(|a| (a, 0)).collect::<Vec<_>>()) | ||
|
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 line would be so much simpler and easier to read if tpu_peers was just a Vec.
Author
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. it would also be easier to read if we didn't collect the leader id with the leader slot just for the sake of a debug-level log message :upside: i started to remove it but refrained for the sake of staying on topic |
||
| .unwrap_or_default(); | ||
| let leader_addresses = Self::get_tpu_addresses_with_slots( | ||
| tpu_address, | ||
| leader_info, | ||
| config, | ||
| connection_cache.protocol(), | ||
| ); | ||
| addresses.extend(leader_addresses); | ||
|
|
||
| let wire_transactions = transactions | ||
| .iter() | ||
|
|
@@ -584,8 +592,8 @@ impl SendTransactionService { | |
| }) | ||
| .collect::<Vec<&[u8]>>(); | ||
|
|
||
| for address in &addresses { | ||
| Self::send_transactions(address.0, &wire_transactions, connection_cache, stats); | ||
| for (address, _) in &addresses { | ||
| Self::send_transactions(address, &wire_transactions, connection_cache, stats); | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -702,14 +710,20 @@ impl SendTransactionService { | |
|
|
||
| let iter = wire_transactions.chunks(config.batch_size); | ||
| for chunk in iter { | ||
| let mut addresses = config | ||
|
t-nelson marked this conversation as resolved.
|
||
| .tpu_peers | ||
| .as_ref() | ||
| .map(|addrs| addrs.iter().collect::<Vec<_>>()) | ||
| .unwrap_or_default(); | ||
| let mut leader_info_provider = leader_info_provider.lock().unwrap(); | ||
| let leader_info = leader_info_provider.get_leader_info(); | ||
| let addresses = Self::get_tpu_addresses( | ||
| let leader_addresses = Self::get_tpu_addresses( | ||
| tpu_address, | ||
| leader_info, | ||
| config, | ||
| connection_cache.protocol(), | ||
| ); | ||
| addresses.extend(leader_addresses); | ||
|
|
||
| for address in &addresses { | ||
| Self::send_transactions(address, chunk, connection_cache, stats); | ||
|
|
||
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.
What's the value of an Option here, instead of just a Vec that may be empty (when flag isn't set)?
Uh oh!
There was an error while loading. Please reload this page.
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.
pedantry mostly. preference for type safety over implicit sentinels