Skip to content
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

rpc-sts: add config options for stake-weighted qos #197

Merged
merged 2 commits into from
Mar 20, 2024

Conversation

t-nelson
Copy link

Problem

no simple way to configure an rpc node to send transactions to staked peer(s), as per stake-weighted qos

Summary of Changes

  • adds --rpc-send-transaction-tpu-peer HOST:PORT to specify a specific tpu peer to send transctions to, instead of the current leader. this argument may be passed multiple times.
  • adds --rpc-send-transaction-also-leader to continue sending to the current leader even though tpu peers have been specified with --rpc-send-transaction-tpu-peer HOST:PORT

@t-nelson t-nelson requested a review from CriesofCarrots March 12, 2024 00:21
@codecov-commenter
Copy link

codecov-commenter commented Mar 12, 2024

Codecov Report

Attention: Patch coverage is 62.50000% with 6 lines in your changes are missing coverage. Please review.

Project coverage is 81.9%. Comparing base (184ba6c) to head (cf30e97).

Additional details and impacted files
@@            Coverage Diff            @@
##           master     #197     +/-   ##
=========================================
- Coverage    81.9%    81.9%   -0.1%     
=========================================
  Files         837      837             
  Lines      226898   226912     +14     
=========================================
- Hits       185871   185862      -9     
- Misses      41027    41050     +23     

@CriesofCarrots
Copy link

Is this ready for review?

@t-nelson t-nelson marked this pull request as ready for review March 12, 2024 20:22
@t-nelson
Copy link
Author

Is this ready for review?

sure! i was trying to think of an easy way to test it. probably gonna have to hijack devnet or something 🤕

Copy link

@CriesofCarrots CriesofCarrots left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally, the addressing logic looks good. Couple small config comments, and we need to make the change twice if the initial send should go to flagged tpu_peers.

send-transaction-service/src/send_transaction_service.rs Outdated Show resolved Hide resolved
@@ -115,6 +115,8 @@ 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>>,

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)?

Copy link
Author

@t-nelson t-nelson Mar 20, 2024

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

@t-nelson t-nelson force-pushed the stslo branch 2 times, most recently from 04c1579 to fae62c8 Compare March 20, 2024 05:08
Copy link

@CriesofCarrots CriesofCarrots left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a preference for pub tpu_peers: Vec<SocketAddr> because it makes call/iteration site an easier read. But I'm guessing you feel more strongly about this than I do, so okay to ship as-is 😅

let mut addresses = config
.tpu_peers
.as_ref()
.map(|addrs| addrs.iter().map(|a| (a, 0)).collect::<Vec<_>>())

Choose a reason for hiding this comment

The 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.

Copy link
Author

Choose a reason for hiding this comment

The 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

@CriesofCarrots
Copy link

v1.18 backport?

@t-nelson
Copy link
Author

v1.18 backport?

prolly 1.17 too

@t-nelson t-nelson merged commit f41fb84 into anza-xyz:master Mar 20, 2024
37 checks passed
@t-nelson t-nelson deleted the stslo branch March 20, 2024 17:13
Copy link

mergify bot commented Mar 20, 2024

Backports to the stable branch are to be avoided unless absolutely necessary for fixing bugs, security issues, and perf regressions. Changes intended for backport should be structured such that a minimum effective diff can be committed separately from any refactoring, plumbing, cleanup, etc that are not strictly necessary to achieve the goal. Any of the latter should go only into master and ride the normal stabilization schedule.

Copy link

mergify bot commented Mar 20, 2024

Backports to the beta branch are to be avoided unless absolutely necessary for fixing bugs, security issues, and perf regressions. Changes intended for backport should be structured such that a minimum effective diff can be committed separately from any refactoring, plumbing, cleanup, etc that are not strictly necessary to achieve the goal. Any of the latter should go only into master and ride the normal stabilization schedule. Exceptions include CI/metrics changes, CLI improvements and documentation updates on a case by case basis.

mergify bot pushed a commit that referenced this pull request Mar 20, 2024
* rpc-sts: plumb options for swqos config

* rpc-sts: send to specific tpu peers when configured

(cherry picked from commit f41fb84)

# Conflicts:
#	send-transaction-service/src/send_transaction_service.rs
#	validator/src/cli.rs
#	validator/src/main.rs
mergify bot pushed a commit that referenced this pull request Mar 20, 2024
* rpc-sts: plumb options for swqos config

* rpc-sts: send to specific tpu peers when configured

(cherry picked from commit f41fb84)

# Conflicts:
#	send-transaction-service/src/send_transaction_service.rs
#	validator/src/cli.rs
#	validator/src/main.rs
t-nelson added a commit that referenced this pull request Mar 21, 2024
* rpc-sts: plumb options for swqos config

* rpc-sts: send to specific tpu peers when configured

(cherry picked from commit f41fb84)

# Conflicts:
#	send-transaction-service/src/send_transaction_service.rs
#	validator/src/cli.rs
#	validator/src/main.rs
t-nelson added a commit that referenced this pull request Mar 21, 2024
* rpc-sts: plumb options for swqos config

* rpc-sts: send to specific tpu peers when configured

(cherry picked from commit f41fb84)

# Conflicts:
#	send-transaction-service/src/send_transaction_service.rs
#	validator/src/cli.rs
#	validator/src/main.rs
t-nelson added a commit that referenced this pull request Mar 21, 2024
…#197) (#340)

rpc-sts: add config options for stake-weighted qos (#197)

* rpc-sts: plumb options for swqos config

* rpc-sts: send to specific tpu peers when configured

(cherry picked from commit f41fb84)

# Conflicts:
#	send-transaction-service/src/send_transaction_service.rs
#	validator/src/cli.rs
#	validator/src/main.rs

Co-authored-by: Trent Nelson <490004+t-nelson@users.noreply.github.com>
t-nelson added a commit that referenced this pull request Mar 21, 2024
…#197) (#341)

rpc-sts: add config options for stake-weighted qos (#197)

* rpc-sts: plumb options for swqos config

* rpc-sts: send to specific tpu peers when configured

(cherry picked from commit f41fb84)

# Conflicts:
#	send-transaction-service/src/send_transaction_service.rs
#	validator/src/cli.rs
#	validator/src/main.rs

Co-authored-by: Trent Nelson <490004+t-nelson@users.noreply.github.com>
@HaoranYi HaoranYi mentioned this pull request Apr 8, 2024
anwayde pushed a commit to firedancer-io/agave that referenced this pull request Jul 23, 2024
…anza-xyz#197) (anza-xyz#341)

rpc-sts: add config options for stake-weighted qos (anza-xyz#197)

* rpc-sts: plumb options for swqos config

* rpc-sts: send to specific tpu peers when configured

(cherry picked from commit f41fb84)

# Conflicts:
#	send-transaction-service/src/send_transaction_service.rs
#	validator/src/cli.rs
#	validator/src/main.rs

Co-authored-by: Trent Nelson <490004+t-nelson@users.noreply.github.com>
codebender828 pushed a commit to codebender828/agave that referenced this pull request Oct 3, 2024
* rpc-sts: plumb options for swqos config

* rpc-sts: send to specific tpu peers when configured
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants